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

Front-ported fix for CORE-2482: Monitoring tables data collection is unstable when attaching or detaching database

This commit is contained in:
alexpeshkoff 2009-05-29 14:10:18 +00:00
parent d862700a6b
commit 5a4eab402e
2 changed files with 17 additions and 3 deletions

View File

@ -815,6 +815,11 @@ void DatabaseSnapshot::dumpData(thread_db* tdbb)
Database* const dbb = tdbb->getDatabase();
fb_assert(dbb);
if (dbb->dbb_flags & DBB_not_in_use)
{
return;
}
ClumpletWriter writer(ClumpletReader::WideUnTagged, MAX_ULONG);
// Database information
@ -825,7 +830,9 @@ void DatabaseSnapshot::dumpData(thread_db* tdbb)
for (Attachment* attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next)
{
putAttachment(attachment, writer, fb_utils::genUniqueId());
if (!putAttachment(attachment, writer, fb_utils::genUniqueId()))
continue;
putContextVars(attachment->att_context_vars, writer, attachment->att_attachment_id, true);
jrd_tra* transaction = NULL;
@ -974,10 +981,15 @@ void DatabaseSnapshot::putDatabase(const Database* database, ClumpletWriter& wri
}
void DatabaseSnapshot::putAttachment(const Attachment* attachment, ClumpletWriter& writer, int stat_id)
bool DatabaseSnapshot::putAttachment(const Attachment* attachment, ClumpletWriter& writer, int stat_id)
{
fb_assert(attachment);
if (!attachment->att_user)
{
return false;
}
writer.insertByte(TAG_RECORD, rel_mon_attachments);
int temp = mon_state_idle;
@ -1023,6 +1035,8 @@ void DatabaseSnapshot::putAttachment(const Attachment* attachment, ClumpletWrite
writer.insertBigInt(f_mon_att_stat_id, getGlobalId(stat_id));
putStatistics(attachment->att_stats, writer, stat_id, stat_attachment);
putMemoryUsage(attachment->att_memory_stats, writer, stat_id, stat_attachment);
return true;
}

View File

@ -139,7 +139,7 @@ private:
static SINT64 getGlobalId(int);
static void putDatabase(const Database*, Firebird::ClumpletWriter&, int);
static void putAttachment(const Attachment*, Firebird::ClumpletWriter&, int);
static bool putAttachment(const Attachment*, Firebird::ClumpletWriter&, int);
static void putTransaction(const jrd_tra*, Firebird::ClumpletWriter&, int);
static void putRequest(const jrd_req*, Firebird::ClumpletWriter&, int);
static void putCall(const jrd_req*, Firebird::ClumpletWriter&, int);