feat(undo): restore versioned PUT and DELETE operations#300
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
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.
Related issue
Closes rustfs/backlog#1369.
Server-side atomic destination preconditions remain tracked by rustfs/backlog#1438.
Background and impact
RustFS supports object version history, exact delete-marker deletion, and copying a historical source version, but
rcdid not provide a safe workflow for recovering from an accidental versioned PUT or DELETE. Operators had to compose low-level requests manually and could easily delete the wrong marker, overwrite a concurrent update, or lose per-object failure context.Root cause
The core object-store abstraction exposed version listing and version-aware deletion but did not expose an exact historical source version for
CopyObject. There was also no deterministic undo planner or command-level current-version validation.Solution
CopyObjectOptionsand a backward-compatible exact-source-version copy abstraction.rc undowith single-object and recursive prefix modes, dry run, explicit version selection, and bounded concurrency.Concurrency boundary
The current S3/RustFS contract has no destination-current compare-and-swap for
CopyObjector version-specificDeleteObject. The preflight and postcondition checks detect observed concurrent changes and report a conflict, but the mutation itself is not atomic and a conflict detected afterward cannot be rolled back. This PR therefore does not claim transactional or exactly-once semantics. The server prerequisite is rustfs/backlog#1438.Validation
cargo fmt --all --checkCARGO_BUILD_JOBS=2 cargo clippy --workspace --all-targets -- -D warningsCARGO_BUILD_JOBS=2 cargo test --workspacegit diff --checkTests cover delete-marker restoration, overwrite restoration, explicit versions, dry run, recursive planning, bounded execution, missing and ambiguous history, suspended and unversioned buckets, stale plans before mutation, concurrent changes after mutation, plan-level retry, partial failure, access denial, legal hold, stable exit codes, pagination markers, nanosecond version ordering, CopySource encoding, and missing historical source versions.