PS-11446 [trunk]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan#6094
Open
polchawa-percona wants to merge 1 commit into
Conversation
polchawa-percona
force-pushed
the
PS-11141-trunk-lru-scan-fix
branch
2 times, most recently
from
July 22, 2026 18:03
5c68652 to
07a82bc
Compare
…t always restarted the LRU scan https://perconadev.atlassian.net/browse/PS-11446 LRUItr::start() is meant to leave the scan hand pointer (m_hp) in place while it is still within the "old" (cold) sublist of the LRU list, and only rewind it to the tail of the LRU list once the pointer has advanced past the old/young boundary into the young (hot) sublist. The boundary check was inverted: `m_hp->old` is true while the pointer is still in the old region, so the scan was rewound on every call instead of only at the old -> young transition. This defeated the intended optimization by repeatedly restarting the scan from the tail rather than letting it continue. Fix the condition to `!m_hp->old`, so the pointer is only reset once it has crossed into the young sublist.
polchawa-percona
force-pushed
the
PS-11141-trunk-lru-scan-fix
branch
from
July 22, 2026 18:45
07a82bc to
df1e0b5
Compare
satya-bodapati
approved these changes
Jul 22, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
https://perconadev.atlassian.net/browse/PS-11446
LRUItr::start() is meant to leave the scan hand pointer (m_hp) in
place while it is still within the "old" (cold) sublist of the LRU
list, and only rewind it to the tail of the LRU list once the pointer
has advanced past the old/young boundary into the young (hot) sublist.
The boundary check was inverted:
m_hp->oldis true while thepointer is still in the old region, so the scan was rewound on every
call instead of only at the old -> young transition. This defeated
the intended optimization by repeatedly restarting the scan from the
tail rather than letting it continue.
Fix the condition to
!m_hp->old, so the pointer is only reset onceit has crossed into the young sublist.
Port of #6085 to the trunk branch (same bug present identically upstream).