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

Fixed inconsistency between attachment/transaction states and their request states

This commit is contained in:
Dmitry Yemanov 2019-12-11 13:00:02 +03:00
parent f62c4f5e5f
commit d0353a8972

View File

@ -915,14 +915,17 @@ void Monitoring::putAttachment(SnapshotData::DumpRecord& record, const Jrd::Atta
record.reset(rel_mon_attachments);
int temp = mon_state_idle;
for (const jrd_tra* transaction_itr = attachment->att_transactions;
transaction_itr; transaction_itr = transaction_itr->tra_next)
for (const jrd_tra* transaction = attachment->att_transactions;
transaction; transaction = transaction->tra_next)
{
if (transaction_itr->tra_requests)
for (const jrd_req* request = transaction->tra_requests;
request; request = request->req_tra_next)
{
temp = mon_state_active;
break;
if (request->req_transaction && (request->req_flags & req_active))
{
temp = mon_state_active;
break;
}
}
}
@ -999,14 +1002,22 @@ void Monitoring::putTransaction(SnapshotData::DumpRecord& record, const jrd_tra*
record.reset(rel_mon_transactions);
int temp;
int temp = mon_state_idle;
for (const jrd_req* request = transaction->tra_requests;
request; request = request->req_tra_next)
{
if (request->req_transaction && (request->req_flags & req_active))
{
temp = mon_state_active;
break;
}
}
// transaction id
record.storeInteger(f_mon_tra_id, transaction->tra_number);
// attachment id
record.storeInteger(f_mon_tra_att_id, transaction->tra_attachment->att_attachment_id);
// state
temp = transaction->tra_requests ? mon_state_active : mon_state_idle;
record.storeInteger(f_mon_tra_state, temp);
// timestamp
record.storeTimestamp(f_mon_tra_timestamp, transaction->tra_timestamp);