-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Postfix for #5385 (CORE-5101): Fix slow database restore when Classic server mode is used #7233
Conversation
…hen Classic server mode is used CCH_flush has dbb->dbb_ast_flags & DBB_shutdown_single check to avoid PIO_flush call when a database is restoring. But a restore attachment didn't update dbb->dbb_ast_flags while setting a shutdown mode in a database header. This optimization worked fine for Super server mode because it has Garbage Collector and Cache Writer attachments which read the header and update flags in a shared dbb.
This commit surely helps the described situation. I still have some doubts though. // Database is being shutdown. First notification gives shutdown type and delay in seconds.
bool exclusive = notify_shutdown(tdbb, flag, delay, guard);
bool successful = 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.
SSHORT timeout = delay ? delay - 1 : 0;
do
{
if (!(dbb->dbb_ast_flags & (DBB_shut_attach | DBB_shut_tran | DBB_shut_force)))
break;
if ((flag & isc_dpb_shut_transaction) && !TRA_active_transactions(tdbb, dbb))
{
successful = true;
break;
}
if (timeout && CCH_exclusive(tdbb, LCK_PW, -1, guard))
{
exclusive = true;
break;
}
}
while (timeout--);
}
|
A workaround could also be to add |
I agree, this approach is better. I've tested it and it works fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections, you may merge this PR.
…ore when Classic server mode is used
…ore when Classic server mode is used
CCH_flush has dbb->dbb_ast_flags & DBB_shutdown_single check to avoid PIO_flush call when a database is restoring. But a restore attachment didn't update dbb->dbb_ast_flags while setting a shutdown mode in a database header. This optimization worked fine for Super server mode because it has Garbage Collector and Cache Writer attachments which read the header and update flags in a shared dbb.