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

Backport more complete fix for bug CORE-2993 : Fatal lock manager error "Invalid lock id (NNN)" while working with monitoring tables on a highly loaded system

This commit is contained in:
hvlad 2010-08-01 20:42:43 +00:00
parent 58b518a2b9
commit e8a75e91f7
3 changed files with 24 additions and 10 deletions

View File

@ -403,19 +403,27 @@ 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
try if (!(dbb->dbb_flags & DBB_not_in_use))
{ {
dumpData(tdbb, true); try
} {
catch (const Exception& ex) dumpData(tdbb, true);
{ }
ISC_STATUS_ARRAY status; catch (const Exception& ex)
ex.stuff_exception(status); {
gds__log_status("Cannot dump the monitoring data", status); ISC_STATUS_ARRAY status;
ex.stuff_exception(status);
gds__log_status("Cannot dump the monitoring data", status);
}
} }
// Release the lock and mark dbb as requesting a new one // Release the lock, if feasible
LCK_release(tdbb, lock); if (!(dbb->dbb_flags & DBB_monitor_locking))
{
LCK_release(tdbb, lock);
}
// Mark dbb as requesting a new lock
dbb->dbb_ast_flags |= DBB_monitor_off; dbb->dbb_ast_flags |= DBB_monitor_off;
} }

View File

@ -4692,7 +4692,9 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
if (dbb->dbb_ast_flags & DBB_monitor_off) if (dbb->dbb_ast_flags & DBB_monitor_off)
{ {
dbb->dbb_ast_flags &= ~DBB_monitor_off; dbb->dbb_ast_flags &= ~DBB_monitor_off;
dbb->dbb_flags |= DBB_monitor_locking;
LCK_lock(tdbb, dbb->dbb_monitor_lock, LCK_SR, LCK_WAIT); LCK_lock(tdbb, dbb->dbb_monitor_lock, LCK_SR, LCK_WAIT);
dbb->dbb_flags &= ~DBB_monitor_locking;
// While waiting for return from LCK_lock call above the blocking AST (see // While waiting for return from LCK_lock call above the blocking AST (see
// DatabaseSnapshot::blockingAst) was called and set DBB_monitor_off flag // DatabaseSnapshot::blockingAst) was called and set DBB_monitor_off flag
@ -5029,7 +5031,9 @@ static ISC_STATUS check_database(thread_db* tdbb, Attachment* attachment, ISC_ST
if (dbb->dbb_ast_flags & DBB_monitor_off) if (dbb->dbb_ast_flags & DBB_monitor_off)
{ {
dbb->dbb_ast_flags &= ~DBB_monitor_off; dbb->dbb_ast_flags &= ~DBB_monitor_off;
dbb->dbb_flags |= DBB_monitor_locking;
LCK_lock(tdbb, dbb->dbb_monitor_lock, LCK_SR, LCK_WAIT); LCK_lock(tdbb, dbb->dbb_monitor_lock, LCK_SR, LCK_WAIT);
dbb->dbb_flags &= ~DBB_monitor_locking;
if (dbb->dbb_ast_flags & DBB_monitor_off) if (dbb->dbb_ast_flags & DBB_monitor_off)
LCK_release(tdbb, dbb->dbb_monitor_lock); LCK_release(tdbb, dbb->dbb_monitor_lock);

View File

@ -389,6 +389,8 @@ const ULONG DBB_gc_background = 0x1000000L; // background garbage collection by
#if (defined DEV_BUILD && !defined MULTI_THREAD) #if (defined DEV_BUILD && !defined MULTI_THREAD)
const ULONG DBB_exec_statement = 0x2000000L; // execute statement runs against database const ULONG DBB_exec_statement = 0x2000000L; // execute statement runs against database
#endif #endif
const ULONG DBB_monitor_locking = 0x4000000L; // monitoring lock is being acquired
// //
// dbb_ast_flags // dbb_ast_flags
// //