From: Alexander P. <ale...@us...> - 2009-05-29 14:16:49
|
Build Version : T2.5.0.23994 Firebird 2.5 Beta 1 (writeBuildNum.sh,v 1.24158 2009/05/29 13:34:49 alexpeshkof ) Update of /cvsroot/firebird/firebird2/src/jrd In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23307 Modified Files: Tag: B2_1_Release DatabaseSnapshot.cpp DatabaseSnapshot.h Log Message: Fixed CORE-2482: Monitoring tables data collection is unstable when attaching or detaching database Index: DatabaseSnapshot.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/DatabaseSnapshot.cpp,v retrieving revision 1.44.2.19 retrieving revision 1.44.2.20 diff -b -U3 -r1.44.2.19 -r1.44.2.20 --- DatabaseSnapshot.cpp 28 May 2009 07:57:49 -0000 1.44.2.19 +++ DatabaseSnapshot.cpp 29 May 2009 13:34:48 -0000 1.44.2.20 @@ -397,6 +397,9 @@ tdbb->setRequest(NULL); tdbb->setTransaction(NULL); + ISC_STATUS_ARRAY ast_status; + tdbb->tdbb_status_vector = ast_status; + Jrd::ContextPoolHolder context(tdbb, dbb->dbb_permanent); if (!(dbb->dbb_ast_flags & DBB_monitor_off)) @@ -825,6 +828,11 @@ Database* const dbb = tdbb->getDatabase(); fb_assert(dbb); + if (dbb->dbb_flags & DBB_not_in_use) + { + return; + } + ClumpletWriter writer(ClumpletReader::WideUnTagged, MAX_ULONG); jrd_tra* transaction = NULL; @@ -840,7 +848,8 @@ 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; // Transaction information @@ -983,12 +992,17 @@ } -void DatabaseSnapshot::putAttachment(const Attachment* attachment, +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; @@ -1035,6 +1049,8 @@ // statistics writer.insertBigInt(f_mon_att_stat_id, getGlobalId(stat_id)); putStatistics(&attachment->att_stats, writer, stat_id, stat_attachment); + + return true; } Index: DatabaseSnapshot.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/DatabaseSnapshot.h,v retrieving revision 1.11.2.5 retrieving revision 1.11.2.6 diff -b -U3 -r1.11.2.5 -r1.11.2.6 --- DatabaseSnapshot.h 24 Dec 2008 13:35:23 -0000 1.11.2.5 +++ DatabaseSnapshot.h 29 May 2009 13:34:48 -0000 1.11.2.6 @@ -133,7 +133,7 @@ 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); |