mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 01:23:03 +01:00
Fixed CORE-2482: Monitoring tables data collection is unstable when attaching or detaching database
This commit is contained in:
parent
5fc195efa8
commit
3c236c1976
@ -397,6 +397,9 @@ int DatabaseSnapshot::blockingAst(void* ast_object)
|
|||||||
tdbb->setRequest(NULL);
|
tdbb->setRequest(NULL);
|
||||||
tdbb->setTransaction(NULL);
|
tdbb->setTransaction(NULL);
|
||||||
|
|
||||||
|
ISC_STATUS_ARRAY ast_status;
|
||||||
|
tdbb->tdbb_status_vector = ast_status;
|
||||||
|
|
||||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_permanent);
|
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_permanent);
|
||||||
|
|
||||||
if (!(dbb->dbb_ast_flags & DBB_monitor_off))
|
if (!(dbb->dbb_ast_flags & DBB_monitor_off))
|
||||||
@ -825,6 +828,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);
|
||||||
|
|
||||||
jrd_tra* transaction = NULL;
|
jrd_tra* transaction = NULL;
|
||||||
@ -840,7 +848,8 @@ void DatabaseSnapshot::dumpData(thread_db* tdbb)
|
|||||||
for (Attachment* attachment = dbb->dbb_attachments;
|
for (Attachment* attachment = dbb->dbb_attachments;
|
||||||
attachment; attachment = attachment->att_next)
|
attachment; attachment = attachment->att_next)
|
||||||
{
|
{
|
||||||
putAttachment(attachment, writer, fb_utils::genUniqueId());
|
if (!putAttachment(attachment, writer, fb_utils::genUniqueId()))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Transaction information
|
// Transaction information
|
||||||
|
|
||||||
@ -983,12 +992,17 @@ void DatabaseSnapshot::putDatabase(const Database* database,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DatabaseSnapshot::putAttachment(const Attachment* attachment,
|
bool DatabaseSnapshot::putAttachment(const Attachment* attachment,
|
||||||
ClumpletWriter& writer,
|
ClumpletWriter& writer,
|
||||||
int stat_id)
|
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;
|
||||||
@ -1035,6 +1049,8 @@ void DatabaseSnapshot::putAttachment(const Attachment* attachment,
|
|||||||
// statistics
|
// statistics
|
||||||
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);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,7 +133,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