Skip to content

V22 add consul retry - #910

Draft
sbaker617 wants to merge 5 commits into
slack-22.0from
v22-add-consul-retry
Draft

V22 add consul retry#910
sbaker617 wants to merge 5 commits into
slack-22.0from
v22-add-consul-retry

Conversation

@sbaker617

Copy link
Copy Markdown

Description

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

AI Disclosure

@github-actions github-actions Bot added this to the v22.0.4 milestone Aug 12, 2026
sbaker617 and others added 5 commits August 12, 2026 18:38
Introduces a kvClient interface wrapper (retryKV) that transparently
retries consul KV operations on transient network errors and 5xx
responses. Configurable via flags, enabled by default.

Covers Get, List, Keys, Txn — all operations used by file.go,
directory.go, watch.go, and election.go. Lock lifecycle operations
are intentionally not retried.

Flags:
  --topo_consul_retry_count (default 3)
  --topo_consul_retry_base_delay (default 250ms)
  --topo_consul_retry_max_delay (default 5s)
  --topo_consul_retry_enabled (default true)

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Signed-off-by: Steve Baker <s.baker@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Signed-off-by: Steve Baker <s.baker@slack-corp.com>
rand.Int64N(0) panics if baseDelay is set to 0 via flag. Return
zero duration immediately when the computed delay is non-positive.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Signed-off-by: Steve Baker <s.baker@slack-corp.com>
Replace time.Sleep with a select on ctx.Done and time.After so that
retries abort promptly when the caller's context is canceled or
expired. Pass context from callers in file.go, directory.go, and
election.go via QueryOptions so the retry loop can observe it.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Signed-off-by: Steve Baker <s.baker@slack-corp.com>
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>
@sbaker617
sbaker617 force-pushed the v22-add-consul-retry branch from 778c813 to d61e4eb Compare August 12, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant