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. |
dyemanov
left a comment
There was a problem hiding this comment.
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.