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

Fixed CORE-2846: Cannot connect to the database if GFIX -shut <mode> -attach <timeout> fails after the specified timeout (because of connections being still active).

Backport into v2.5.
This commit is contained in:
dimitr 2010-02-10 15:23:39 +00:00
parent 0ba7ae6f1c
commit 223f875162

View File

@ -87,29 +87,35 @@ bool SHUT_blocking_ast(thread_db* tdbb)
const SSHORT flag = data.data_items.flag; const SSHORT flag = data.data_items.flag;
const SSHORT delay = data.data_items.delay; const SSHORT delay = data.data_items.delay;
const int shut_mode = flag & isc_dpb_shut_mode_mask;
/* Database shutdown has been cancelled. */ /* Database shutdown has been cancelled. */
// Delay of -1 means we're going online // Delay of -1 means we're going online
if (delay == -1) if (delay == -1)
{ {
dbb->dbb_ast_flags &= dbb->dbb_ast_flags &= ~(DBB_shut_attach | DBB_shut_tran | DBB_shut_force);
~(DBB_shut_attach | DBB_shut_tran | DBB_shut_force |
DBB_shutdown | DBB_shutdown_single | DBB_shutdown_full); if (shut_mode)
switch (flag & isc_dpb_shut_mode_mask)
{ {
case isc_dpb_shut_normal: dbb->dbb_ast_flags &= ~(DBB_shutdown | DBB_shutdown_single | DBB_shutdown_full);
break;
case isc_dpb_shut_multi: switch (shut_mode)
dbb->dbb_ast_flags |= DBB_shutdown; {
break; case isc_dpb_shut_normal:
case isc_dpb_shut_single: break;
dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_single; case isc_dpb_shut_multi:
break; dbb->dbb_ast_flags |= DBB_shutdown;
case isc_dpb_shut_full: break;
dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_full; case isc_dpb_shut_single:
break; dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_single;
default: break;
fb_assert(false); case isc_dpb_shut_full:
dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_full;
break;
default:
fb_assert(false);
}
} }
return false; return false;
@ -241,7 +247,7 @@ void SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay)
if (!exclusive && (timeout > 0 || flag & (isc_dpb_shut_attachment | isc_dpb_shut_transaction))) if (!exclusive && (timeout > 0 || flag & (isc_dpb_shut_attachment | isc_dpb_shut_transaction)))
{ {
notify_shutdown(tdbb, 0, 0); /* Tell everyone we're giving up */ notify_shutdown(tdbb, 0, -1); /* Tell everyone we're giving up */
SHUT_blocking_ast(tdbb); SHUT_blocking_ast(tdbb);
attachment->att_flags &= ~ATT_shutdown_manager; attachment->att_flags &= ~ATT_shutdown_manager;
++dbb->dbb_use_count; ++dbb->dbb_use_count;