Skip to content

Preserve existing Object Lock retention during site-replication bucket adoption #78

Closed

Description

@Vonng

Problem

When site replication adopts a pre-existing same-name bucket, PeerBucketMakeWithVersioningHandler handles BucketExists and then unconditionally executes:

if opts.LockEnabled {
    meta.ObjectLockConfigXML = enabledBucketObjectLockConfig
}

If the existing bucket already has a full Object Lock configuration with DefaultRetention, this overwrites it with the minimal ObjectLockEnabled=Enabled document before normal status/heal reconciliation. The local bucket's retention policy is silently downgraded during adoption.

This is distinct from #76: #76 routes Object Lock metadata through the wrong wire field during initial sync and remote heal. This issue concerns destructive handling of an already-existing local bucket before that metadata event is applied.

Proposed behavior

  • When opts.LockEnabled is true, write the minimal enabled config only if meta.ObjectLockConfigXML is empty.
  • Preserve any existing full Object Lock configuration and its ObjectLockConfigUpdatedAt; let explicit metadata status/heal resolve cross-site conflicts.
  • When writing the minimal default, do not assign a new current-time Object Lock timestamp. Leave it at the creation-default state so heal can recognize it as bootstrap metadata rather than a newer policy.
  • Keep existing versioning enablement behavior; CreatedAt canonicalization is outside this issue unless a reproduction proves it contributes to the retention overwrite.

Tests

  • Adopt an existing bucket with a full GOVERNANCE/COMPLIANCE DefaultRetention config: exact XML and timestamp remain unchanged.
  • Adopt an existing bucket with no Object Lock config while the source requires locking: minimal enabled config is written.
  • Reload metadata and confirm the minimal config's default timestamp equals bucket Created rather than adoption time.
  • Run focused site-replication/Object Lock tests, race tests, full cmd, and remote CI.

Ordering

Land after #76, which provides the corrected Object Lock event/test fixtures, and before the broader #77 timestamp/heal work.

Activity

  1. added
    bug
    on Aug 28, 2026
  2. Vonng commented on Aug 29, 2026

    @Vonng
    MemberAuthor

    PR submitted

    PR #90 is stacked on #76. It preserves full Object Lock retention and enabled custom versioning, bootstraps missing configs, and deliberately enables suspended/invalid versioning. CreatedAt ordering remains outside this PR under #77-A.

  3. Vonng commented on Aug 29, 2026

    @Vonng
    MemberAuthor

    Resolved by #90. Bucket adoption now preserves existing Object Lock and enabled custom versioning, initializes missing state, and repairs suspended/invalid state. Final main 1be684b passed Go CI, VulnCheck, the full local race suite, and Test Release run 33254848256.

  4. moved this from Backlog to Done in Siloon Aug 29, 2026
  5. self-assigned this
    on Sep 15, 2026
  6. added theissue type on Sep 15, 2026
  7. added this to the 20260903 milestone on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions