From 0eab23976aa0a48b9e46cce482c92098d6e0b3f2 Mon Sep 17 00:00:00 2001 From: dimitr Date: Tue, 8 May 2007 08:24:59 +0000 Subject: [PATCH] Fixed CORE-1249 plus minor corrections for the single-user shutdown mode. The change in CCH allows to report isc_shutdown instead of the LM error code in Classic (GFIX depends on this behaviour). --- src/jrd/cch.cpp | 4 ++++ src/jrd/shut.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index 7e181d2a91..af82fd7984 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -440,6 +440,10 @@ bool CCH_exclusive(thread_db* tdbb, USHORT level, SSHORT wait_flag) break; } + // Clear the status vector, as our callers check the return value + // and throw custom exceptions themselves + tdbb->tdbb_status_vector[0] = 0; + /* If we are supposed to wait (presumably patiently), but can't get the lock, generate an error */ diff --git a/src/jrd/shut.cpp b/src/jrd/shut.cpp index 4f727a578f..650ea76397 100644 --- a/src/jrd/shut.cpp +++ b/src/jrd/shut.cpp @@ -247,10 +247,12 @@ bool SHUT_database(Database* dbb, SSHORT flag, SSHORT delay) dbb->dbb_ast_flags |= DBB_shutdown; dbb->dbb_ast_flags &= ~(DBB_shutdown_single | DBB_shutdown_full); - if (flag & isc_dpb_shut_single) + switch (flag & isc_dpb_shut_mode_mask) { + case isc_dpb_shut_single: dbb->dbb_ast_flags |= DBB_shutdown_single; - else if (flag & isc_dpb_shut_full) + case isc_dpb_shut_full: dbb->dbb_ast_flags |= DBB_shutdown_full; + } if (!exclusive && (flag & isc_dpb_shut_force)) { // TMN: Ugly counting! @@ -482,7 +484,7 @@ static bool notify_shutdown(Database* dbb, SSHORT flag, SSHORT delay) /* Send blocking ASTs to database users */ bool exclusive = - CCH_exclusive(tdbb, LCK_PW, delay > 0 ? -SHUT_WAIT_TIME : LCK_NO_WAIT); + CCH_exclusive(tdbb, LCK_PW, delay > 0 ? -SHUT_WAIT_TIME : -1); if (exclusive && (delay != -1)) { return shutdown_locks(dbb, flag); @@ -532,7 +534,7 @@ static bool shutdown_locks(Database* dbb, SSHORT flag) } Attachment* attachment; - + for (attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next) {