Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/jrd/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both ifs contain condition header->rhd_b_page. Cannot they be replaced with single if?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I tried it before and it led to unnecessary code duplication.

{
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());
}

Expand Down