-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[Layered Map] Expose inner layers #18353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Closed
This was referenced Dec 26, 2025
5ac051f to
03d935c
Compare
bbdf3e8 to
c9185c1
Compare
grao1991
approved these changes
Jan 5, 2026
ad6e4f6 to
11b3d5a
Compare
zekun000
approved these changes
Jan 14, 2026
Previously, in order to find all changes between two `State`s, we could just "diff" the two map layers and we would get all the KVs that are changed. This is insufficient with tiered storage. For instance, consider the following sequence of events: 1. At the end of block `N`, key `K` is read and promoted to hot and its value is `V0` in both hot state and cold state. 2. At the end of block `N+1`, its value is updated to `V1` in hot state. 3. At the end of block `N+2`, it's evicted and the value in cold state is updated to `V1`. 4. At the end of block `N+3`, it's read and promoted into hot state again. If we simply look at the `StateDelta` in the current implementation, we'd see the value change in hot state, but miss the change from `V0` to `V1` in the cold state. So we need to expose all the inner layers in order to accurately compute what changed between two points in time. This PR simply adds the API on `LayeredMap`.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
✅ Forge suite
|
Contributor
✅ Forge suite
|
Contributor
✅ Forge suite
|
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.
Previously, in order to find all changes between two
States, we could just "diff" the two map layers and we would get all the KVs that are changed.This is insufficient with tiered storage. For instance, consider the following sequence of events:
N, keyKis read and promoted to hot and its value isV0in both hot state and cold state.N+1, its value is updated toV1in hot state.N+2, it's evicted and the value in cold state is updated toV1.N+3, it's read and promoted into hot state again.If we simply look at the
StateDeltain the current implementation, we'd see the value change in hot state, but miss the change fromV0toV1in the cold state.So we need to expose all the inner layers in order to accurately compute what changed between two points in time. This PR simply adds the API on
LayeredMap.Note
Introduces per-layer views and parent linking to support inspecting all changes between two layers.
parent: Weak<Self>toLayerInnerand set it innew_family/spawn; children remain tracked for drop safetyMapLayer::parent()to navigate layer ancestryLayeredMap::inner_maps()returning the sequence of inner maps between(base_layer, top_layer]in ordernaive_view_layer, verifyinner_maps()correctness forget()anditer()Written by Cursor Bugbot for commit 651ec78. This will update automatically on new commits. Configure here.