Skip to content

Commit 778c813

Browse files
sbaker617Claude
andcommitted
consultopo: document CAS retry limitation on Txn
A retried CAS transaction can return a spurious conflict if the original commit succeeded but the response was lost. Document that this is inherent and not worse than the no-retry baseline. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Steve Baker <s.baker@slack-corp.com>
1 parent d57d4c9 commit 778c813

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

go/vt/topo/consultopo/retry.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ func (r *retryKV) Keys(prefix string, separator string, q *api.QueryOptions) ([]
101101
return keys, meta, err
102102
}
103103

104+
// Txn retries transient errors, which means a CAS transaction that commits on
105+
// the server but whose response is lost (e.g. TCP RST) will be re-submitted.
106+
// The second attempt will observe the already-written state and return a
107+
// consul-level conflict (manifesting as NodeExists, BadVersion, or NoNode to
108+
// callers). This is the same outcome as no retry layer at all — the lost
109+
// response would surface as a network error, and the caller's own retry would
110+
// hit the same conflict — so retrying here doesn't worsen the window.
104111
func (r *retryKV) Txn(txn api.KVTxnOps, q *api.QueryOptions) (bool, *api.KVTxnResponse, *api.QueryMeta, error) {
105112
var ok bool
106113
var resp *api.KVTxnResponse

0 commit comments

Comments
 (0)