Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/jrd/shut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down