mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-27 18:03: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:
parent
d862700a6b
commit
5a4eab402e
@ -815,6 +815,11 @@ void DatabaseSnapshot::dumpData(thread_db* tdbb)
|
|||||||
Database* const dbb = tdbb->getDatabase();
|
Database* const dbb = tdbb->getDatabase();
|
||||||
fb_assert(dbb);
|
fb_assert(dbb);
|
||||||
|
|
||||||
|
if (dbb->dbb_flags & DBB_not_in_use)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ClumpletWriter writer(ClumpletReader::WideUnTagged, MAX_ULONG);
|
ClumpletWriter writer(ClumpletReader::WideUnTagged, MAX_ULONG);
|
||||||
|
|
||||||
// Database information
|
// Database information
|
||||||
@ -825,7 +830,9 @@ void DatabaseSnapshot::dumpData(thread_db* tdbb)
|
|||||||
|
|
||||||
for (Attachment* attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next)
|
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);
|
putContextVars(attachment->att_context_vars, writer, attachment->att_attachment_id, true);
|
||||||
|
|
||||||
jrd_tra* transaction = NULL;
|
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);
|
fb_assert(attachment);
|
||||||
|
|
||||||
|
if (!attachment->att_user)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
writer.insertByte(TAG_RECORD, rel_mon_attachments);
|
writer.insertByte(TAG_RECORD, rel_mon_attachments);
|
||||||
|
|
||||||
int temp = mon_state_idle;
|
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));
|
writer.insertBigInt(f_mon_att_stat_id, getGlobalId(stat_id));
|
||||||
putStatistics(attachment->att_stats, writer, stat_id, stat_attachment);
|
putStatistics(attachment->att_stats, writer, stat_id, stat_attachment);
|
||||||
putMemoryUsage(attachment->att_memory_stats, writer, stat_id, stat_attachment);
|
putMemoryUsage(attachment->att_memory_stats, writer, stat_id, stat_attachment);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ private:
|
|||||||
static SINT64 getGlobalId(int);
|
static SINT64 getGlobalId(int);
|
||||||
|
|
||||||
static void putDatabase(const Database*, Firebird::ClumpletWriter&, 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 putTransaction(const jrd_tra*, Firebird::ClumpletWriter&, int);
|
||||||
static void putRequest(const jrd_req*, Firebird::ClumpletWriter&, int);
|
static void putRequest(const jrd_req*, Firebird::ClumpletWriter&, int);
|
||||||
static void putCall(const jrd_req*, Firebird::ClumpletWriter&, int);
|
static void putCall(const jrd_req*, Firebird::ClumpletWriter&, int);
|
||||||
|
Loading…
Reference in New Issue
Block a user