Conversation
… to smaller memory in SeSaveRecoverMultipleKeysTest("25k","18k")
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an intermittent snapshot-recovery data-loss regression under tight memory budgets by ensuring snapshot pages are made durable (flushed) before recovery-time eviction can free them. It also adds a regression test covering the failure mode and tightens a couple of recovery/resource-management code paths.
Changes:
- Update Tsavorite snapshot recovery to flush every snapshot page when a
LogSizeTrackeris attached (so recovery-time eviction cannot drop unflushed pages). - Make snapshot object-log recovery device initialization/disposal null-safe when the store has no object log.
- Add a regression test that recovers a SpanByte snapshot into a smaller budget (with optional concurrent resizer) and verifies all records read back correctly; add a clarifying comment in
ContinuePendingRead.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| libs/storage/Tsavorite/cs/src/core/Index/Recovery/Recovery.cs | Flush all snapshot pages under LogSizeTracker; null-safe object-log recovery device setup/teardown. |
| libs/storage/Tsavorite/cs/test/test.recovery/SpanByteRecoverySnapshotEvictionTests.cs | New regression test for snapshot recovery under budget-driven eviction (SpanByte/inline store). |
| libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/ContinuePending.cs | Comment clarifying why status is already SUCCESS at the copy-to-tail/readcache decision point. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
TedHartMS
marked this pull request as draft
July 21, 2026 01:53
…flush pages from the snapshot region unless the recovery memory budget is so much smaller that it has to; fix the pass2 object loading sequence when snapshot is present.
TedHartMS
marked this pull request as ready for review
July 22, 2026 00:55
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.
This pull request addresses a regression in snapshot recovery under memory budget constraints, ensuring that all pages are properly flushed and no data is lost during recovery. It also improves resource management and clarifies code paths for different store configurations. The most important changes are:
Bug Fixes and Recovery Logic Improvements:
RecoverSnapshotPagesinRecovery.csto always flush every page when aLogSizeTrackeris attached, regardless of whether the store is an object allocator or not. This prevents data loss when recovering into a smaller memory budget, fixing a scenario where pages could be evicted before being flushed, resulting in lost records.RecoverSnapshotPagesby removing unused parameters related to page ranges, reflecting the new logic that flushes all pages under a memory budget. [1] [2]Resource Management:
objectLogRecoveryDevicemay be null, preventing potential null reference exceptions.objectLogRecoveryDeviceto only occur when the store has an object log, and made its initialization call null-safe.Testing and Documentation:
SpanByteRecoverySnapshotEvictionTeststo verify that all records are correctly recovered when restoring from a snapshot under a tighter memory budget, and that no records are lost due to premature eviction.ContinuePending.csto document status handling during read operations.