Skip to content

Commit ad4addd

Browse files
authored
Merge pull request #7694 from red-soft-ru/fb_5_0_index_validation_fix
Fix false positives of "missing entries for record X" error during index validation when a deleted record version is committed and has a backversion
2 parents 24a4dd7 + e3d3d15 commit ad4addd

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/jrd/validation.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,17 +1790,22 @@ Validation::RTN Validation::walk_data_page(jrd_rel* relation, ULONG page_number,
17901790
// is a backversion then at least one of the record versions is
17911791
// committed. If there's no backversion then check transaction
17921792
// state of the lone primary record version. Unless it is already deleted.
1793+
// Note, if the primary record version is deleted and committed, the
1794+
// existence of an index entry is not required for such version chain
1795+
// because it is all garbage.
1796+
const bool deleted_flag = header->rhd_flags & rhd_deleted;
17931797

1794-
if (header->rhd_b_page)
1798+
if (header->rhd_b_page && !deleted_flag)
17951799
RBM_SET(pool, &vdr_rel_records, number.getValue());
1796-
else if ((header->rhd_flags & rhd_deleted) == 0)
1800+
else if (header->rhd_b_page || !deleted_flag)
17971801
{
17981802
const TraNumber transaction = Ods::getTraNum(header);
17991803

18001804
const int state = (transaction < dbb->dbb_oldest_transaction) ?
18011805
tra_committed : TRA_fetch_state(vdr_tdbb, transaction);
18021806

1803-
if (state == tra_committed || state == tra_limbo)
1807+
if (!deleted_flag && (state == tra_committed || state == tra_limbo) ||
1808+
deleted_flag && state != tra_committed)
18041809
RBM_SET(pool, &vdr_rel_records, number.getValue());
18051810
}
18061811

0 commit comments

Comments
 (0)