Skip to content

[P2] Resync counts an existing replica as successful even when its update failed #139

Closed

Description

@Vonng

Problem

An existing destination version is counted as a successful resync even when its update failed. A completed job can persist 2 successful objects / 0 failures while both source versions report FAILED and both destination versions still hold the old tags. Restart preserves the misleading result.

This is distinct from #136's final-result flush race and #137's cancellation routing. Joining the result consumer in #138 fixes the flush race, but the worker still generates its result from destination existence, ignoring the replication operation's outcome. It is a within-scope single-pool case, unrelated to #133.

Independent reproduction (2026-09-06)

Candidate: main e7d0e62f16ed8a2373a4e9f5c4639d62886c09f2 plus #134 79ca3659652ec452fcc764544a467fda31f4fafe, #131 0192c73d850743d62cc1391537560b17e7adc583, #138 35d9f1824d3de0d368d7f157be4decf445ab645f, and unchanged #132 0db4bf3b00185fcc053a6ae30a2bbbe69ae8317c. Product patches combine cleanly; only the additive #131/#138 test-file conflict was joined. mcli: bec94e4ef47f63d978e57f19091506d2090bd6c6. The refreshed #138 head f8ca4a8656217165a78f3cea09a3c247d483e455 differs only in comments/test error-message spelling, with identical product behavior. Two real loopback TLS SILO servers, separate disposable data, one erasure set each, replication proxying disabled.

  1. Replicate two readable SSE-C versions, one single PUT (196,608 plaintext bytes) and one multipart object (8,716,288 plaintext bytes). Both destinations initially have tag round=two.
  2. Set the destination bucket's hard quota to 100 KiB, below either retransmit size.
  3. Change both source versions' tags to round=blocked. The source correctly logs Bucket quota exceeded and reports x-amz-replication-status: FAILED; destination tags stay round=two.
  4. Start mcli replicate resync start SOURCE/BUCKET --remote-bucket ARN and read the first terminal status.

Observed after 0.182 seconds:

{
  "resetid": "5199aff7-b4fa-4727-b19e-1fb119a020b2",
  "resyncStatus": "Completed",
  "completedReplicationSize": 8917248,
  "replicationCount": 2
}

failedReplicationCount is omitted because it is zero. Both source versions still report FAILED; both destination tags are still stale. Restarting the source gives the identical persisted status and reset ID. Control: clear only the disposable destination quota and resync the same versions; both tags then converge to round=blocked, source statuses become COMPLETED, and source/destination plaintext matches.

A separate missing-destination control correctly reports 1 success / 1 failure immediately, and that failure count survives restart. The missing-destination case therefore does not test this gap.

Root cause and provenance

In resyncBucket, replicateObject(ctx, roi, objectAPI) returns no result. The subsequent tgt.StatObject success unconditionally increments ReplicatedCount / ReplicatedSize. An old destination version satisfies HEAD even when this resync failed to update it.

The existence-based accounting is inherited from main. #134's internal SSE-C accounting HEAD now permits that HEAD to succeed for a healthy SSE-C replica, exposing the same false-success path for SSE-C updates. Reverting the marker would incorrectly label successful SSE-C work as failed; it is not the fix. #138 then correctly persists the result it was given, but that result is wrong.

The unit test in #138 injects already-classified success/failure values into the sink. It proves draining and persistence; it cannot establish that real workers classify their operations correctly.

Bounded fix / acceptance

Use the replication outcome for the selected target ARN, with explicit treatment of skipped/indeterminate work. Do not infer successful repair from HEAD existence or from an aggregate outcome across unrelated targets. Keep this separate from the cancellation and multi-pool architecture work.

  • An existing SSE-C replica whose PUT or multipart update is rejected is counted as failed, even though HEAD succeeds; no successful bytes credited to that failed update.
  • A real missing-target failure remains counted and a successful update remains successful.
  • The first persisted terminal counts are accurate and remain accurate after restart.
  • Multi-target results are attributed to the requested ARN.
  • Preserve deliberate null-version exclusions and deletion semantics.
  • Cover a real worker or end-to-end path, not only injected sink counters.

