-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-36886 log_t::get_lsn_approx() isn't lower bound #4074
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The explanation is correct but we don't want to subtract a bigger number and then convert the -ve number to get a huge(incorrect) age and falsely recommend adaptive flushing. Can you please add similar condition as in the other caller of
get_lsn_approx(page_cleaner_flush_pages_recommendation) ?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.
lsn_tis an unsigned integer (uint64_taliased viaib_uint64_t), and any wrap-around for unsigned integers is well defined behaviour. For signed integers, wrap-around from positive to negative or vice versa is undefined behaviour. This fact allows compilers to optimize some loop conditions when the loop variable typically is a signedint(although not in InnoDB).The comment tries to explain that the impact of the odd
return trueinstead of a more correctreturn falseis limited to the following in the only callerbuf_flush_page_cleaner():possibly_unemployed: if (!soft_lsn_limit && !af_needed_for_redo(oldest_lsn)) goto set_idle; buf_pool.page_cleaner_set_idle(false); buf_pool.n_flush_inc(); mysql_mutex_unlock(&buf_pool.flush_list_mutex); if (UNIV_UNLIKELY(soft_lsn_limit != 0)) { n= srv_max_io_capacity; goto background_flush; } if (!srv_adaptive_flushing)That is, an accidental
return truemay lead to attempting to run an extra flushing batch instead of entering an unbounded wait forbuf_pool_t::page_cleaner_wakeup(). This is similar to the glitch inpage_cleaner_flush_pages_recommendation(), which could return an unnecessarily large number of recommended pages to flush.