Repository navigation
Description
Independent verification update — 2026-09-06, round 2
The P2 representation gap is verified fixed at #131 0192c73d850743d62cc1391537560b17e7adc583; keep open until merge. The helper now recognizes both present-empty public keys and timestamp-only tombstones. The previous independent regression, built through applyReplicatedObjectLock, now requests one retention confirmation and resends on AccessDenied. The destination-still-retained and confirmed-absent cases pass, and a real non-empty retention with a timestamp is not misclassified as a removal.
- Recognize both empty-value and timestamp-only removal state.
- Cover a confirmed-absent target and a denied/still-retained target for both representations.
- Merge fix: stop re-replicating an object whose retention was removed #131 into maintained main.
This is a small, necessary correction to the existing confirmation path. The original plan below remains historical context; #111's timestamp-only persistence is part of the verified scope. The supported SILO replication policy already lists s3:GetObjectRetention; denied reads continue to resend conservatively.
Problem
Removing Object Lock retention leaves the source object holding x-amz-object-lock-mode and
x-amz-object-lock-retain-until-date as present-but-empty strings. getReplicationAction compares
that stored map against the headers the target returns from HEAD, and the target can never report
those keys with an empty value, because the server omits them from GET and HEAD responses. The
comparison reports a difference nothing can clear, so the "already in sync, nothing to send" fast
path is dead for these versions: whenever an otherwise matching version with stored empty retention
keys is re-evaluated through this comparison, replication needlessly copies its metadata.
Replication and resync still complete, so this is cost rather than wrong state. It is inherited
from upstream MinIO, and independent of #111, whose fix does not change the destination's HEAD.
Reproduction and evidence
Unit test over getReplicationAction with a matching source/target pair (same ETag, version id,
size, mtime, content type) so only the lock keys differ. Two cases fail on main. Cases 3 and 4 are
synthetic, since a SILO target cannot put empty retention headers in a HEAD response; 7 and 8 are
guards against over-normalizing.
| # | Source UserDefined |
Target HEAD headers | Expected | On main |
|---|---|---|---|---|
| 1 | no lock keys | no lock keys | none |
none |
| 2 | mode "", date "" (removal, real shape) |
absent | none |
metadata |
| 3 | absent | mode "", date "" (synthetic) |
none |
metadata |
| 4 | mode "", date "" |
mode "", date "" (synthetic) |
none |
none |
| 5 | GOVERNANCE + date |
same | none |
none |
| 6 | GOVERNANCE + date |
absent | metadata |
metadata |
| 7 | mode "", date "" |
GOVERNANCE + date (guard) |
metadata |
metadata |
| 8 | x-amz-meta-foo: "" |
absent (guard) | metadata |
metadata |
A second test shows the target side can never carry the empty keys: with them stored,
FilterObjectLockMetadata(meta, false, false) returns a map without them and setObjectHeaders
emits no lock header. That suppression is for GET and HEAD responses only. The empty entries are
still copied onto the replication wire by getCopyObjMetadata (cmd/bucket-replication.go:730)
and sent by the metadata CopyObject at :1582.
Cost per needless evaluation is a HEAD plus a metadata CopyObject that rewrites xl.meta across
the destination erasure set. No notification is emitted: sendEvent returns early for a trusted
replica (cmd/event-notification.go:244-247, keyed off cmd/handler-utils.go:334-336). One
secondary effect is worse than churn. If the destination bucket does not have Object Lock enabled,
the resend is rejected with InvalidBucketObjectLockConfiguration, because
IsObjectLockRetentionRequested is a presence check and an empty header still counts as a
retention request (cmd/bucket-object-lock.go:255,263-266, returned as a 400 at
cmd/object-handlers.go:1746-1749). Removing the retention is exactly the operation that should
let such a version settle back to COMPLETED; instead it stays FAILED.
Cause and minimal repair
On main f0bd164b9, getReplicationAction at cmd/bucket-replication.go:989-1022 builds
compareMeta1 from oi1.UserDefined, where a removed retention is a present key with an empty
value (stored at cmd/object-handlers.go:3211-3215), and compareMeta2 from oi2.Metadata, the
target's HEAD headers. Two filters keep the empty keys out of that response:
internal/bucket/object/lock/lock.go:611-616 deletes both when the stored mode is not valid, and
cmd/api-headers.go:150-154 skips both when the value is empty. The reflect.DeepEqual at :1020
therefore always reports a difference and returns replicateMetadata, so the replicateNone short
circuit at :1472-1497 never fires. replicateAll at :1353 is the only consumer, reached for
every operation type except the inbound object path (:1108-1113), so the cost lands on metadata
replication, heals of Pending or Failed versions, and existing-object replication or
mc replicate resync (:3472-3481). Frequency is bounded: :3429-3431 keeps a completed version
off the queue, :2769 stops a completed resync from requalifying, and a successful resync records
its reset timestamp at :1455 and persists it at :1143. The header suppression is upstream
cc46a99f9 (minio#14430, 2022-03-01) and the comparison function is byte-identical to
upstream/master 7aac2a2c5.
Minimal repair: in getReplicationAction, skip an entry whose value is empty and whose key is
x-amz-object-lock-mode or x-amz-object-lock-retain-until-date, case-insensitively, in both
comparison loops, using the joined value on the target side. About 14 lines in one function, size
S, sender side only, no wire or storage change, so a fixed source converges against any
destination version. Both sides must be normalized: filtering only the source through
FilterObjectLockMetadata is shorter but measurably regresses case 4 from none to metadata,
which main gets right today. Out of scope: normalizing empty values for other keys, since only
these two are suppressed and an empty x-amz-meta-* is emitted normally at cmd/api-headers.go:198;
deleting the keys at the source on removal, which would not repair versions already written with
the empty pair and so would still need this fix; legal hold, since no handler stores an empty
status; and #111's receiver-side ordering repair.
Acceptance
-
getReplicationActionreturnsreplicateNonefor a source with empty
x-amz-object-lock-modeandx-amz-object-lock-retain-until-dateagainst a target whose
HEAD omits both, and for the reverse. - It still returns
replicateMetadatawhen the source holds a retention the target lacks, when
the target holds a retention the source removed, and when the source has an empty
x-amz-meta-*key the target lacks. - A table-driven unit test in
cmd/bucket-replication_test.gocovers the eight cases above. -
TestReplicationResync,TestReplicatedInfos,TestParseReplicateDecision,
TestCompositeReplicationStatusandTestAPICopyObjectReplicaLegalHoldTimestampstay green.
Related
Noticed while preparing the fix plan for #111 and kept out of its scope. The two are independent:
#111 is a replica losing newer lock state, this is the sender's comparison never converging, and
either fix is correct without the other. S3 documents an empty Retention element as the way to
remove retention from a GOVERNANCE object, so the empty stored value is the expected shape and the
comparison is what must tolerate it. The fix is upstreamable as-is.
Versions and verification
Found during the 2026-09-05 fix-plan triage of #111 on main f0bd164b9 (release
RELEASE.2026-09-03T13-18-01Z / 9b11dc946 for SILO, RELEASE.2026-09-03T07-13-05Z / a2ef95c0
for mcli). Verified by reading the code and by a unit test over getReplicationAction in a
detached worktree at f0bd164b9: red on cases 2 and 3 before the change, green on all eight after,
with the neighbouring replication tests still passing. Agreed with the Codex reviewer (gpt-6-astra)
in one round on defect, priority, root cause, fix approach and minimality, with four wording and
test amendments accepted; the reviewer verified the code and prototype by reading them and did not
run the tests, so every red and green result quoted here is from the author's runs. Priority is P3
rather than P2 because with a correctly configured destination the consequence is repeated work
rather than wrong state, and a completed version is not re-evaluated on an ordinary scanner pass.
Activity
Vonng commentedon Sep 5, 2026
Fix record (2026-09-05)
Status: implemented, reviewed (owner-authorised 4th round), awaiting merge. Pull request: #131 (branch
fix/issue-117-lock-resend-compare, commit05ab4ca47, based on mainf0bd164b9).Escalation resolved. This issue was escalated after three Codex rounds because the agreed 14-line comparison-only fix proved unsafe: a replication target whose credential lacks
s3:GetObjectRetentionreturns a HEAD with no retention even when it holds one, so treating "no retention in HEAD" as in-sync would silently drop a real removal. The owner authorised one more round; round 4 passed.Change (
cmd/bucket-replication.go, +91/-5). Emptyx-amz-object-lock-mode/x-amz-object-lock-retain-until-dateare skipped on both sides ofgetReplicationActionso absent and present-empty compare equal (the original intent).replicationActionForTargetthen confirms a candidate "in sync" removal with a destinationGetObjectRetentionon that narrow path only, treating onlyNoSuchObjectLockConfigurationor a successful nil/empty mode as confirmed-absent; any ambiguous response (denied read, unrecognised mode, orInvalidRequestwhich also signals a destination lock-config read failure) is uncertain and the removal is resent as before. The null-version resync exclusion is preserved via an extracted byte-identical predicate.Tests. The eight-case comparison table (red on the two present-empty cases, green after), plus the permission-filtered HEAD, the
InvalidRequestambiguity, the null-version exclusion, and a test that the target cannot emit empty lock keys. The four replication/decision tests andTestAPICopyObjectReplicaLegalHoldTimestampstay green; gofmt, go vet, golangci-lint clean.Adversarial Codex review (gpt-6-astra). Rounds 1-3 FAIL, each surfacing a distinct way a permission-filtered or error HEAD could be misread as confirmed-absent (the static filter; the null-version exclusion being reopened; the specific missing-config message also meaning a lookup failure). Round 4 PASS, no findings.
Two things for the record. The fix is no longer sender-side only: it adds a conditional destination
GetObjectRetention, and it is effective only when the target credential can read retention, so grantings3:GetObjectRetentionin the replication target policy is now load-bearing (to be documented on silo.pgsty.com).getReplicationActionnow diverges from upstream master. The issue's hope that a lock-disabled destination settles back toCOMPLETEDis not delivered; that case still resends and fails, because the removal cannot be confirmed there.Vonng commentedon Sep 6, 2026
Independent review, 2026-09-06: #131 needs one additional removal representation before this issue can close.
At #131
05ab4ca4755a62ba514dad106d71478004c1d8db,retentionRemovedAtSourceonly recognizes an object-lock mode/date key present with an empty value. But the merged #111 receiver and #134'sapplyReplicatedObjectLock/reconcileStoredObjectLocklegitimately store a removal with both public value keys absent and only the reserved retention timestamp present. #134 already has a sender-options test for this exact timestamp-only representation.When that object is the source of a later heal/resync/next hop, and the destination HEAD hides a real retention because the credential lacks
s3:GetObjectRetention,getReplicationActionreturnsreplicateNone.retentionRemovedAtSourcereturns false, so the new confirmation request is skipped. The removal is silently considered in sync and is not sent.Reproduced in a checkout combining current main
e7d0e62f1with #131 and #134. A focused test constructs the source metadata with the realapplyReplicatedObjectLockremoval helper, uses the existingnewMatchingReplicationPair()fixture and afakeRetentionGetterreturningAccessDenied, then callsreplicationActionForTargetforHealReplicationType:Recognize timestamp-only removal tombstones in the same confirmation path, and cover both a confirmed-absent target and a denied/still-retained target. This does not call for another general replication mechanism. The conditional
GetObjectRetentionitself is justified: HEAD alone cannot distinguish absent retention from permission-filtered retention.The existing #131 regression cases pass, but they only cover the present-empty shape. The missing representation is a P2 state-convergence defect, beyond the original P3 excess-traffic symptom. Keep #117 open; the #111 timestamp persistence is correct and should not be reverted.
[-][P3] Replication never treats an object with removed retention as in sync and re-copies its metadata[/-][+][P2] Retention-removal replication mishandles empty-value and timestamp-only state[/+]fix: treat empty object lock values as absent when comparing
fix: treat empty object lock values as absent when comparing
Vonng commentedon Sep 7, 2026
Resolved by #131 (merged to
mainase27ba2bc1).retentionRemovedAtSourcenow recognizes both representations of a removed Object Lock retention: empty mode/date values, and the timestamp-only tombstone (ObjectLockRetentionTimestamppresent with the mode absent/empty). This stops an object whose retention was removed at the source from being re-replicated indefinitely.Verified: Codex adversarial review (PASS), 7 retention/tombstone unit tests green, full acceptance on merged
main.Deployment-side follow-up (tracked separately): the target replication policy needs
s3:GetObjectRetentionfor the destination-confirmation path; the current minimal policy does not include it.