-
Notifications
You must be signed in to change notification settings - Fork 394
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
WT-13990 Make handle-related stats private in the checkpoint module #11402
Conversation
Thanks for creating a pull request! Please answer the questions below by editing this comment. Type of change made in this PR
What makes this change safe?Answering this question helps the reviewers understand where they should focus their attention. Please consider these prompts:
References: Checklist before requesting a review
|
Test coverage is ok, please refer to the Code change/coverage report links below and try to improve it if feasible.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Etienne, I like the change!
Just a couple of comments inside.
src/conn/conn_dhandle.c
Outdated
if (F_ISSET(S2BT(session), WT_BTREE_SKIP_CKPT)) | ||
__wt_checkpoint_skip_handle_stats(session, &conn->ckpt, time_diff); | ||
else | ||
__wt_checkpoint_apply_handle_stats(session, &conn->ckpt, time_diff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you think to move this "if" into the function and merge the "skip" and "apply" functions into one? Then here it'd be just one function call and this logic would move inside the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I pointed out that it was a bit overkill in the description above. I am glad you think the same.
The issue with this approach is that we need something from the caller to tell us if we should be in the if or else statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought, the function could be literally like:
__wt_checkpoint_apply_handle_stats(...)
{
if (F_ISSET(S2BT(session), WT_BTREE_SKIP_CKPT)) {
...
} else {
...
}
But it's a nitpick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not want to add more btree stuff in the checkpoint but I think it should be fine, what do you think about it @sueloverso?
Updated in 9575d88 but happy to revert if that was the wrong move.
src/checkpoint/checkpoint_stats.c
Outdated
|
||
/* | ||
* __wt_checkpoint_set_handle_stats -- | ||
* Reset handle-related stats. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment copy-pasted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Fixed in c11788f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some readability suggestions but otherwise I'm happy with the PR!
src/checkpoint/checkpoint_stats.c
Outdated
* Update the skip handle-related stats. | ||
*/ | ||
void | ||
__wt_checkpoint_skip_handle_stats( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you decide to keep these functions separate, then because this function is very similar to __wt_checkpoint_apply_handle_stats
, I think it'd be more clear to put them next to each other.
src/conn/conn_dhandle.c
Outdated
if (F_ISSET(S2BT(session), WT_BTREE_SKIP_CKPT)) | ||
__wt_checkpoint_skip_handle_stats(session, &conn->ckpt, time_diff); | ||
else | ||
__wt_checkpoint_apply_handle_stats(session, &conn->ckpt, time_diff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought, the function could be literally like:
__wt_checkpoint_apply_handle_stats(...)
{
if (F_ISSET(S2BT(session), WT_BTREE_SKIP_CKPT)) {
...
} else {
...
}
But it's a nitpick.
src/checkpoint/checkpoint_private.h
Outdated
struct __wti_ckpt_handle_stats { | ||
uint64_t apply; /* handles applied */ | ||
uint64_t apply_time; /* applied handles gather time */ | ||
uint64_t drop; /* handles dropped */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're here could you please improve this comment. I've been mislead by this implying dropping handles but it's actually dropping checkpoints for that handle. So I would replace it with:
handle checkpoints dropped
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean we need to update the other fields too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, updating the comment here where we define it is okay. If you encounter it elsewhere I expect the comment where it's defined to be what clarifies it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 738caf6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice change
@@ -664,13 +664,7 @@ __conn_btree_apply_internal(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle, | |||
if (time_start != 0) { | |||
time_stop = __wt_clock(session); | |||
time_diff = WT_CLOCKDIFF_US(time_stop, time_start); | |||
if (F_ISSET(S2BT(session), WT_BTREE_SKIP_CKPT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to have them incremented within the file_func
?
Then there is no need to call a seperate function and the logic would become easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make it easier to understand though? You have to trace back what "file_func" is to know what it does.
Did you want to use file_func
in __checkpoint_apply_operation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with @Siddhartha8899 online, we won't do it. This PR improves encapsulation but, unfortunately, not coupling. It would be great to revisit the code flow and make some effort towards making the coupling less complex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR creates APIs in order to make the existing struct
WT_CKPT_HANDLE_STATS
private.