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

Fix false positives of "missing entries for record X" error during index validation when a deleted record version is committed and has a backversion

The existence of an index entry is not required for such version chain because it is all garbage since a transaction is committed. To reproduce the false positive, the server should be stopped just after the chain is garbage-collected and an index page is written to disk.
This commit is contained in:
Ilya Eremin 2023-08-02 15:26:19 +03:00
parent 04928a467a
commit e3d3d15921

View File

@ -1790,17 +1790,22 @@ Validation::RTN Validation::walk_data_page(jrd_rel* relation, ULONG page_number,
// is a backversion then at least one of the record versions is
// committed. If there's no backversion then check transaction
// state of the lone primary record version. Unless it is already deleted.
// Note, if the primary record version is deleted and committed, the
// existence of an index entry is not required for such version chain
// because it is all garbage.
const bool deleted_flag = header->rhd_flags & rhd_deleted;
if (header->rhd_b_page)
if (header->rhd_b_page && !deleted_flag)
RBM_SET(pool, &vdr_rel_records, number.getValue());
else if ((header->rhd_flags & rhd_deleted) == 0)
else if (header->rhd_b_page || !deleted_flag)
{
const TraNumber transaction = Ods::getTraNum(header);
const int state = (transaction < dbb->dbb_oldest_transaction) ?
tra_committed : TRA_fetch_state(vdr_tdbb, transaction);
if (state == tra_committed || state == tra_limbo)
if (!deleted_flag && (state == tra_committed || state == tra_limbo) ||
deleted_flag && state != tra_committed)
RBM_SET(pool, &vdr_rel_records, number.getValue());
}