imbajin commented on code in PR #3362:
URL: https://github.com/apache/hugegraph/pull/3362#discussion_r4332041814
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java:
##########
@@ -415,6 +507,24 @@ public void shutdown() {
}
}
+ private void reportOffline() {
+ if (fatalExitRequested.get() || storeInfo == null) {
+ return;
+ }
+ storeInfo.setState(Metapb.StoreState.Offline);
+ if (storeInfo.getId() == 0 || pdProvider == null ||
+ pdProvider.getPDClient() == null) {
+ return;
+ }
+ try {
+ // Older PDs reject this dedicated RPC; never fall back to
administrative Offline.
+ pdProvider.getPDClient().reportStoreShutdown(storeInfo.getId());
Review Comment:
⚠️ Important. Blocking: no. Summary: This best-effort report blocks the
shutdown hook for the PD client's default 60-second deadline before teardown
can continue. Evidence: PDClient.getStub applies PDConfig.grpcTimeOut (60,000
ms) to this call; with an unresponsive PD, this can exceed a shorter
termination grace window. Please use a shorter shutdown-specific deadline so
lease expiry remains the prompt fallback.
##########
hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/StoreNodeService.java:
##########
@@ -329,6 +337,18 @@ public synchronized Metapb.Store updateStore(Metapb.Store
store) throws PDExcept
return store;
}
+ public synchronized Metapb.Store reportStoreShutdown(long storeId) throws
PDException {
+ Metapb.Store current = getStore(storeId);
+ if (current.getState() != Metapb.StoreState.Up) {
+ return current;
+ }
+ Metapb.Store offline =
current.toBuilder().setState(Metapb.StoreState.Offline).build();
+ storeInfoMeta.updateStore(offline);
Review Comment:
⚠️ Important. Blocking: no. Summary: This updates only the canonical Store
record and leaves the TTL active-store entry's serialized state as Up.
Evidence: StoreInfoMeta.updateStore writes the canonical key, while
getActiveStores reads the separate TTL key and
getAllStores(excludeOfflineStores=true) returns it. Please filter active API
results against canonical state while retaining the lease for liveness
accounting.
##########
helm/hugegraph/templates/store-statefulset.yaml:
##########
@@ -153,6 +153,11 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
+ - name: HG_PD_AUTH_SECRET_KEY
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "hugegraph.pd.authSecretName" . | quote }}
Review Comment:
⚠️ Important. Blocking: no. Summary: Store Pods now read the PD auth Secret,
but the pod template has no checksum for that Secret, so a Secret rotation
leaves already-running Stores with the old value. Evidence: this Secret-backed
env is added here; the Store template renders only configured podAnnotations.
Please include the resolved PD auth checksum in the Store pod template so
rotation rolls Stores and shutdown reports use the new credential.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]