Repository navigation
Reuse RxIteratorConsumer in RedissonKeysRx instead of duplicating the SCAN-cursor loop - #7312
Merged
Merged
Conversation
… SCAN-cursor loop redisson#7311 Signed-off-by: 심현민 <[email protected]>
stlahxm
force-pushed
the
fix/rx-keys-scan-consumer
branch
from
August 21, 2026 05:51
5c65d58 to
69f2553
Compare
Member
|
Thanks for contribution |
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.
Closes #7311
RedissonKeysRx.createKeysIterator()re-implemented the backpressure-aware SCAN cursor loop (request counting, cursor advancement, completion signaling) locally instead of extendingRxIteratorConsumer, which already provides the same loop and is used bySetRxIterator,RedissonMapRxIterator, andRedissonArrayRx.The Reactor-based equivalent,
RedissonKeysReactive, already delegates to its shared abstraction (IteratorConsumer) with the same two extension points this change now uses (tryAgain(),scanIterator(client, nextIterPos)), so this bringsRedissonKeysRxin line with the existing pattern rather than introducing a new one.This isn't purely cosmetic: the duplicated loop was the site of a real bug before (#5425, fixed in
0fae241aa), and that fix was applied only inside this file rather than in the shared consumer. Keeping a second copy means any future fix toRxIteratorConsumerwon't reach this class automatically.Changes
RedissonKeysRx.createKeysIterator(): replaced the hand-rolledLongConsumer(35 lines) with an anonymousRxIteratorConsumer<String>subclass (8 lines). No behavioral change intended.RedissonKeysRxTest: added two tests exercising code paths the existing suite didn't cover:testGetKeysEmptyDatabase: empty keyspace completes without hanging or erroring.testGetKeysPartialRequestReturnsExactCount: requesting fewer items than exist viatake(5)while the chunk size forces multiple SCAN round-trips still returns the exact count, no duplicates, matching the requested pattern.Testing
Ran the full
RedissonKeysRxTestsuite (10 tests, including the two new ones) against a real Redis instance:Also ran all 18 test classes under
org.redisson.rxto check for second-order effects, sinceRxIteratorConsumeris shared by three other classes.A handful of unrelated failures showed up (a TTL-timing assertion, a batch write-timeout threshold, a connection-leak timeout, and a classpath error that only appeared when running a single test class in isolation).
None of them touch
getKeys()/RKeysRx, and re-running them in isolation showed the timing-sensitive ones are flaky rather than consistently broken.I did not verify these same failures occur on unmodified
master, but the affected classes (RedissonMapCacheRx,RedissonBatchRx's cluster/timeout paths) don't referenceRxIteratorConsumerorRedissonKeysRxat all, so they're outside this change's blast radius.