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

More complete solution for early monitoring initialization

This commit is contained in:
Dmitry Yemanov 2018-04-13 10:18:00 +03:00
parent d1e90e035e
commit 0d8cde9252
2 changed files with 8 additions and 5 deletions

View File

@ -1134,6 +1134,7 @@ void Monitoring::putCall(SnapshotData::DumpRecord& record, const jrd_req* reques
putMemoryUsage(record, request->req_memory_stats, stat_id, stat_call); putMemoryUsage(record, request->req_memory_stats, stat_id, stat_call);
} }
void Monitoring::putStatistics(SnapshotData::DumpRecord& record, const RuntimeStatistics& statistics, void Monitoring::putStatistics(SnapshotData::DumpRecord& record, const RuntimeStatistics& statistics,
int stat_id, int stat_group) int stat_id, int stat_group)
{ {
@ -1204,6 +1205,7 @@ void Monitoring::putStatistics(SnapshotData::DumpRecord& record, const RuntimeSt
} }
} }
void Monitoring::putContextVars(SnapshotData::DumpRecord& record, const StringMap& variables, void Monitoring::putContextVars(SnapshotData::DumpRecord& record, const StringMap& variables,
SINT64 object_id, bool is_attachment) SINT64 object_id, bool is_attachment)
{ {
@ -1223,6 +1225,7 @@ void Monitoring::putContextVars(SnapshotData::DumpRecord& record, const StringMa
} }
} }
void Monitoring::putMemoryUsage(SnapshotData::DumpRecord& record, const MemoryStats& stats, void Monitoring::putMemoryUsage(SnapshotData::DumpRecord& record, const MemoryStats& stats,
int stat_id, int stat_group) int stat_id, int stat_group)
{ {
@ -1270,8 +1273,7 @@ void Monitoring::dumpAttachment(thread_db* tdbb, Attachment* attachment)
const AttNumber att_id = attachment->att_attachment_id; const AttNumber att_id = attachment->att_attachment_id;
const MetaName& user_name = attachment->att_user->getUserName(); const MetaName& user_name = attachment->att_user->getUserName();
if (!dbb->dbb_monitoring_data) fb_assert(dbb->dbb_monitoring_data);
dbb->dbb_monitoring_data = FB_NEW_POOL(pool) MonitoringData(dbb);
MonitoringData::Guard guard(dbb->dbb_monitoring_data); MonitoringData::Guard guard(dbb->dbb_monitoring_data);
dbb->dbb_monitoring_data->cleanup(att_id); dbb->dbb_monitoring_data->cleanup(att_id);
@ -1334,15 +1336,15 @@ void Monitoring::publishAttachment(thread_db* tdbb)
Database* const dbb = tdbb->getDatabase(); Database* const dbb = tdbb->getDatabase();
Attachment* const attachment = tdbb->getAttachment(); Attachment* const attachment = tdbb->getAttachment();
if (!dbb->dbb_monitoring_data)
dbb->dbb_monitoring_data = FB_NEW_POOL(*dbb->dbb_permanent) MonitoringData(dbb);
const char* user_name = attachment->att_user ? attachment->att_user->getUserName().c_str() : ""; const char* user_name = attachment->att_user ? attachment->att_user->getUserName().c_str() : "";
fb_assert(dbb->dbb_monitoring_data);
MonitoringData::Guard guard(dbb->dbb_monitoring_data); MonitoringData::Guard guard(dbb->dbb_monitoring_data);
dbb->dbb_monitoring_data->setup(attachment->att_attachment_id, user_name); dbb->dbb_monitoring_data->setup(attachment->att_attachment_id, user_name);
} }
void Monitoring::cleanupAttachment(thread_db* tdbb) void Monitoring::cleanupAttachment(thread_db* tdbb)
{ {
Database* const dbb = tdbb->getDatabase(); Database* const dbb = tdbb->getDatabase();

View File

@ -2755,6 +2755,7 @@ JAttachment* JProvider::createDatabase(CheckStatusWrapper* user_status, const ch
dbb, Ods::hdr_nbak_normal); dbb, Ods::hdr_nbak_normal);
dbb->dbb_backup_manager->dbCreating = true; dbb->dbb_backup_manager->dbCreating = true;
dbb->dbb_crypto_manager = FB_NEW_POOL(*dbb->dbb_permanent) CryptoManager(tdbb); dbb->dbb_crypto_manager = FB_NEW_POOL(*dbb->dbb_permanent) CryptoManager(tdbb);
dbb->dbb_monitoring_data = FB_NEW_POOL(*dbb->dbb_permanent) MonitoringData(dbb);
PAG_format_header(tdbb); PAG_format_header(tdbb);
INI_init2(tdbb); INI_init2(tdbb);