8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 10:03:03 +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 delay = data.data_items.delay;
const int shut_mode = flag & isc_dpb_shut_mode_mask;
/* Database shutdown has been cancelled. */
// Delay of -1 means we're going online
if (delay == -1)
{
dbb->dbb_ast_flags &=
~(DBB_shut_attach | DBB_shut_tran | DBB_shut_force |
DBB_shutdown | DBB_shutdown_single | DBB_shutdown_full);
switch (flag & isc_dpb_shut_mode_mask)
dbb->dbb_ast_flags &= ~(DBB_shut_attach | DBB_shut_tran | DBB_shut_force);
if (shut_mode)
{
case isc_dpb_shut_normal:
break;
case isc_dpb_shut_multi:
dbb->dbb_ast_flags |= DBB_shutdown;
break;
case isc_dpb_shut_single:
dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_single;
break;
case isc_dpb_shut_full:
dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_full;
break;
default:
fb_assert(false);
dbb->dbb_ast_flags &= ~(DBB_shutdown | DBB_shutdown_single | DBB_shutdown_full);
switch (shut_mode)
{
case isc_dpb_shut_normal:
break;
case isc_dpb_shut_multi:
dbb->dbb_ast_flags |= DBB_shutdown;
break;
case isc_dpb_shut_single:
dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_single;
break;
case isc_dpb_shut_full:
dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_full;
break;
default:
fb_assert(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)))
{
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);
attachment->att_flags &= ~ATT_shutdown_manager;
++dbb->dbb_use_count;