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

Fixed bug CORE-5872 : Database validation reports false errors "Record XXX has bad transaction" and\or "Record XXX is wrong length" when record transaction number is greater than 2^32

This commit is contained in:
hvlad 2018-07-10 22:42:22 +03:00
parent ea010ed13a
commit 2d2bb746f9

View File

@ -824,7 +824,7 @@ const Validation::MSG_ENTRY Validation::vdr_msg_table[VAL_MAX_ERROR] =
{true, isc_info_ppage_errors, "Pointer page {sequence %" ULONGFORMAT"} lost"},
{true, isc_info_ppage_errors, "Pointer page %" ULONGFORMAT" {sequence %" ULONGFORMAT"} inconsistent"},
{true, isc_info_record_errors, "Record %" SQUADFORMAT" is marked as damaged"},
{true, isc_info_record_errors, "Record %" SQUADFORMAT" has bad transaction %" ULONGFORMAT}, // 15
{true, isc_info_record_errors, "Record %" SQUADFORMAT" has bad transaction %" SQUADFORMAT}, // 15
{true, isc_info_record_errors, "Fragmented record %" SQUADFORMAT" is corrupt"},
{true, isc_info_record_errors, "Record %" SQUADFORMAT" is wrong length"},
{true, isc_info_ipage_errors, "Missing index root page"},
@ -1618,7 +1618,7 @@ void Validation::walk_database()
WIN window(DB_PAGE_SPACE, -1);
header_page* page = 0;
fetch_page(true, HEADER_PAGE, pag_header, &window, &page);
vdr_max_transaction = page->hdr_next_transaction;
TraNumber next = vdr_max_transaction = Ods::getNT(page);
if (vdr_flags & VDR_online) {
release_page(&window);
@ -1629,7 +1629,7 @@ void Validation::walk_database()
walk_header(page->hdr_next_page);
walk_pip();
walk_scns();
walk_tip(page->hdr_next_transaction);
walk_tip(next);
walk_generators();
}
@ -2716,6 +2716,11 @@ Validation::RTN Validation::walk_record(jrd_rel* relation, const rhd* header, US
p = (SCHAR*) fragment->rhdf_data;
end = p + length - offsetof(rhdf, rhdf_data[0]);
}
else if (header->rhd_flags & rhd_long_tranum)
{
p = (SCHAR*) ((rhde*)header)->rhde_data;
end = p + length - offsetof(rhde, rhde_data[0]);
}
else
{
p = (SCHAR*) header->rhd_data;
@ -2773,6 +2778,11 @@ Validation::RTN Validation::walk_record(jrd_rel* relation, const rhd* header, US
p = (SCHAR*) fragment->rhdf_data;
end = p + line->dpg_length - offsetof(rhdf, rhdf_data[0]);
}
else if (fragment->rhdf_flags & rhd_long_tranum)
{
p = (SCHAR*) ((rhde*)fragment)->rhde_data;
end = p + line->dpg_length - offsetof(rhde, rhde_data[0]);
}
else
{
p = (SCHAR*) ((rhd*) fragment)->rhd_data;
@ -3013,7 +3023,7 @@ Validation::RTN Validation::walk_relation(jrd_rel* relation)
WIN window(DB_PAGE_SPACE, -1);
header_page* page = NULL;
fetch_page(false, (SLONG) HEADER_PAGE, pag_header, &window, &page);
vdr_max_transaction = page->hdr_next_transaction;
vdr_max_transaction = Ods::getNT(page);
release_page(&window);
}