Repository navigation
Conversation
mtabebe
force-pushed
the
per-143-gc-after-drop
branch
2 times, most recently
from
November 6, 2026 00:36
6a8fc7e to
4982f2b
Compare
Move the test `Consensus` that commits a CaS and then loses its response from `schema.rs`'s tests to the shared test helpers in `lib.rs`, so tests outside `schema.rs` can use it. No behavior change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Context: The storage controller keeps each dropped shard in a set until it is finalized. Each tick it skips shards where `is_finalized` is true, calls `finalize_shard` on the rest, and drops a shard once that returns `Ok`. Problem: It is possible for the storage controller to say it is done before GC has finished. `is_finalized` holds as soon as the shard is a tombstone with one empty batch, before any GC runs. Retrying `finalize_shard` does not commit anything, so it does not ask for GC and returns. Moreover, one GC may not be enough, because we bound how many versions one GC run can remove. Since nothing commits to a finalized shard, nothing asks for GC again, and we can leak blobs. Solution: `State::finalized_gc_step` returns the next step on a finalized shard (write a rollup, or GC through some seqno), or `None` when it is done. `finalize_shard` runs those steps until `None`, and `is_finalized` requires `None`. If no progress is made (e.g., on stale state behind a concurrent GC) we back off and retry up to a bounded time period. Note: Shards that left the controller's set before this change, or that were finalized while `persist_gc_remove_finalized_rollups` is off, keep their old rollups. `is_finalized` depends on that flag. Testing: - `finalize_retry_finishes_gc`: skips GC after `become_tombstone`, then retries `finalize_shard`, with the flag on and off. Before this change the shard counted as finalized before GC ran, and a part leaked. - Check that no rollup blob is left that state does not reference. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mtabebe
force-pushed
the
per-143-gc-after-drop
branch
from
November 6, 2026 15:44
4982f2b to
100456f
Compare
This branch has not been deployed
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:
The storage controller keeps each dropped shard in a set until it is
finalized. Each tick it skips shards where
is_finalizedis true, callsfinalize_shardon the rest, and drops a shard once that returnsOk.Problem:
It is possible for the storage controller to say it is done before
GC has finished.
is_finalizedholds as soon as the shard is atombstone with one empty batch, before any GC runs.
Retrying
finalize_sharddoes not commit anything, so it does not askfor GC and returns. Moreover, one GC may not be enough, because we bound
how many versions one GC run can remove.
Since nothing commits to a finalized shard, nothing asks for GC again,
and we can leak blobs.
Solution:
State::finalized_gc_stepreturns the next step on a finalized shard(write a rollup, or GC through some seqno), or
Nonewhen it is done.finalize_shardruns those steps untilNone, andis_finalizedrequiresNone.If no progress is made (e.g., on stale state behind a concurrent GC) we
back off and retry up to a bounded time period.
Note:
Shards that left the controller's set before this change, or that were
finalized while
persist_gc_remove_finalized_rollupsis off, keep theirold rollups.
is_finalizeddepends on that flag.Testing:
finalize_retry_finishes_gc: skips GC afterbecome_tombstone, thenretries
finalize_shard, with the flag on and off. Before this changethe shard counted as finalized before GC ran, and a part leaked.
Fixes PER-143