WT-15766 Skip readonly btree for checkpoint#13239
Conversation
|
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
What makes this change safe?Help reviewers focus their attention by answering these questions:
Type of change made in this PR
References: |
src/conn/conn_stat.c
Outdated
| */ | ||
| 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)); |
There was a problem hiding this comment.
There is also no point gathering stats for read only btree.
There was a problem hiding this comment.
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.
src/conn/conn_dhandle.c
Outdated
| continue; | ||
|
|
||
| /* | ||
| * We should skip readonly btrees during checkpoint scans. |
src/conn/conn_dhandle.c
Outdated
| */ | ||
| 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, |
There was a problem hiding this comment.
rename this to bool skip_read only?
ddanderson
left a comment
There was a problem hiding this comment.
Here's a different approach to consider, maybe cleaner. LMKWYT
src/conn/conn_dhandle.c
Outdated
| */ | ||
| 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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Good suggestion thanks! That will make the change much more simple. I'll submit a new change for review.
src/include/extern.h
Outdated
| 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, |
There was a problem hiding this comment.
sorry, I mean skip_readonly.
|
Woohoo, the code changed in this PR is pretty well tested! 🎉
|
5fc199f to
462ac69
Compare
etienneptl
left a comment
There was a problem hiding this comment.
LGTM once the last comment has been addressed.
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.