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

Backported (from trunk) more reliable AST handling during the database cleanup.

This commit is contained in:
dimitr 2012-11-22 12:45:45 +00:00
parent 9f60a27a7f
commit 5eaecbbfc0
5 changed files with 9 additions and 19 deletions

View File

@ -91,8 +91,6 @@ namespace Jrd
delete dbb_monitoring_data; delete dbb_monitoring_data;
delete dbb_backup_manager; delete dbb_backup_manager;
dbb_flags |= DBB_destroying;
Checkout dcoHolder(this); Checkout dcoHolder(this);
// This line decrements the usage counter and may cause the destructor to be called. // This line decrements the usage counter and may cause the destructor to be called.
// It should happen with the dbb_sync unlocked. // It should happen with the dbb_sync unlocked.

View File

@ -106,8 +106,7 @@ const ULONG DBB_being_opened = 0x10000L; // database is being attached to
const ULONG DBB_gc_cooperative = 0x20000L; // cooperative garbage collection const ULONG DBB_gc_cooperative = 0x20000L; // cooperative garbage collection
const ULONG DBB_gc_background = 0x40000L; // background garbage collection by gc_thread const ULONG DBB_gc_background = 0x40000L; // background garbage collection by gc_thread
const ULONG DBB_no_fs_cache = 0x80000L; // Not using file system cache const ULONG DBB_no_fs_cache = 0x80000L; // Not using file system cache
const ULONG DBB_destroying = 0x100000L; // database destructor is called const ULONG DBB_monitor_locking = 0x100000L; // monitoring lock is being acquired
const ULONG DBB_monitor_locking = 0x200000L; // monitoring lock is being acquired
// //
// dbb_ast_flags // dbb_ast_flags
@ -197,7 +196,7 @@ public:
Firebird::status_exception::raise(Firebird::Arg::Gds(isc_bad_db_handle)); Firebird::status_exception::raise(Firebird::Arg::Gds(isc_bad_db_handle));
} }
if (ast && dbb->dbb_flags & DBB_destroying) if (ast && dbb->dbb_flags & DBB_not_in_use)
{ {
sync.unlock(); sync.unlock();
sync.release(); sync.release();

View File

@ -373,16 +373,13 @@ int DatabaseSnapshot::blockingAst(void* ast_object)
if (!(dbb->dbb_ast_flags & DBB_monitor_off)) if (!(dbb->dbb_ast_flags & DBB_monitor_off))
{ {
// Write the data to the shared memory // Write the data to the shared memory
if (!(dbb->dbb_flags & DBB_not_in_use)) try
{ {
try dumpData(tdbb);
{ }
dumpData(tdbb); catch (const Exception& ex)
} {
catch (const Exception& ex) iscLogException("Cannot dump the monitoring data", ex);
{
iscLogException("Cannot dump the monitoring data", ex);
}
} }
// Release the lock, if feasible // Release the lock, if feasible

View File

@ -61,8 +61,7 @@ int GlobalRWLock::blocking_ast_cached_lock(void* ast_object)
ThreadContextHolder tdbb; ThreadContextHolder tdbb;
tdbb->setDatabase(dbb); tdbb->setDatabase(dbb);
// do nothing if dbb is shutting down if (globalRWLock->cachedLock)
if (!(dbb->dbb_flags & DBB_not_in_use))
globalRWLock->blockingAstHandler(tdbb); globalRWLock->blockingAstHandler(tdbb);
} }
catch (const Firebird::Exception&) catch (const Firebird::Exception&)

View File

@ -374,9 +374,6 @@ int CCH_down_grade_dbb(void* ast_object)
{ {
Database::SyncGuard dsGuard(dbb, true); Database::SyncGuard dsGuard(dbb, true);
if (dbb->dbb_flags & DBB_not_in_use)
return 0;
Lock* const lock = dbb->dbb_lock; Lock* const lock = dbb->dbb_lock;
// Since this routine will be called asynchronously, // Since this routine will be called asynchronously,