8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 05:23:03 +01:00

Small NBAK performance optimization from Rom

an Simakov
This commit is contained in:
skidder 2007-05-04 21:25:04 +00:00
parent c8faa316b0
commit 8539ceb992
2 changed files with 10 additions and 5 deletions

View File

@ -133,8 +133,8 @@ bool GlobalRWLock::lock(thread_db* tdbb, locklevel_t level, SSHORT wait, SLONG o
COS_TRACE(("lock type=%i, level=%i, readerscount=%i, owner=%i", cached_lock->lck_type, level, readers.getCount(), owner_handle));
// Check if this is a recursion case
if (level == LCK_read) {
size_t n;
if (level == LCK_read) {
if (readers.find(owner_handle, n)) {
readers[n].entry_count++;
unlockCounters();
@ -160,7 +160,7 @@ bool GlobalRWLock::lock(thread_db* tdbb, locklevel_t level, SSHORT wait, SLONG o
ObjectOwnerData ownerData;
ownerData.owner_handle = owner_handle;
ownerData.entry_count++;
readers.add(ownerData);
readers.insert(n, ownerData);
}
else
{
@ -364,7 +364,7 @@ void GlobalRWLock::changeLockOwner(thread_db* tdbb, locklevel_t level, SLONG old
ObjectOwnerData ownerData;
ownerData.entry_count++;
ownerData.owner_handle = new_owner_handle;
readers.add(ownerData);
readers.insert(n, ownerData);
}
}
else {

View File

@ -2046,12 +2046,19 @@ bool CCH_prefetch_pages(thread_db* tdbb)
void set_diff_page(thread_db* tdbb, BufferDesc* bdb)
{
Database* dbb = tdbb->tdbb_database;
const int backup_state = dbb->dbb_backup_manager->get_state();
if (backup_state == nbak_state_normal)
return;
// Temporary pages don't write to delta
PageSpace* pageSpace =
dbb->dbb_page_manager.findPageSpace(bdb->bdb_page.getPageSpaceID());
fb_assert(pageSpace);
if (pageSpace->isTemporary())
return;
// Determine location of the page in difference file and write destination
// so BufferDesc AST handlers and write_page routine can safely use this information
if (bdb->bdb_page != HEADER_PAGE_NUMBER)
@ -2060,8 +2067,6 @@ void set_diff_page(thread_db* tdbb, BufferDesc* bdb)
bdb->bdb_buffer->pag_scn = dbb->dbb_backup_manager->get_current_scn(); // Set SCN for the page
}
const int backup_state = dbb->dbb_backup_manager->get_state();
switch (backup_state) {
case nbak_state_stalled:
dbb->dbb_backup_manager->lock_alloc(tdbb, true);