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

Improvement CORE-3598 : TRACE: add statistics of actions that were after transaction finished

This commit is contained in:
hvlad 2012-05-12 09:48:32 +00:00
parent 854231942a
commit 02adff3b63
3 changed files with 14 additions and 9 deletions

View File

@ -6232,8 +6232,9 @@ void JTransaction::freeEngineData(Firebird::IStatus* user_status)
tdbb->getDatabase()->dbb_ast_flags & DBB_shutdown ||
tdbb->getAttachment()->att_flags & ATT_shutdown)
{
TraceTransactionEnd trace(transaction, false, false);
EDS::Transaction::jrdTransactionEnd(tdbb, transaction, false, false, false);
TRA_release_transaction(tdbb, transaction);
TRA_release_transaction(tdbb, transaction, &trace);
}
else
TRA_rollback(tdbb, transaction, false, false);
@ -6286,8 +6287,9 @@ static unsigned int purge_transactions(thread_db* tdbb,
if ((transaction->tra_flags & TRA_prepared) || (dbb->dbb_ast_flags & DBB_shutdown) ||
(att_flags & ATT_shutdown))
{
TraceTransactionEnd trace(transaction, false, false); // need ability to indicate prepared (in limbo) transaction
EDS::Transaction::jrdTransactionEnd(tdbb, transaction, false, false, true);
TRA_release_transaction(tdbb, transaction);
TRA_release_transaction(tdbb, transaction, &trace);
}
else if (force_flag)
TRA_rollback(tdbb, transaction, false, true);
@ -6307,7 +6309,8 @@ static unsigned int purge_transactions(thread_db* tdbb,
attachment->att_dbkey_trans = NULL;
if ((dbb->dbb_ast_flags & DBB_shutdown) || (att_flags & ATT_shutdown))
{
TRA_release_transaction(tdbb, trans_dbk);
TraceTransactionEnd trace(trans_dbk, false, false);
TRA_release_transaction(tdbb, trans_dbk, &trace);
}
else
{

View File

@ -410,8 +410,7 @@ void TRA_commit(thread_db* tdbb, jrd_tra* transaction, const bool retaining_flag
LCK_convert(tdbb, lock, LCK_write, LCK_WAIT);
--transaction->tra_use_count;
trace.finish(res_successful);
TRA_release_transaction(tdbb, transaction);
TRA_release_transaction(tdbb, transaction, &trace);
}
@ -1012,7 +1011,7 @@ jrd_tra* TRA_reconnect(thread_db* tdbb, const UCHAR* id, USHORT length)
}
void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction)
void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction, Jrd::TraceTransactionEnd* trace)
{
/**************************************
*
@ -1130,6 +1129,9 @@ void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction)
if (transaction->tra_flags & TRA_precommitted)
TRA_precommited(tdbb, transaction->tra_number, 0);
if (trace)
trace->finish(res_successful);
// Unlink the transaction from the database block
for (jrd_tra** ptr = &attachment->att_transactions; *ptr; ptr = &(*ptr)->tra_next)
@ -1314,8 +1316,7 @@ void TRA_rollback(thread_db* tdbb, jrd_tra* transaction, const bool retaining_fl
TRA_set_state(tdbb, transaction, transaction->tra_number, state);
trace.finish(res_successful);
TRA_release_transaction(tdbb, transaction);
TRA_release_transaction(tdbb, transaction, &trace);
}

View File

@ -29,6 +29,7 @@
namespace Jrd {
class Attachment;
class Database;
class TraceTransactionEnd;
}
bool TRA_active_transactions(Jrd::thread_db*, Jrd::Database*);
@ -50,7 +51,7 @@ void TRA_post_resources(Jrd::thread_db*, Jrd::jrd_tra*, Jrd::ResourceList&);
bool TRA_precommited(Jrd::thread_db*, SLONG, SLONG);
void TRA_prepare(Jrd::thread_db*, Jrd::jrd_tra*, USHORT, const UCHAR*);
Jrd::jrd_tra* TRA_reconnect(Jrd::thread_db*, const UCHAR*, USHORT);
void TRA_release_transaction(Jrd::thread_db*, Jrd::jrd_tra*);
void TRA_release_transaction(Jrd::thread_db*, Jrd::jrd_tra*, Jrd::TraceTransactionEnd*);
void TRA_rollback(Jrd::thread_db*, Jrd::jrd_tra*, const bool, const bool);
void TRA_set_state(Jrd::thread_db*, Jrd::jrd_tra*, SLONG, SSHORT);
int TRA_snapshot_state(Jrd::thread_db*, const Jrd::jrd_tra*, SLONG);