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

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

This commit is contained in:
hvlad 2012-05-03 11:11:44 +00:00
parent ec32e5d006
commit a2e489ed28
3 changed files with 12 additions and 8 deletions

View File

@ -6057,8 +6057,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);
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);
@ -6078,7 +6079,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

@ -490,8 +490,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);
}
@ -1086,7 +1085,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, TraceTransactionEnd* trace)
{
/**************************************
*
@ -1202,6 +1201,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)
@ -1391,8 +1393,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);
void TRA_shutdown_attachment(Jrd::thread_db*, Jrd::Attachment*);