8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 06:03:02 +01:00

Backport #7233: Postfix for #5385 (CORE-5101): Fix slow database restore when Classic server mode is used

This commit is contained in:
Ilya Eremin 2023-07-20 11:55:05 +03:00
parent 81e946209a
commit 8d0bf94d65

View File

@ -233,14 +233,18 @@ void SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay, Sync* guard)
bool exclusive = notify_shutdown(tdbb, flag, delay, guard);
bool successful = exclusive;
// Try to get exclusive database lock periodically up to specified delay. If we
// haven't gotten it report shutdown error for weaker forms. For forced shutdown
// keep notifying until successful.
SSHORT timeout = delay ? delay - 1 : 0;
if (!exclusive)
if (exclusive)
{
// Ensure we have the proper DBB_shutdown_* flags in place
shutdown(tdbb, flag, false);
}
else
{
// Try to get exclusive database lock periodically up to specified delay. If we
// haven't gotten it report shutdown error for weaker forms. For forced shutdown
// keep notifying until successful.
do
{
if (!(dbb->dbb_ast_flags & (DBB_shut_attach | DBB_shut_tran | DBB_shut_force)))