From 16aa364f4081ada920328ef5a71e51640768d696 Mon Sep 17 00:00:00 2001 From: Ilya Eremin Date: Wed, 16 Mar 2022 10:44:12 +0300 Subject: [PATCH] Execute ON DISCONNECT triggers in the following cases: 1. During database shutdown (gfix -shut full -force 0). 2. An attachment is deleted from MON$ATTACHMENTS by another attachment. 3. An attachment is closed by idle timeout. ON DISCONNECT triggers will still not be executed during server shutdown. --- src/jrd/jrd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 27b5999976..bb7b847d10 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -3314,15 +3314,15 @@ void JAttachment::freeEngineData(CheckStatusWrapper* user_status, bool forceFree unsigned flags = PURGE_LINGER; - if (engineShutdown || + if (engineShutdown) + flags |= PURGE_FORCE; + + if (forceFree || (dbb->dbb_ast_flags & DBB_shutdown) || (attachment->att_flags & ATT_shutdown)) { - flags |= PURGE_FORCE; - } - - if (forceFree) flags |= PURGE_NOCHECK; + } ISC_STATUS reason = 0; if (!forceFree) @@ -8605,7 +8605,7 @@ namespace { // purge attachment, rollback any open transactions attachment->att_use_count++; - purge_attachment(tdbb, sAtt, PURGE_FORCE); + purge_attachment(tdbb, sAtt, engineShutdown ? PURGE_FORCE : PURGE_NOCHECK); } catch (const Exception& ex) {