You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Data Size: n/a, the problem is in cluster membership, not data
Expected & Actual behavior (期望与实际表现)
Expected. A PD that cannot take part in raft (no leader, or fewer than a quorum of members reachable) should not report itself as ready. Anything that gates on PD health, whether a Store waiting to register, wait-storage.sh on the Server, or a Kubernetes readiness probe, should be held back until the PD can actually serve.
Actual./v1/health answers 200 as soon as the Spring listener is up and never consults the raft state. In hugegraph-pd/hg-pd-service/.../rest/StoreAPI.java:
Measured on a 3-PD cluster after deleting two of the three PD pods: the survivor logged Raft lost leader within one second of the fault and then kept answering 200 to /v1/health on every one of 26 samples over about 166 seconds, while calls that need a leader failed for roughly 50 seconds until the replacements rejoined. Same process, same second, two different answers.
Everything that consumes /v1/health inherits the mismatch:
In the Helm chart, the startup, readiness and liveness probes on both PD and Store, and the Store init gate that waits for a quorum of PDs. That gate can release Stores against a PD that has no leader.
I looked for something else to build a real gate on and did not find an unauthenticated option:
/actuator/prometheus exposes hg_up, hg_stores, hg_terms and hg_graphs. There is no leader flag and no member count, and hg_terms read 0 on a live leader, so it cannot stand in for one.
/v1/members does carry what is needed (pdLeader with role and state, plus the member list) but it sits behind the REST auth interceptor. A kubelet probe cannot send a credential and should not have to.
Proposal
Any of these would close the gap, listed in order of how little they change:
Make /v1/health return a non-2xx status when the local node has no raft leader or is not part of a quorum. This is the smallest change but it turns a liveness signal into a readiness one, which may not be what every caller wants.
Keep /v1/health as pure liveness and add an unauthenticated /v1/ready (or /v1/health?ready=true) that returns 200 only when the node has a leader and is inside a quorum. The Helm chart and wait-storage.sh would switch to it.
Independently of 1 or 2, add a raft leader gauge (1 on the leader, 0 elsewhere) and a reachable-member count to the actuator metrics so operators can alert on quorum loss.
Option 2 plus 3 seems like the right shape. Happy to send a PR for whichever direction is preferred.
Bug Type (问题类型)
logic (逻辑设计问题)
Before submit
Environment (环境信息)
hugegraph/pdbuilt from the same commitExpected & Actual behavior (期望与实际表现)
Expected. A PD that cannot take part in raft (no leader, or fewer than a quorum of members reachable) should not report itself as ready. Anything that gates on PD health, whether a Store waiting to register,
wait-storage.shon the Server, or a Kubernetes readiness probe, should be held back until the PD can actually serve.Actual.
/v1/healthanswers 200 as soon as the Spring listener is up and never consults the raft state. Inhugegraph-pd/hg-pd-service/.../rest/StoreAPI.java:Measured on a 3-PD cluster after deleting two of the three PD pods: the survivor logged
Raft lost leaderwithin one second of the fault and then kept answering200to/v1/healthon every one of 26 samples over about 166 seconds, while calls that need a leader failed for roughly 50 seconds until the replacements rejoined. Same process, same second, two different answers.Everything that consumes
/v1/healthinherits the mismatch:bin/wait-storage.shon the Server (after fix(server): retry all PD peers while waiting for storage #3129 it retries every peer, which fixed the fail-over, but a 200 from any peer still counts as "PD is up").I looked for something else to build a real gate on and did not find an unauthenticated option:
/actuator/prometheusexposeshg_up,hg_stores,hg_termsandhg_graphs. There is no leader flag and no member count, andhg_termsread 0 on a live leader, so it cannot stand in for one./v1/membersdoes carry what is needed (pdLeaderwithroleandstate, plus the member list) but it sits behind the REST auth interceptor. A kubelet probe cannot send a credential and should not have to.Proposal
Any of these would close the gap, listed in order of how little they change:
/v1/healthreturn a non-2xx status when the local node has no raft leader or is not part of a quorum. This is the smallest change but it turns a liveness signal into a readiness one, which may not be what every caller wants./v1/healthas pure liveness and add an unauthenticated/v1/ready(or/v1/health?ready=true) that returns 200 only when the node has a leader and is inside a quorum. The Helm chart andwait-storage.shwould switch to it.Option 2 plus 3 seems like the right shape. Happy to send a PR for whichever direction is preferred.
Related
wait-storage.shsticking to one peer. This issue is the remaining half: the signal it now polls on every peer does not mean what the script needs it to mean./v1/healthuntil a quorum-aware endpoint exists.