Repository navigation
fix: refresh Stream range locations before pinning - #365
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Context
Fix the Stream recovery crash in CI run 39365508086, amd64 shard 5.
PrivatePlanYieldsWorkerButRetainsKeyAndRecovers/extentloses itsXRANGEconnection after restarting with three workers; the server log reportsMaterializePublishedIndexLocationassertingowner < kMaxMemoryWorkers.Behavior before and after
A Stream range captures an immutable directory, releases store state, and reads its boundary pages before building the snapshot pin list. Those reads can allow transaction cleaning to relocate and retire the captured physical blocks. The old directory still owns its compact coordinates, but no longer owns their allocations; materializing those coordinates can assert, or borrow a reused block's identity.
After boundary reads, the reader reacquires store state, verifies the population and logical version, and refreshes both the root and grouped physical directory before capturing pins. It retains the computed ranks and admitted probe payload because the logical graph is unchanged.
Implementation
ReadValueForTransferLockedbeforePrepareOrderedRangeSnapshotPins, with no suspension between graph lookup and pin-list capture.Design decisions and alternatives
Use the existing worker-local asynchronous store lock and physical pin protocol. Keeping the old allocation alive throughout boundary discovery would require broader pinning before the selected interval is known. Refreshing the physical graph preserves the existing bounded range-pin model.
Documentation and comments
Added the lifetime invariant beside the refresh and comments explaining the regression's scheduling. Architecture is unchanged: this restores the documented requirement to capture current physical identities before suspension and pin the selected graph.
Test plan
Local validation uses the existing ARM64 Debug build with test faults enabled and aggressive optimization disabled.
impl.h:430with the same owner assertion. Its captured stack goes throughPrepareOrderedRangeSnapshotPinsandReadValueForTransferLocked.cmake --build build_ci --target lavik_unit_tests lavik lavik_compact_collection_write_e2e_test lavik_grouped_ordered_write_e2e_test --parallel 4— passed.build_ci/lavik_unit_tests --gtest_filter='GroupedCollectionTwoOwnerReadTest.StreamRangeRefreshesPhysicalGraphAfterBoundaryReads' --gtest_repeat=20— all 20 passed.build_ci/lavik_unit_tests --gtest_filter='*LoadValueAwaitableTestPeer*:*ReadTest*'— all 96 passed.LAVIK_TEST_DATA_DIR=/mnt/dev ctest --test-dir build_ci -R '^lavik_(compact_collection_write|grouped_ordered_write)_e2e$' --output-on-failure— both suites passed: compact collection 54 passed (417.76 s); ordered collection 133 passed and 1 skipped (972.97 s). The skippedGroupedRdbStreamE2e.LargeListOverOneGiBImportsAndExportsWithoutAggregaterequires explicit opt-in for its private 4 GiB image and >1 GiB RDB.pre-commit run --files src/storage/engine/transfer_api.cpp tests/load_value_awaitable_test.cpp— passed.git diff --check— passed.Risk assessment
The change is limited to Stream range snapshot capture. It adds a store-lock reacquisition and current-index lookup after boundary discovery, without changing durable formats, range selection, or whole-object transfers. Population and logical-version changes fail the read instead of reusing computed ranks for a different graph.
Rollback plan
Revert this commit; no migration is required. Reverting restores the relocation race.
Reviewer guide
Start with the deterministic interleaving in
StreamRangeRefreshesPhysicalGraphAfterBoundaryReads, then check that the production refresh updates the root, manifests, and grouped handle together before pin-list capture.Follow-up work
None.