Skip to content

WT-17187 Harden follower-mode fast-truncate truncate list#13562

Open
krischov wants to merge 1 commit intodevelopfrom
wt-17187-truncate-bug-fixes
Open

WT-17187 Harden follower-mode fast-truncate truncate list#13562
krischov wants to merge 1 commit intodevelopfrom
wt-17187-truncate-bug-fixes

Conversation

@krischov
Copy link
Copy Markdown
Contributor

This change aims to fix the bugs identified in WT-17187.

@krischov krischov self-assigned this Apr 17, 2026
@krischov krischov requested a review from a team as a code owner April 17, 2026 06:13
@github-actions
Copy link
Copy Markdown

Thanks for creating a pull request! Please answer the questions below by editing this comment — completing this upfront typically speeds up the review process.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I can point to specific tests that would catch regressions of this change, or I've documented why existing test coverage is sufficient.
  • I have made corresponding changes to the documentation, or no documentation change is needed.

What makes this change safe?

Help reviewers focus their attention by answering these questions:

  • Data format compatibility: Does this change modify the format of WT data or metadata? If so, does this change support non-disruptive upgrade of older systems?
  • Test coverage: Which specific tests validate your change? (Name the test files/functions that would fail if your change were reverted)
  • Risk assessment: What functionality could break if this change has bugs? How thoroughly have you tested edge cases?
  • Review focus: What aspects would you want a teammate to double-check?

Type of change made in this PR

  • Functional change
  • Test-only change
  • Refactor-only change
  • Other non-functional change

References:

Comment thread src/txn/txn_truncate.c
if (start_key->size != 0) {
WT_RET(__wt_compare(session, collator, key, start_key, &compare_result));
if (compare_result < 0)
return (0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I rather us have is_within_range be set before each return. IMO It's easier to reason about here.

Comment thread src/txn/txn_truncate.c
WT_ERR(__wt_txn_truncate(session, t));
WT_ERR(__wt_session_release_dhandle(session));
truncate_ret = __wt_txn_truncate(session, t);
WT_TRET(__wt_session_release_dhandle(session));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can place the __wt_session_release_dhandle under err: so that we eliminate the need for truncate_ret here. I believe __wt_session_release_dhandle no-ops if there is no dhandle with it (please double-check)

Comment thread src/txn/txn_truncate.c

WT_RET(ret);

if (is_within_range) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice catch here

Comment thread src/txn/txn_truncate.c
ret = __key_within_truncate_range(
session, collator, &entry->start_key, &entry->stop_key, key, &is_within_range);

if ((ret != 0) || is_within_range)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how about let's add an err: label. And directly do WT_ERR(__key_within_truncate_range()) here.

@wiredtiger-prbot
Copy link
Copy Markdown

Test coverage is very low, please refer to the Code change/coverage report links below and try to improve it if feasible.

Metric (for added/changed code) Coverage
Line coverage 0% (0/49)
Branch coverage 0% (0/22)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants