feat(changelog): Add and use Assembling phase with deferred cleanup#480
Merged
lcian merged 22 commits intoMay 29, 2026
Merged
Conversation
The existing ChangeGuard assumes every LT write uses a unique key and can be safely cleaned up if the guard drops before CAS commits. For multipart uploads the physical key is fixed at initiation time, so a retry of complete_multipart reuses the same key. Immediate cleanup on guard drop would race with retries and delete successfully assembled blobs. Introduce ChangePhase::Assembling: when the guard drops in this phase, in-process cleanup is skipped and the changelog entry persists. A cleanup_after timestamp on Change tells scan() to filter out entries whose grace period hasn't elapsed. Once the deadline passes, a recovery scan picks up the entry and uses read_tombstone() to determine the correct cleanup action — preserving blobs that a retry committed and deleting genuine orphans. Refs: FS-339
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Member
Author
|
Okay it should be good now, here's the diff since the time you reviewed @matt-codecov https://github.com/getsentry/objectstore/pull/480/changes/6f626efafa4f2370cf0b227620eaaab71ef3c99f..d32e4c2dbda9e74858d9757bcc23fdde0c14d4e4 |
lcian
commented
May 28, 2026
matt-codecov
approved these changes
May 28, 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.
This addresses the issue being discussed in #458 (comment) by introducing a new
ChangePhase::Assemblingvariant.The corresponding
Changecarries acleanup_aftertimestamp, allowing the caller to defer cleanup.In practice, we use this in
TieredStorage::complete_multipartwith an arbitrary 24 hours deadline (should we change this?), during which the user can freely retry completing the upload.Note that this
ChangePhaseis special, as it behaves likeChangePhase::completein-process:Drop, as we assume that the deadline hasn't passed yet.ChangeGuardfor it also doesn't spawn any task onDrop, due to the same assumption.As a consequence, this depends on a persistent implementation of the
ChangeLogto actually clean anything up, or at least on a task that periodically scans the in-memoryChangeLogforChanges to clean up, both of which we don't have yet.In production, we will eventually always use a persistent
ChangeLog, and other code paths exist that similarly require a persistentChangeLogto actually ensure that no LT orphans are created, so I think it's fine for this change to also make that assumption.Part of FS-339.
Will be squash-merged into #458 once approved.