Skip to content

ClusterManager.DistributeOperation counts a failed operation as successful #269

Closed

Description

@scttfrdmn

The defect

executeEventualConsistency returns (result, nil) unconditionally
(internal/distributed/coordinator.go:461), including when result.Success is false. The same
shape holds for the session path. ClusterManager.DistributeOperation
(internal/distributed/cluster.go:389-395) then classifies on the error alone:

cm.stats.TotalOperations++
if err != nil {
    cm.stats.FailedOps++
} else {
    cm.stats.SuccessfulOps++
}

So an operation that failed on every node is recorded as a success. ExecuteOperation returns a
non-nil *OperationResult with Success: false and an Error string, which a caller checking only
err will not see.

How it shows up

tests/distributed_test.go:TestConcurrentOperations (behind -tags=distributed) currently prints
both of these in the same run:

distributed_test.go:515: Failed 10 out of 10 concurrent operations
distributed_test.go:524: Concurrent test completed - Total ops: 10, Successful: 10, Failed: 0

Ten operations failed with no backend configured, and the statistics the test then reads back say
ten succeeded and none failed. The test is right to fail; what it is catching is the counter, not
its own setup. (It also never injects a backend, so executeLocally takes its
c.backend == nil arm — that part is a test gap, and worth fixing in the same change so the
assertion covers a real operation rather than a misconfiguration.)

Why it matters

The counters are what an operator reads to decide whether coordination is working. A cluster where
every distributed operation fails and SuccessfulOps climbs steadily is worse than one with no
metrics: it actively argues against investigating. This is the same "success reported for failure"
class as the GetObjects and DeleteObject findings from the audit.

Fix

Have the consistency executors return an error when the result is not successful, so the error and
result.Success cannot disagree — or, if a partial success must stay a non-error, classify in
DistributeOperation on result.Success rather than on err. Whichever way, the two must not be
able to contradict each other. Add a test asserting that a failed operation increments FailedOps
and not SuccessfulOps.

Related

Found while adding gossip authentication (#206), which is why the -tags=distributed suite was
compiled at all — see also #240, since no CI job builds that tag and this failure has been sitting
there unobserved.

Activity

  1. added
    type: bug
    priority: high
    area: distributed
    area: tests
    on Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: distributedarea: testspriority: hightype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions