diff --git a/docs/en/antalya/cas/bucket-requirements.md b/docs/en/antalya/cas/bucket-requirements.md
index c3f25b58794fa..e8c8e06a22dd3 100644
--- a/docs/en/antalya/cas/bucket-requirements.md
+++ b/docs/en/antalya/cas/bucket-requirements.md
@@ -35,6 +35,8 @@ Bucket **versioning is not required** — in fact it must be **disabled** on the
dialect (see below), because a token-exact delete on a versioned bucket archives a noncurrent
generation instead of reclaiming storage, silently stopping GC reclamation.
+On S3 (`ETag` dialect), an unversioned bucket is the default and recommended setup. If a bucket previously had versioning enabled and is now **`Suspended`**, `DeleteObject` on S3 still creates a `"null"`-version delete marker (`x-amz-delete-marker: true`), which `CasProbe` and GC reject by default (`CAS_DELETE_MARKER` / `NOT_IMPLEMENTED`). When the bucket's versioning status is `Suspended` (never `Enabled`) and an S3 lifecycle rule with `ExpiredObjectDeleteMarker: true` (and `NoncurrentVersionExpiration`) is configured, set `true` on the disk to allow mounting and delete-marker acceptance while still rejecting `Enabled` buckets.
+
On the generation-token dialect that requirement is checked at mount. A bucket reported as versioned
refuses the mount. A probe that could not answer — the credential may not read the bucket's versioning
configuration (`storage.buckets.get` on GCS), or the backend cannot report it — does not: the mount
diff --git a/docs/en/antalya/cas/configuration.md b/docs/en/antalya/cas/configuration.md
index 0e0ec0aa4f66c..9eab3201f4ba5 100644
--- a/docs/en/antalya/cas/configuration.md
+++ b/docs/en/antalya/cas/configuration.md
@@ -96,6 +96,7 @@ entirely before release. Treat this table as a snapshot of the current build, no
| `cas_blob_hash` | `cityhash128` | Pool blob content-hash function (`cityhash128` \| `xxh3-128` \| `sha256`). Recorded in the pool at creation; a mismatching config is refused at mount |
| `cas_blob_hash_allow_new` | `false` | Explicit opt-in to admit a new hash algorithm into an existing pool. One-way: once admitted, the pool carries both algorithms permanently |
| `cas_allow_packed_parts` | `false` | Allow creation of new `Packed` MergeTree parts on this disk. The decision uses the actual destination disk, not every disk in its storage policy. A `type=cache` disk inherits this capability from the wrapped `CAS` disk; set the key in the `metadata_type=cas` disk block. Existing `Packed` parts remain readable when this setting is `false` |
+| `cas_allow_versioning_suspended` | `false` | Allow mounting an S3 (`ETag`-dialect) bucket whose versioning status is `Suspended` and accept `"null"`-version delete markers on conditional deletes (`DeleteObject`). Buckets with versioning `Enabled` are still refused. Pair with an S3 lifecycle rule setting `ExpiredObjectDeleteMarker: true` (and `NoncurrentVersionExpiration` for any prior noncurrent versions) |
| `skip_access_check` | `false` | Skip the boot-time capability probe (start now, fix later). Only the preflight probe is skipped — the check that the object storage supports single-attempt conditional writes still runs on every ordinary writable start. **Not available on a writable generation-token (GCS) disk**, which refuses to mount with it: there, the probe battery is the only proof that a token-exact delete carries its generation precondition. Mount such a disk read-only if you need to defer the check |
| `cas_mount_lease_ttl_ms` | `40000` | How long this server may write after its last confirmed renewal; every other server waits at least this long before fencing or reclaiming its slot (≥ 1, at most 600000 — a larger value is clamped to 10 minutes with a warning at startup, so no holder declares a longer lease). Lower values shorten recovery after this server's crash but reduce tolerance for object-storage and scheduling delays. Set `30000` for faster recovery after a crash, at the costs [below](#mount-lease-costs) |
| `cas_mount_renew_period_ms` | `10000` | Milliseconds between background mount-lease renewals (≥ 1). It must leave enough time for two attempt envelopes (a renewal write and its settlement read) and the lease safety margin before the TTL expires: `period + 2 × envelope + margin < TTL` |
diff --git a/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.cpp b/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.cpp
index f0cbdf2e4dc90..f9694d27b7ac6 100644
--- a/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.cpp
+++ b/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.cpp
@@ -128,32 +128,75 @@ void recordConditionalWriteOutcome(CasWriteOutcome outcome)
ObjectStorageBackend::ObjectStorageBackend(ObjectStoragePtr object_storage_, Mode mode_,
bool single_attempt_control_plane_, uint64_t attempt_timeout_ms_,
- uint64_t connect_timeout_cap_ms_)
+ uint64_t connect_timeout_cap_ms_,
+ bool allow_versioning_suspended_)
: object_storage(std::move(object_storage_))
, mode(mode_)
, single_attempt_control_plane(single_attempt_control_plane_)
, attempt_timeout_ms(attempt_timeout_ms_)
, connect_timeout_cap_ms(connect_timeout_cap_ms_)
+ , allow_versioning_suspended(allow_versioning_suspended_)
, emu_root(object_storage->getCommonKeyPrefix())
{
if (mode == Mode::Native && object_storage->conditionalOpsUseGenerationTokens())
native_token_type = Dialect::Generation;
}
-/// See Backend::checkPoolPreconditions. Only the Native, generation-dialect (GCS) combination has
-/// anything to check: a token-exact DELETE on a versioned bucket archives a noncurrent generation
-/// instead of reclaiming storage, so GC "reclaim" would silently stop reclaiming. A bucket VERIFIED
-/// to have versioning enabled refuses the mount. A probe that cannot answer does not: it is not
-/// evidence of a versioned bucket, its usual cause is a credential without permission to read the
-/// bucket configuration, and refusing on it would turn a missing IAM grant into a hard outage. The
-/// mount proceeds with a warning that names what was not verified and how the operator can verify it.
-/// The probe uses this backend's control-plane profile, because the default client would retry a failed
-/// attempt with SDK backoff, outside the mount's attempt budget.
+bool ObjectStorageBackend::verifySuspendedVersioningAllowed() const
+{
+ if (!allow_versioning_suspended || mode != Mode::Native || native_token_type == Dialect::Generation)
+ return false;
+
+ if (suspended_delete_markers_checked.load(std::memory_order_acquire))
+ return suspended_delete_markers_allowed.load(std::memory_order_acquire);
+
+ const auto status = object_storage->getBucketVersioningStatus(controlRequest(/*attempt_no=*/0));
+ if (status == IObjectStorage::BucketVersioningStatus::Enabled)
+ {
+ throw Exception(ErrorCodes::NOT_IMPLEMENTED,
+ "CAS on S3: the bucket has object VERSIONING Enabled. `cas_allow_versioning_suspended=true` "
+ "only permits Suspended (or unversioned) buckets; an Enabled bucket archives noncurrent "
+ "versions on every overwrite and delete forever. Suspend or disable versioning and expire "
+ "noncurrent versions before mounting.");
+ }
+
+ if (status == IObjectStorage::BucketVersioningStatus::Suspended)
+ {
+ LOG_WARNING(getLogger("CasObjectStorageBackend"),
+ "CAS on S3: bucket versioning is Suspended and `cas_allow_versioning_suspended=true`; "
+ "allowing null-version delete markers on conditional deletes. Configure an S3 lifecycle rule "
+ "with `ExpiredObjectDeleteMarker: true` (and expire any prior noncurrent versions) so delete "
+ "markers do not accumulate.");
+ }
+ else if (status == IObjectStorage::BucketVersioningStatus::Unknown)
+ {
+ LOG_WARNING(getLogger("CasObjectStorageBackend"),
+ "CAS on S3: could not verify bucket versioning status (GetBucketVersioning failed or "
+ "unsupported); allowing delete markers because `cas_allow_versioning_suspended=true`. Confirm "
+ "by hand that versioning is Suspended (never Enabled) and configure an "
+ "`ExpiredObjectDeleteMarker: true` lifecycle rule.");
+ }
+
+ suspended_delete_markers_allowed.store(true, std::memory_order_release);
+ suspended_delete_markers_checked.store(true, std::memory_order_release);
+ return true;
+}
+
+/// See Backend::checkPoolPreconditions.
+/// - Native + Generation (GCS): refuses Enabled/Suspended buckets; tolerates Unknown with warning.
+/// - Native + ETag (S3): when `allow_versioning_suspended` is true, verifies the bucket is not
+/// `Enabled` and arms delete-marker acceptance for `Suspended` buckets before the probe runs.
void ObjectStorageBackend::checkPoolPreconditions()
{
- if (mode != Mode::Native || native_token_type != Dialect::Generation)
+ if (mode != Mode::Native)
return;
+ if (native_token_type != Dialect::Generation)
+ {
+ (void)verifySuspendedVersioningAllowed();
+ return;
+ }
+
const auto versioned = object_storage->isBucketVersioningEnabled(controlRequest(/*attempt_no=*/0));
if (!versioned.has_value())
{
@@ -970,9 +1013,12 @@ Backend::RawRemoval ObjectStorageBackend::removeUnder(
switch (result.outcome)
{
case ConditionalRemoveOutcome::Removed:
- /// A delete marker means the storage archived a noncurrent version instead of
- /// reclaiming the current object -- a removal that did not reclaim.
- return result.created_delete_marker ? RawRemoval::DeleteMarker : RawRemoval::Removed;
+ /// A delete marker means the storage archived a noncurrent version (or minted a
+ /// null-version delete marker on a Suspended S3 bucket). Only permit it when
+ /// `cas_allow_versioning_suspended=true` and `Enabled` versioning has been ruled out.
+ if (result.created_delete_marker)
+ return verifySuspendedVersioningAllowed() ? RawRemoval::Removed : RawRemoval::DeleteMarker;
+ return RawRemoval::Removed;
case ConditionalRemoveOutcome::TokenMismatch:
return RawRemoval::Mismatch;
case ConditionalRemoveOutcome::NotFound:
diff --git a/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.h b/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.h
index 5395bdcfc0f39..904cf3e39872e 100644
--- a/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.h
+++ b/src/Disks/DiskObjectStorage/MetadataStorages/ContentAddressed/Backend/CasObjectStorageBackend.h
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include