[fix][store] Fix raft snapshot over-read caused by unused iterator upper bound - #1486
Merged
Merged
Conversation
…per bound OpenReaderAdaptor and ContextReset built iter_options with the region's encoded range but passed a default-constructed IteratorOptions() to NewIterator, so no iterate_upper_bound was ever set; the read loop also never checked the upper bound. As a result an InstallSnapshot streamed every key >= the region's start_key to the end of the CF, sending other regions' data to the follower (region_size 0.2GB -> 426GB snapshots in production; new replicas polluted with cross-region keys). Pass the prepared iter_options at both call sites and add an explicit upper-bound guard (empty-safe) in the read loop. Verified on a 5-store local cluster: - head-of-CF region 80001: 24,754,030 B / 938 keys -> 1,061,991 B / 237 keys (23.3x), sst_dump shows 0 cross-region keys (was 320) - mid-chain region 80002: 20,991,640 B, own data only (was own+2.6MB) - CF-tail region 80005: 1,977,970 B, byte-identical before/after (no self-truncation)
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.
[fix][store] Fix raft snapshot over-read caused by unused iterator upper bound