Repository navigation
Description
Independent verification update — 2026-09-06, round 2
The final-result drain/persistence acceptance below is verified on the integrated #138 candidate. Keep open until #138 merges. The latest head f8ca4a8656217165a78f3cea09a3c247d483e455 fixes the initial spelling-only lint failure; its product behavior is unchanged from tested 35d9f1824.
Healthy two-object resyncs report both objects and 8,917,248 ciphertext bytes in the first Completed response (~0.2 seconds), without waiting for the one-minute flush. A real quota-rejected missing-target upload reports 1 success / 1 failure immediately and preserves the exact status after source restart. The drain/producer ordering and cancellation-classification tests pass under the race detector.
Boundary: this verifies that every submitted result is persisted, not that every worker result is correctly classified. New #139 demonstrates a persistent false-success result when an existing destination replica rejects an update but still answers HEAD. That is an outcome-classification defect; #137 remains the cancellation follow-up. Do not treat Completed / zero failures as sufficient recovery acceptance until #139 is fixed.
Problem
replicate resync status can report Completed before the last object's counters are persisted. Immediately after a completed two-object resync it reports one object; the second appears only after the periodic one-minute flush. A last failed object can likewise be absent from the completed job's failure counters during this window.
This is separate from #120's inability to repair particular SSE-C replicas. It is an inherited resync-finalization defect in the result consumer / persisted status boundary; #134's HEAD marker does not fix it.
Reproduction
Independent review on 2026-09-06 using server main e7d0e62f16ed8a2373a4e9f5c4639d62886c09f2 plus #134 9e39aad802f0d5a674648fb439411568bc5296c0, and mcli main bec94e4ef47f63d978e57f19091506d2090bd6c6. Two real TLS servers, one server pool each, separate disposable data directories, bucket replication with proxying disabled. Both object versions were readable at source and destination before this control.
- Source bucket has exactly two object versions (
single.txtandmultipart.txt). - Start
mcli replicate resync start SOURCE/BUCKET --remote-bucket ARN. - Read
mcli --json replicate resync status SOURCE/BUCKET --remote-bucket ARNat 3, 33 and 65 seconds.
Observed for the same reset ID and completed timestamp:
| Observation time | Status | replicationCount | completedReplicationSize |
|---|---|---|---|
| 3 seconds | Completed | 1 | 196704 |
| 33 seconds | Completed | 1 | 196704 |
| 65 seconds | Completed | 2 | 8917248 |
The object key in the saved result changes from single.txt to multipart.txt at the final observation. In the earlier damaged-replica test described in #120, the same timing window also exposed Completed with no reported failed object immediately after the sender had logged a failed transfer. This is not a claim that the counters remain wrong after the periodic flush.
Root cause
resyncBucketstarts a separate goroutine that drainsresultChand callsincStats.wg.Wait()waits for the object workers, not for that result-consumer goroutine.- The function sets
resyncStatus = ResyncCompletedand returns. DeferredmarkStatuspersists a completed snapshot before the last counter update necessarily runs. incStatssubsequently changes only in-memory state.ResetBucketReplicationStatusHandlerreadsloadBucketResyncMetadatafrom disk, so it sees the incomplete final snapshot untilPersistToDisk'sresyncTimeInterval = time.Minutetimer saves it.
These paths also exist in unchanged main. The runtime reproduction above used the integrated candidate; provenance on main was checked in source.
Minimal fix / acceptance
Drain/join the result consumer before persisting the final status. Preserve cancellation semantics and do not add polling or a fixed sleep.
- A completed job's first persisted status includes every worker result, including the final failure.
- A deterministic test delays the last
incStatsand verifies completion cannot be published ahead of it. - A two-object live resync immediately reports both objects, without waiting for the periodic flush.
- A failed-object case preserves the failure count across restart after job completion.
P2: misleading recovery/accounting state, especially for automation that treats a completed job's zero failures as acceptance. No observed source-object data loss in this review.
Activity
Vonng commentedon Sep 6, 2026
Fix record — scoped to counter integrity; cancellation robustness → #137
Disposition (maintainer ruling). Over three adversarial rounds the fix expanded from the filed counter-timing bug toward a full resync cancellation rewrite (reaching the site-replication per-bucket cancel token). The maintainer, with a joint trade-off analysis from the Codex reviewer, ruled to narrow #136 to counter integrity and track the inherited cancellation defects separately in #137 — the same pattern as #120→#133. Decision memo: the analysis compared narrow-plus-follow-up vs. fixing the whole cancellation architecture now, and both the maintainer and Codex converged on narrowing.
Fix (PR #138, branch
fix/issue-136-resync-counter-flush). Two counter-integrity problems:incStats) was not joined before the deferredmarkStatus, soCompletedcould persist an under-count until the ~1m flush.Completedeven when work was dropped — parent context cancelled mid-drain, or a worker consuming the resync-cancel token and returning without submitting its computed result.Resolution: a
resyncResults/finish()helper drains before persist (close worker inputs → join workers → close results → join consumer → persist; runs on every exit); andfinalResyncStatusdowngrades a tentativeCompletedtoFailedwhen the parent context was cancelled or a worker aborted (recorded bysendResyncResult). The inherited cancellation mechanisms (Walk(ctx)inline, thedefault:blocking dispatch send, workerresyncCancelChbranches,site-replication.go) are deliberately unchanged and moved to #137.Adversarial review. Codex Astra 6 (Max) recommended exactly this minimal set for the narrowed scope, then reviewed the implementation: VERDICT PASS — ordering correct, parent-context recheck and worker-abort safeguard correct, helper extractions behavior-preserving, #137 mechanisms byte-identical with no residue.
Local:
gofmt/go vet/go buildclean;-raceclean;-run 'Resync' -count=1passes; red-on-revert confirmed for each wait and downgrade term. Keeping this issue open until PR #138 is merged (CI on the pushed head).fix(replication): keep resync Completed status honest about object co…
Vonng commentedon Sep 7, 2026
Resolved by #138 (merged to
mainas8a1f594ad).resyncBucketno longer persistsCompletedbefore the final object counters are drained:resyncResults/finish()drain before persist, andfinalResyncStatusdowngradesCompleted→Failedwhen the parent context errored or a worker aborted while draining. The cancellation architecture was intentionally left untouched.This is the narrowed scope selected as Option A; the broader cancellation-robustness work is tracked in #137.
Verified: Codex adversarial review (narrowed PASS), deterministic red/green under
testing/synctest, full acceptance on mergedmain.