8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:43:02 +01:00

Fix refetch header data from delta when database in backup lock (#8268)

Co-authored-by: Andrey Kravchenko <andrey.kravchenko@red-soft.ru>
This commit is contained in:
Andrey Kravchenko 2024-09-30 08:07:12 +03:00 committed by GitHub
parent e4efbdb1fa
commit 36b035c329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1055,7 +1055,8 @@ void PAG_header(thread_db* tdbb, bool info, const TriState newForceWrite)
fb_assert(attachment); fb_assert(attachment);
WIN window(HEADER_PAGE_NUMBER); WIN window(HEADER_PAGE_NUMBER);
header_page* header = (header_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_header); pag* page = CCH_FETCH(tdbb, &window, LCK_read, pag_header);
header_page* header = (header_page*) page;
try { try {
@ -1165,6 +1166,30 @@ void PAG_header(thread_db* tdbb, bool info, const TriState newForceWrite)
fb_assert(false); fb_assert(false);
} }
// If database in backup lock state...
if (!info && dbb->dbb_backup_manager->getState() != Ods::hdr_nbak_normal)
{
// refetch some data from the header, because it could be changed in the delta file
// (as initially PAG_init2 reads the header from the main file and these values
// may be outdated there)
for (const UCHAR* p = header->hdr_data; *p != HDR_end; p += 2u + p[1])
{
switch (*p)
{
case HDR_sweep_interval:
fb_assert(p[1] == sizeof(SLONG));
memcpy(&dbb->dbb_sweep_interval, p + 2, sizeof(SLONG));
break;
case HDR_repl_seq:
fb_assert(p[1] == sizeof(FB_UINT64));
memcpy(&dbb->dbb_repl_sequence, p + 2, sizeof(FB_UINT64));
break;
}
}
}
} // try } // try
catch (const Exception&) catch (const Exception&)
{ {