8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 08:40:39 +01:00

Allow threads which are running purge_attachment() to start new transactions during DB shutdown because it's needed for ON DISCONNECT triggers

Autonomous transactions which are used inside ON DISCONNECT triggers are allowed as well.
This commit is contained in:
Ilya Eremin 2022-03-22 15:30:35 +03:00 committed by Alexander Peshkov
parent 1eedc88a15
commit 8bd4a7abca

View File

@ -1689,7 +1689,11 @@ jrd_tra* TRA_start(thread_db* tdbb, ULONG flags, SSHORT lock_timeout, Jrd::jrd_t
Database* const dbb = tdbb->getDatabase();
Jrd::Attachment* const attachment = tdbb->getAttachment();
if (dbb->dbb_ast_flags & DBB_shut_tran)
// Starting new transactions should be allowed for threads which
// are running purge_attachment() because it's needed for
// ON DISCONNECT triggers
if (dbb->dbb_ast_flags & DBB_shut_tran &&
attachment->att_purge_tid != Thread::getId())
{
ERR_post(Arg::Gds(isc_shutinprog) << Arg::Str(attachment->att_filename));
}
@ -1742,7 +1746,11 @@ jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const UCHAR* tpb, Jrd::jrd_t
Database* dbb = tdbb->getDatabase();
Jrd::Attachment* attachment = tdbb->getAttachment();
if (dbb->dbb_ast_flags & DBB_shut_tran)
// Starting new transactions should be allowed for threads which
// are running purge_attachment() because it's needed for
// ON DISCONNECT triggers
if (dbb->dbb_ast_flags & DBB_shut_tran &&
attachment->att_purge_tid != Thread::getId())
{
ERR_post(Arg::Gds(isc_shutinprog) << Arg::Str(attachment->att_filename));
}