Skip to content

fix(provisioning): skip CreateBucket for buckets that already exist - #287

Open
shurkus wants to merge 1 commit into
rustfs:mainfrom
shurkus:fix/issue-286-create-bucket-head-first
Open

shurkus wants to merge 1 commit into
rustfs:mainfrom
shurkus:fix/issue-286-create-bucket-head-first

Conversation

@shurkus

@shurkus shurkus commented Oct 20, 2026

Copy link
Copy Markdown

Closes #286

Type of Change

  • New Feature
  • Bug Fix
  • Documentation
  • Performance Improvement
  • Test/CI
  • Refactor
  • Other:

Related Issues

Closes #286
Server side: rustfs/rustfs#8741

Summary of Changes

  • RustfsAdminClient::create_bucket now sends HeadBucket first. A successful HeadBucket returns CreateBucketResult::AlreadyOwnedByYou without sending CreateBucket. Any other answer goes on to CreateBucket, so the existing 409/503/4xx handling is unchanged. The COSI driver uses the same client method and gets the same behaviour.
  • Why: on RustFS, CreateBucket for an existing bucket takes the bucket's exclusive locks before it checks existence. Under steady PutObject traffic it times out with 503, and the bucket stays Pending untilthe writes stop.
  • Tests: existing_bucket_skips_create_bucket (HEAD 200, PUT 503 → Ready, "already exists") and missing_bucket_is_created (HEAD 404 → PUT). explicit_private_removes_operator_managed_anonymous_policy gets an explicit HEAD route, because axum's get route also answers HEAD and its handler asserts the ?policy query.

Checklist

  • I have read and followed the CONTRIBUTING.md guidelines
  • Passed make pre-commit (fmt-check + clippy + test + console-lint + console-fmt-check)
  • Added/updated necessary tests
  • Documentation updated (if needed)
  • CHANGELOG.md updated under [Unreleased] (if user-visible change)
  • CI/CD passed (if applicable)

Impact

  • Breaking change (CRD/API compatibility)
  • Requires doc/config/deployment update
  • Other impact: one extra HeadBucket per bucket per provisioning run

Verification

cargo fmt --all -- --check
cargo clippy --all-features -- -D warnings
cargo nextest run --all
make release-metadata-check e2e-check

Additional Notes

Rust gates ran locally: fmt, clippy, cargo nextest run --all (770 passed), doc tests, release-metadata-check, e2e-check. Console checks were not run because no console code changed.

Seen on a production Tenant (RustFS 1.0.2, steady mc mirror writes into the bucket): PUT /main returned 503 after 5 s on every retry for over 30 minutes, while HEAD /main answered at once.

Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.

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.

Existing bucket stays Pending: CreateBucket returns 503 while the bucket is written to

1 participant