The same real missing-target control also reports zero failed bytes for a 196,608-byte failed object: the worker increments FailedCount but never FailedSize. Populate the failure-byte field from the same outcome, with a documented size convention.

P2: misleading recovery acceptance and automation; no source data loss observed. Until fixed, Completed with zero failures is not sufficient evidence that resync repaired or updated replicas. Check the source replication status and destination data/metadata for recovery acceptance.

Activity

  1. added
    bug
    on Sep 6, 2026
  2. Vonng commented on Sep 6, 2026

    @Vonng
    MemberAuthor

    Fix record — classify by replication outcome; PR #140

    Root cause (confirmed). The resync worker counted success by whether the target version merely existed (tgt.StatObject), ignoring the outcome of the replicateObject/replicateDelete it had just run. A quota-rejected update leaves the old version in place → false success (persisted across restart); #134's SSE-C internal HEAD marker exposed it for SSE-C; the delete path had the mirror flaw; FailedSize was never incremented.

    Fix (PR #140, stacked on #138). replicateObject/replicateDelete now return their per-target replicatedInfos; the worker classifies via pure helpers resyncResultFor/resyncTargetSucceeded using the opts.arn target's own outcome — object/delete success needs ReplicationStatus == Completed (tolerating only the benign duplicate 412), version-purge success needs VersionPurgeStatus == VersionPurgeComplete; failed/errored/absent → failure with FailedSize recorded. The StatObject heuristic is removed; #134's SSE-C marker and the non-resync callers are untouched.

    Adversarial review. Codex Astra 6 (Max), 2 rounds → VERDICT PASS. Round 1 caught two over-strict misclassifications (successful version purge; benign 412), both fixed and covered by red/green tests; round 2 confirmed all result shapes classify correctly.

    Deferred (agreed with Codex): cross-ARN dispatch scoping → follow-up #141 (the resync worker is fed by an any-target mustResync, so a cross-ARN object is conservatively counted a failure — no false success). The compressed/encrypted byte-size approximation is a pre-existing accounting nuance, unchanged.

    Local: gofmt/go vet/go build/-race clean; TestResyncResultFor (10 cases) + full -run 'Resync' -count=1 pass. Keeping open until PR #140 merges (CI on the pushed head).

  3. moved this from Backlog to In progress in Siloon Sep 6, 2026
  4. Vonng commented on Sep 6, 2026

    @Vonng
    MemberAuthor

    2026-09-06 verification update: #140 at 46e82eb54df3e8e420ebe421335f613e5b0de681 fixes this issue's reproduced failure. With two existing SSE-C replicas and quota-rejected updates, the first terminal resync record now reports 0 successful / 2 failed, retains those counters after source restart, and becomes 2 successful / 0 failed after clearing the quota and successfully reconciling both replicas. Plaintext, tags and source replication status were checked independently of the counters.

    The complete integration/test evidence is posted on #140. Keep this issue open until #140 is merged; the remaining per-ARN dispatch problem is tracked by #141 and does not invalidate the outcome-classification fix.

  5. moved this from In progress to Done in Siloon Sep 6, 2026
  6. Vonng commented on Sep 7, 2026

    @Vonng
    MemberAuthor

    Resolved by #140 (merged to main as 58b0ee36c).

    The resync worker no longer infers success from "the target object exists" (tgt.StatObject). replicateObject/replicateDelete now return their per-target replicatedInfos, and the worker classifies each object from the real outcome for opts.arn via resyncResultFor/resyncTargetSucceeded: object/delete require ReplicationStatus==Completed (only an idempotent 412 PreconditionFailed is tolerated), version purge requires VersionPurgeStatus==VersionPurgeComplete. Quota-rejected updates and failed deletes are now counted as failures with FailedSize accrued; the StatObject heuristic is removed.

    Verified: Codex adversarial review (2 rounds; R1 caught two over-strict cases — a successful purge and an idempotent 412 — both fixed with red/green), full acceptance on merged main. Cross-ARN dispatch scoping was split to #141.

  7. self-assigned this
    on Sep 15, 2026
  8. added theissue type on Sep 15, 2026
  9. added this to the 20260916 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