Skip to content

Comments

WT-15766 Skip readonly btree for checkpoint#13239

Merged
whoisong merged 2 commits intodevelopfrom
wt-15766-skip-readonly-btree-for-checkpoint
Feb 24, 2026
Merged

WT-15766 Skip readonly btree for checkpoint#13239
whoisong merged 2 commits intodevelopfrom
wt-15766-skip-readonly-btree-for-checkpoint

Conversation

@whoisong
Copy link
Contributor

Read-only B-trees use relaxed concurrency that can race with checkpoint and cause failures. To avoid these races, this PR skips read-only B-trees during checkpoint processing.

@github-actions
Copy link

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:

@whoisong whoisong changed the title Wt 15766 skip readonly btree for checkpoint WT-15766 skip readonly btree for checkpoint Feb 23, 2026
*/
if (conn->stat_sources != NULL && F_ISSET(conn, WT_CONN_RECOVERY_COMPLETE))
WT_RET(__wt_conn_btree_apply(session, NULL, __statlog_apply, NULL, NULL));
WT_RET(__wt_conn_btree_apply(session, false, NULL, __statlog_apply, NULL, NULL));
Copy link
Contributor

Choose a reason for hiding this comment

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

There is also no point gathering stats for read only btree.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked with @bvpvamsikrishna and in case we'll need this in debugging scenarios, we shouldn't disable it globally. But I'll take the suggestion of skip_read.

continue;

/*
* We should skip readonly btrees during checkpoint scans.
Copy link
Contributor

Choose a reason for hiding this comment

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

single line comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

*/
int
__wt_conn_btree_apply(WT_SESSION_IMPL *session, const char *uri,
__wt_conn_btree_apply(WT_SESSION_IMPL *session, bool is_checkpoint, const char *uri,
Copy link
Contributor

Choose a reason for hiding this comment

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

rename this to bool skip_read only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@ddanderson ddanderson left a comment

Choose a reason for hiding this comment

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

Here's a different approach to consider, maybe cleaner. LMKWYT

*/
int
__wt_conn_btree_apply(WT_SESSION_IMPL *session, const char *uri,
__wt_conn_btree_apply(WT_SESSION_IMPL *session, bool skip_read, const char *uri,
Copy link
Member

Choose a reason for hiding this comment

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

Instead of having a special case arg here, maybe consider changing the __wt_checkpoint_get_handles function to skip readonly btrees? After all, that function already skips certain files, like history.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion thanks! That will make the change much more simple. I'll submit a new change for review.

@quchenhao quchenhao changed the title WT-15766 skip readonly btree for checkpoint WT-15766 Skip readonly btree for checkpoint Feb 23, 2026
const char *config, const char *type, const char *check)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_conn_btree_apply(WT_SESSION_IMPL *session, const char *uri,
extern int __wt_conn_btree_apply(WT_SESSION_IMPL *session, bool skip_read, const char *uri,
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, I mean skip_readonly.

@wiredtiger-prbot
Copy link

wiredtiger-prbot bot commented Feb 23, 2026

Woohoo, the code changed in this PR is pretty well tested! 🎉

Metric (for added/changed code) Coverage
Line coverage 100% (2/2)
Branch coverage 100% (4/4)

@whoisong whoisong force-pushed the wt-15766-skip-readonly-btree-for-checkpoint branch from 5fc199f to 462ac69 Compare February 23, 2026 21:52
Copy link
Contributor

@quchenhao quchenhao left a comment

Choose a reason for hiding this comment

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

lgtm

@whoisong whoisong marked this pull request as ready for review February 23, 2026 22:20
@whoisong whoisong requested a review from a team as a code owner February 23, 2026 22:20
Copy link
Contributor

@bvpvamsikrishna bvpvamsikrishna left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@etienneptl etienneptl left a comment

Choose a reason for hiding this comment

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

LGTM once the last comment has been addressed.

@whoisong whoisong added this pull request to the merge queue Feb 24, 2026
Merged via the queue into develop with commit def4af2 Feb 24, 2026
14 checks passed
@whoisong whoisong deleted the wt-15766-skip-readonly-btree-for-checkpoint branch February 24, 2026 03:20
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.

5 participants