Monitoring.cpp (Firebird-3.0.2.32703-0.tar.bz2) | : | Monitoring.cpp (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 147 | skipping to change at line 147 | |||
} | } | |||
fb_assert(shared_memory->getHeader()->mhb_header_version == MemoryHeader: :HEADER_VERSION); | fb_assert(shared_memory->getHeader()->mhb_header_version == MemoryHeader: :HEADER_VERSION); | |||
fb_assert(shared_memory->getHeader()->mhb_version == MONITOR_VERSION); | fb_assert(shared_memory->getHeader()->mhb_version == MONITOR_VERSION); | |||
} | } | |||
MonitoringData::~MonitoringData() | MonitoringData::~MonitoringData() | |||
{ | { | |||
Guard guard(this); | Guard guard(this); | |||
if (shared_memory->getHeader()->used == sizeof(Header)) | if (shared_memory->getHeader()->used == alignOffset(sizeof(Header))) | |||
shared_memory->removeMapFile(); | shared_memory->removeMapFile(); | |||
} | } | |||
void MonitoringData::acquire() | void MonitoringData::acquire() | |||
{ | { | |||
shared_memory->mutexLock(); | shared_memory->mutexLock(); | |||
if (shared_memory->getHeader()->allocated > shared_memory->sh_mem_length_ mapped) | if (shared_memory->getHeader()->allocated > shared_memory->sh_mem_length_ mapped) | |||
{ | { | |||
#ifdef HAVE_OBJECT_MAP | #ifdef HAVE_OBJECT_MAP | |||
skipping to change at line 984 | skipping to change at line 984 | |||
fb_assert(request); | fb_assert(request); | |||
record.reset(rel_mon_statements); | record.reset(rel_mon_statements); | |||
// request id | // request id | |||
record.storeInteger(f_mon_stmt_id, request->req_id); | record.storeInteger(f_mon_stmt_id, request->req_id); | |||
// attachment id | // attachment id | |||
if (request->req_attachment) | if (request->req_attachment) | |||
record.storeInteger(f_mon_stmt_att_id, request->req_attachment->a tt_attachment_id); | record.storeInteger(f_mon_stmt_att_id, request->req_attachment->a tt_attachment_id); | |||
// state, transaction ID, timestamp | // state, transaction ID, timestamp | |||
if (request->req_flags & req_active) | if (request->req_transaction && (request->req_flags & req_active)) | |||
{ | { | |||
const bool is_stalled = (request->req_flags & req_stall); | const bool is_stalled = (request->req_flags & req_stall); | |||
record.storeInteger(f_mon_stmt_state, is_stalled ? mon_state_stal led : mon_state_active); | record.storeInteger(f_mon_stmt_state, is_stalled ? mon_state_stal led : mon_state_active); | |||
if (request->req_transaction) | record.storeInteger(f_mon_stmt_tra_id, request->req_transaction-> | |||
record.storeInteger(f_mon_stmt_tra_id, request->req_trans | tra_number); | |||
action->tra_number); | ||||
record.storeTimestamp(f_mon_stmt_timestamp, request->req_timestam p); | record.storeTimestamp(f_mon_stmt_timestamp, request->req_timestam p); | |||
} | } | |||
else | else | |||
record.storeInteger(f_mon_stmt_state, mon_state_idle); | record.storeInteger(f_mon_stmt_state, mon_state_idle); | |||
const JrdStatement* const statement = request->getStatement(); | const JrdStatement* const statement = request->getStatement(); | |||
// sql text | // sql text | |||
if (statement->sqlText) | if (statement->sqlText) | |||
record.storeString(f_mon_stmt_sql_text, *statement->sqlText); | record.storeString(f_mon_stmt_sql_text, *statement->sqlText); | |||
skipping to change at line 1212 | skipping to change at line 1211 | |||
return; | return; | |||
Database* const dbb = tdbb->getDatabase(); | Database* const dbb = tdbb->getDatabase(); | |||
MemoryPool& pool = *dbb->dbb_permanent; | MemoryPool& pool = *dbb->dbb_permanent; | |||
attachment->mergeStats(); | attachment->mergeStats(); | |||
const AttNumber att_id = attachment->att_attachment_id; | const AttNumber att_id = attachment->att_attachment_id; | |||
const string& user_name = attachment->att_user->usr_user_name; | const string& user_name = attachment->att_user->usr_user_name; | |||
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); | |||
DumpWriter writer(dbb->dbb_monitoring_data, att_id, user_name.c_str()); | DumpWriter writer(dbb->dbb_monitoring_data, att_id, user_name.c_str()); | |||
SnapshotData::DumpRecord record(pool, writer); | SnapshotData::DumpRecord record(pool, writer); | |||
putAttachment(record, attachment); | putAttachment(record, attachment); | |||
jrd_tra* transaction = NULL; | jrd_tra* transaction = NULL; | |||
skipping to change at line 1275 | skipping to change at line 1273 | |||
putRequest(record, request, plan); | putRequest(record, request, plan); | |||
} | } | |||
} | } | |||
} | } | |||
void Monitoring::publishAttachment(thread_db* tdbb) | 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) Monit | ||||
oringData(dbb); | ||||
const string& user_name = attachment->att_user->usr_user_name; | const string& user_name = attachment->att_user->usr_user_name; | |||
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. c_str()); | dbb->dbb_monitoring_data->setup(attachment->att_attachment_id, user_name. c_str()); | |||
} | } | |||
void Monitoring::cleanupAttachment(thread_db* tdbb) | void Monitoring::cleanupAttachment(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) | if (dbb->dbb_monitoring_data) | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 7 lines changed or added |