Skip to content

refactor(shard-distributor): centralize ETCD client and config in etcdclient package#7838

Merged
jakobht merged 2 commits intocadence-workflow:masterfrom
jakobht:use-etcdfx-session-wrapper
Mar 23, 2026
Merged

refactor(shard-distributor): centralize ETCD client and config in etcdclient package#7838
jakobht merged 2 commits intocadence-workflow:masterfrom
jakobht:use-etcdfx-session-wrapper

Conversation

@jakobht
Copy link
Member

@jakobht jakobht commented Mar 20, 2026

What changed?

Centralizes ETCD client creation, config parsing, and session management into the etcdclient package. The etcdclient.Client interface now includes Close() and NewSession() methods, with a clientWrapper implementation. Config types (BaseConfig, ExecutorStoreConfig, LeaderStoreConfig) and a shared NewClientFromConfig provider are added. The etcd/module.go wires named clients (executorstore, leaderstore) via fx.

This removes duplicated client creation and config parsing from executorstore and leaderstore, and eliminates leaderstore's direct dependency on *clientv3.Client.

Re-land of #7799, which was reverted in #7817. This version also includes the config centralization refactor on top.

Why?

  • Reduces duplication: both stores had near-identical client creation and config parsing logic.
  • Makes the Client interface mockable for session-based operations (leader election), improving testability.
  • Prepares for future stores that need an ETCD client by providing a single provider.

How did you test it?

  • All existing unit tests pass (go test ./service/sharddistributor/store/etcd/... -count=1).
  • New tests for config parsing in etcdclient/config_test.go.

Potential risks

Low — this is an internal refactor with no behavior changes. The fx wiring is the main area to watch.

Release notes

None

Documentation Changes

None

jakobht added 2 commits March 18, 2026 12:47
Signed-off-by: Jakob Haahr Taankvist <jht@uber.com>
…ient

Move config types and parsing to etcdclient package:
- Add BaseConfig with common fields (endpoints, dialTimeout, prefix)
- Add ExecutorStoreConfig and LeaderStoreConfig extending BaseConfig
- Parse configs once via FX, eliminating double-parsing
- Rename LeaderCfg to SDConfig in tests for clarity

Signed-off-by: Jakob Haahr Taankvist <jht@uber.com>
@gitar-bot
Copy link

gitar-bot bot commented Mar 20, 2026

🔍 CI failure analysis for 42437db: Network connectivity issue during CI initialization—DNS resolution failure when downloading protoc prevented the build from starting; unrelated to the refactoring changes.

Overview

One CI log analyzed across 1 job. The failure is a transient infrastructure issue occurring during build initialization, not related to the PR's code changes (etcdclient refactoring).

Failures

Network DNS Resolution Failure During Build Initialization (confidence: high)

  • Type: infrastructure
  • Affected jobs: 67928399869
  • Related to change: no
  • Root cause: DNS resolution failure when attempting to download protoc 3.14.0 from github.com. The error curl: (6) Could not resolve host: github.com occurred during the Makefile build phase (line 256, .bin/protoc target) before any actual code compilation or linting.
  • Suggested fix: Retry the CI build. This is a transient network/DNS issue on the runner, not caused by code changes. If it persists, verify the GitHub Actions runner's network and DNS connectivity, or consider adding retry logic or cached protoc artifacts.

Summary

  • Change-related failures: 0 — No failures related to the shard-distributor refactoring
  • Infrastructure/flaky failures: 1 — Transient DNS/network issue during build tool download
  • Recommended action: Retry the CI build. The failure is unrelated to the etcdclient package centralization changes in this PR.
Code Review ✅ Approved

Centralizes ETCD client and configuration management in a dedicated etcdclient package, improving code organization and maintainability. No issues found.

Rules ✅ All requirements met

Repository Rules

GitHub Issue Linking Requirement: PR description references valid cadence-workflow issue links (#7799 and #7817).
PR Description Quality Standards: All required sections are present and substantive, covering what changed, why, how it was tested, potential risks, and release notes.

1 rule not applicable. Show all rules by commenting gitar display:verbose.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@jakobht jakobht merged commit ab8ee72 into cadence-workflow:master Mar 23, 2026
58 of 59 checks passed
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.

2 participants