Fix shard reverse scan ordering, GroupID dedup, pinReadTS nil panic, and leader S3 map overwrite#412
Merged
bootjp merged 2 commits intofeature/s3-implfrom Mar 23, 2026
Merged
Conversation
Merged
…lts, dedup by GroupID, pinReadTS no-op token, guard leader S3 map entry Co-authored-by: bootjp <1306365+bootjp@users.noreply.github.com> Agent-Logs-Url: https://github.com/bootjp/elastickv/sessions/2f32e04f-12e2-4392-9ee8-2f1291e6b67f
Copilot
AI
changed the title
[WIP] Add S3 adapter to elastickv with routing support
Fix shard reverse scan ordering, GroupID dedup, pinReadTS nil panic, and leader S3 map overwrite
Mar 23, 2026
bootjp
approved these changes
Mar 23, 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.
Four correctness issues identified in review: cross-shard reverse scans could return unsorted results for small result sets, the
clampToRoutes=falsepath could redundantly scan the same shard after a range split,pinReadTSreturnednilcausing panics ondefer readPin.Release(), and follower nodes could overwrite the leader's S3 endpoint mapping.Changes
mergeAndTrimReverseScanResults(kv/shard_store.go): Sort descending unconditionally before the limit check — previously sort was skipped whenlen(out) <= limit, silently breaking key order for small cross-shard results.reverseScanRoutesAtGroupID dedup (kv/shard_store.go): TrackseenGroupsin theclampToRoutes=falsepath and skip routes sharing an already-scannedGroupID. After a range split both halves inherit the sameGroupID, causing the backing shard to be scanned twice and producing duplicate KV pairs.pinReadTSno-op token (adapter/s3.go): Return&kv.ActiveTimestampToken{}instead ofnilwhenreadTrackeris unconfigured.ActiveTimestampToken.Release()is a safe no-op on a zero value, so callers can unconditionallydefer readPin.Release()without panic.NewS3Serverleader map guard (adapter/s3.go): Only populateleaderS3[leader]when the key is absent. Previously, a follower constructingNewS3Serverwith its owns3Addrwould overwrite the leader's correctly-mapped endpoint, misrouting proxied requests.⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.