Skip to content

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
percona:trunkfrom
polchawa-percona:PS-11141-trunk-lru-scan-fix
Open

PS-11446 [trunk]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan#6094
polchawa-percona wants to merge 1 commit into
percona:trunkfrom
polchawa-percona:PS-11141-trunk-lru-scan-fix

Conversation

@polchawa-percona

@polchawa-percona polchawa-percona commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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.

Port of #6085 to the trunk branch (same bug present identically upstream).

@polchawa-percona polchawa-percona changed the title PS-11141 [trunk]: LRU optimization: LRU scan was restarted when it should continue. PS-11141 [9.7]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan Jul 22, 2026
@polchawa-percona polchawa-percona self-assigned this Jul 22, 2026
@polchawa-percona polchawa-percona changed the title PS-11141 [9.7]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan PS-11141 [trunk]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan Jul 22, 2026
@polchawa-percona polchawa-percona changed the title PS-11141 [trunk]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan PS-11146 [trunk]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan Jul 22, 2026
@polchawa-percona polchawa-percona changed the title PS-11146 [trunk]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan PS-11446 [trunk]: Fix inverted old/young check in LRUItr::start() that always restarted the LRU scan Jul 22, 2026
@polchawa-percona
polchawa-percona force-pushed the PS-11141-trunk-lru-scan-fix branch 2 times, most recently from 5c68652 to 07a82bc Compare July 22, 2026 18:03
…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.
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.

2 participants