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

1. Fixed unlocking header page while CCH_release. Thanks to Vlad.

2. Fixed writing page while nbackup merge state is stalled.
3. Fixed using dead dbb in AST handler while somebody is changing cached lock of the GlobalRWLock.
This commit is contained in:
roman-simakov 2008-04-16 09:16:45 +00:00
parent c88b67cf27
commit dda2676ba5
4 changed files with 15 additions and 8 deletions

View File

@ -48,7 +48,7 @@ int GlobalRWLock::blocking_ast_cached_lock(void* ast_object)
try
{
Database* dbb = globalRWLock->cached_lock->lck_dbb;
Database* dbb = globalRWLock->getDatabase();
Database::SyncGuard dsGuard(dbb, true);
@ -68,12 +68,10 @@ GlobalRWLock::GlobalRWLock(thread_db* tdbb, MemoryPool& p, locktype_t lckType,
lck_owner_t default_logical_lock_owner, bool lock_caching)
: PermanentStorage(p), internal_blocking(0), external_blocking(false),
physicalLockOwner(physical_lock_owner), defaultLogicalLockOwner(default_logical_lock_owner),
lockCaching(lock_caching), readers(p)
lockCaching(lock_caching), readers(p), dbb(tdbb->getDatabase())
{
SET_TDBB(tdbb);
Database* dbb = tdbb->getDatabase();
cached_lock = FB_NEW_RPT(getPool(), lockLen) Lock();
cached_lock->lck_type = static_cast<lck_t>(lckType);
cached_lock->lck_owner_handle = 0;

View File

@ -124,6 +124,11 @@ public:
// Returns true if lock was released
bool tryReleaseLock(thread_db* tdbb);
Database* getDatabase() const
{
return dbb;
}
protected:
Lock* cached_lock;
// Flag to indicate that somebody is waiting via lock manager.
@ -149,6 +154,8 @@ private:
// false - unlock releases cached lock if possible
bool lockCaching;
Database* dbb;
Firebird::SortedArray<ObjectOwnerData, Firebird::EmptyStorage<ObjectOwnerData>,
SLONG, ObjectOwnerData, Firebird::DefaultComparator<SLONG> > readers;
ObjectOwnerData writer;

View File

@ -2124,14 +2124,14 @@ void CCH_release(thread_db* tdbb, WIN * window, const bool release_tail)
window->win_flags &= ~WIN_garbage_collect;
}
if (bdb->bdb_page == HEADER_PAGE_NUMBER)
dbb->dbb_backup_manager->unlock_shared_database(tdbb);
if (bdb->bdb_use_count == 1)
{
const bool marked = bdb->bdb_flags & BDB_marked;
bdb->bdb_flags &= ~(BDB_writer | BDB_marked | BDB_faked);
if (bdb->bdb_page == HEADER_PAGE_NUMBER)
dbb->dbb_backup_manager->unlock_shared_database(tdbb);
if (marked)
{
if (bdb->bdb_flags & BDB_dirty)
@ -6529,7 +6529,7 @@ static bool write_page(
const bool isTempPage = pageSpace->isTemporary();
if (!isTempPage && (backup_state == nbak_state_stalled ||
backup_state == nbak_state_merge) )
(backup_state == nbak_state_merge && bdb->bdb_difference_page)))
{
const bool res =

View File

@ -675,6 +675,8 @@ bool BackupManager::write_difference(ISC_STATUS* status, ULONG diff_page, Ods::p
temp_bdb.bdb_page = diff_page;
temp_bdb.bdb_dbb = database;
temp_bdb.bdb_buffer = page;
// Check that diff page is not allocation page
fb_assert(diff_page % (database->dbb_page_size/sizeof(ULONG)));
if (!PIO_write(diff_file, &temp_bdb, page, status))
return false;
return true;