[Store] Avoid blocking HA reattachment on master connection retries - #3743
Open
waizuichougou wants to merge 3 commits into
Open
[Store] Avoid blocking HA reattachment on master connection retries#3743waizuichougou wants to merge 3 commits into
waizuichougou wants to merge 3 commits into
Conversation
waizuichougou
requested review from
XucSh,
YiXR,
stmatengss and
ykwd
as code owners
August 28, 2026 00:26
waizuichougou
marked this pull request as draft
August 28, 2026 00:27
waizuichougou
marked this pull request as ready for review
August 28, 2026 00:55
1 task
Collaborator
|
Disabling connection retries cannot fix the underlying problem; it only reduces the stall from multiple attempts to one and may make initial connections less resilient. |
Contributor
Author
waizuichougou
marked this pull request as draft
August 28, 2026 09:58
Collaborator
|
Thanks for your quick reply. |
waizuichougou
force-pushed
the
fix-ha-master-connect-retry
branch
from
August 30, 2026 03:21
f215641 to
379cdc0
Compare
waizuichougou
marked this pull request as ready for review
August 30, 2026 06:09
waizuichougou
requested review from
00fish0,
Aionw,
Icedcoco,
Libotry,
ShangmingCai,
UNIDY2002,
alogfans and
staryxchen
as code owners
August 30, 2026 06:09
waizuichougou
marked this pull request as draft
August 30, 2026 06:15
waizuichougou
marked this pull request as ready for review
August 30, 2026 06:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix the HA client reattachment stall reported in #3740.
Related to #3740.
The failure has two independent causes that must both be addressed:
before the RPC listener is ready. A client can therefore observe the new
endpoint during the startup window and receive a connection reset. In the
reported logs, the leader monitor switched to the new address about 0.73
seconds before the service started accepting connections.
connection policy: a 30-second connect timeout with three retries. If the
deleted Pod IP silently drops SYN packets, one Ping can block for about 120
seconds. This matches the four reported failover gaps of approximately
121.001 seconds.
This change fixes the readiness race while preserving leadership fencing:
__mooncake_service_warming__:<lease-id>value into the existing,lease-bound
master_viewkey.listener, so another master cannot acquire leadership during warmup while
clients also cannot mistake the warming value for a ready endpoint.
registration, leadership renewal, and
async_start()have completed.warming value and preserves the existing lease. This prevents a stale or
former leader from publishing itself.
publication fails, the RPC server is stopped and the supervisor returns to
standby.
This change also separates initial connection behavior from HA runtime
behavior:
30-second connection timeout and three retries. This preserves resilience
while the cluster is initially starting.
heartbeat and leader monitor start. Runtime connections use zero retries, no
retry wait, and a one-second default connection timeout.
MC_RPC_CONNECT_TIMEOUT_MScontinues to override the default timeout.Existing calls retain their previous pool instance, while subsequent calls
use the runtime policy.
connection behavior.
The change additionally prevents a stale empty
master_viewwatch event fromclearing a newer view installed concurrently by the heartbeat path.
The warming value deliberately uses the same lease-bound election key instead
of a separate unprotected readiness key. This keeps election ownership and
readiness as distinct states while preserving the existing fencing and rolling
upgrade behavior.
Module
mooncake-transfer-engine)mooncake-store)mooncake-reshard)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Build:
RPC connection-policy tests:
Results:
reconfiguration.
HA readiness and fencing tests:
Run against a real etcd 3.5.21 instance on
127.0.0.1:2379:GTEST_FILTER='HighAvailabilityTest.*' \ GTEST_COLOR=no \ build/mooncake-store/tests/high_availability_test \ --etcd_endpoints=127.0.0.1:2379Results:
lease preservation, stale-publication rejection, idempotent publication,
leadership-loss serialization, legacy contender fencing, and the stale
empty-view race.
Repository checks:
Checklist
./scripts/code_format.shoption or API is introduced)
AI Assistance Disclosure
OpenAI Codex assistance was used for preparing the minimal change and regression test.