mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 06:03:02 +01:00
Make validation detect and fix data page error when DP marked as secondary contains primary record version(s).
See CORE-5459. So far i can't reproduce the corruption thus ticket is not resolved.
This commit is contained in:
parent
94818ef4f0
commit
ddd5d0437d
@ -847,7 +847,8 @@ const Validation::MSG_ENTRY Validation::vdr_msg_table[VAL_MAX_ERROR] =
|
||||
{true, fb_info_pip_errors, "Data page %" ULONGFORMAT" marked as free in PIP (%" ULONGFORMAT":%" ULONGFORMAT")"},
|
||||
{true, isc_info_ppage_errors, "Data page %" ULONGFORMAT" is not in PP (%" ULONGFORMAT"). Slot (%d) is not found"},
|
||||
{true, isc_info_ppage_errors, "Data page %" ULONGFORMAT" is not in PP (%" ULONGFORMAT"). Slot (%d) has value %" ULONGFORMAT},
|
||||
{true, isc_info_ppage_errors, "Pointer page is not found for data page %" ULONGFORMAT". dpg_sequence (%" ULONGFORMAT") is invalid"}
|
||||
{true, isc_info_ppage_errors, "Pointer page is not found for data page %" ULONGFORMAT". dpg_sequence (%" ULONGFORMAT") is invalid"},
|
||||
{true, isc_info_dpage_errors, "Data page %" ULONGFORMAT" {sequence %" ULONGFORMAT"} marked as secondary but contains primary record versions"}
|
||||
};
|
||||
|
||||
Validation::Validation(thread_db* tdbb, UtilSvc* uSvc) :
|
||||
@ -1751,6 +1752,8 @@ Validation::RTN Validation::walk_data_page(jrd_rel* relation, ULONG page_number,
|
||||
const UCHAR* const end_page = (UCHAR*) page + dbb->dbb_page_size;
|
||||
const data_page::dpg_repeat* const end = page->dpg_rpt + page->dpg_count;
|
||||
RecordNumber number((SINT64)sequence * dbb->dbb_max_records);
|
||||
int primary_versions = 0;
|
||||
bool marked = false;
|
||||
|
||||
for (const data_page::dpg_repeat* line = page->dpg_rpt; line < end; line++, number.increment())
|
||||
{
|
||||
@ -1798,6 +1801,8 @@ Validation::RTN Validation::walk_data_page(jrd_rel* relation, ULONG page_number,
|
||||
if (state == tra_committed || state == tra_limbo)
|
||||
RBM_SET(vdr_tdbb->getDefaultPool(), &vdr_rel_records, number.getValue());
|
||||
}
|
||||
|
||||
primary_versions++;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_VAL_VERBOSE
|
||||
@ -1819,8 +1824,12 @@ Validation::RTN Validation::walk_data_page(jrd_rel* relation, ULONG page_number,
|
||||
walk_record(relation, header, line->dpg_length, number, false);
|
||||
|
||||
if ((result == rtn_corrupt) && (vdr_flags & VDR_repair))
|
||||
{
|
||||
if (!marked)
|
||||
{
|
||||
CCH_MARK(vdr_tdbb, &window);
|
||||
marked = true;
|
||||
}
|
||||
header->rhd_flags |= rhd_damaged;
|
||||
vdr_fixed++;
|
||||
}
|
||||
@ -1832,6 +1841,22 @@ Validation::RTN Validation::walk_data_page(jrd_rel* relation, ULONG page_number,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (primary_versions && (dp_flags & dpg_secondary))
|
||||
{
|
||||
corrupt(VAL_DATA_PAGE_SEC_PRI, relation, page_number, sequence);
|
||||
if (vdr_flags & VDR_update)
|
||||
{
|
||||
if (!marked)
|
||||
{
|
||||
CCH_MARK(vdr_tdbb, &window);
|
||||
marked = true;
|
||||
}
|
||||
page->dpg_header.pag_flags &= ~dpg_secondary;
|
||||
pp_bits &= ~ppg_dp_secondary;
|
||||
vdr_fixed++;
|
||||
}
|
||||
}
|
||||
|
||||
release_page(&window);
|
||||
|
||||
#ifdef DEBUG_VAL_VERBOSE
|
||||
|
@ -119,8 +119,9 @@ private:
|
||||
VAL_DATA_PAGE_SLOT_NOT_FOUND= 36,
|
||||
VAL_DATA_PAGE_SLOT_BAD_VAL = 37,
|
||||
VAL_DATA_PAGE_HASNO_PP = 38,
|
||||
VAL_DATA_PAGE_SEC_PRI = 39,
|
||||
|
||||
VAL_MAX_ERROR = 39
|
||||
VAL_MAX_ERROR = 40
|
||||
};
|
||||
|
||||
struct MSG_ENTRY
|
||||
|
Loading…
Reference in New Issue
Block a user