Skip to content

fix(rm): delete versions with explicit version IDs#293

Merged
overtrue merged 2 commits into
mainfrom
overtrue/safer-removal-5104
Jul 23, 2026
Merged

fix(rm): delete versions with explicit version IDs#293
overtrue merged 2 commits into
mainfrom
overtrue/safer-removal-5104

Conversation

@overtrue

Copy link
Copy Markdown
Contributor

Related issues

Refs rustfs/rustfs#5104.
Refs rustfs/backlog#1405.
Blocked full bucket cleanup dependency: rustfs/backlog#1384.

Background

The initial removal-flag implementation made rm --versions and rb --force rely on the RustFS-specific x-rustfs-force-delete header. That collapses all versions of a key into one opaque server operation, loses per-version results, and cannot provide the staged discovery and failure guarantees required by backlog #1405.

Changes

  • Preserve each object key and version ID as a distinct delete target.
  • Send standard S3 DeleteObjects requests with explicit VersionId values for versions and delete markers.
  • Recognize DeleteMarkerVersionId in delete results so delete-marker cleanup is tracked correctly.
  • Fail closed on duplicate version targets or non-advancing pagination before mutation.
  • Stop a versioned delete when a batch is incomplete instead of silently treating the key as deleted.
  • Keep the RustFS force-delete header limited to the existing explicit --purge option.
  • Hide and reject rb --force and rb --dangerous before alias or network resolution until safe bucket-wide multipart discovery is available.

Scope

This PR does not claim to complete rb --force. The full staged workflow remains tracked by rustfs/backlog#1405 and is blocked by rustfs/backlog#1384. The existing explicit rm --purge behavior remains unchanged.

Validation

  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

@cxymds
cxymds marked this pull request as ready for review July 23, 2026 08:52
Copilot AI review requested due to automatic review settings July 23, 2026 09:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@overtrue
overtrue merged commit 7b8d954 into main Jul 23, 2026
17 checks passed
@overtrue
overtrue deleted the overtrue/safer-removal-5104 branch July 23, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants