imbajin commented on code in PR #3210:
URL: https://github.com/apache/hugegraph/pull/3210#discussion_r4033046032
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -482,6 +495,82 @@ private HugeGraph createSysGraphIfNeed() {
return graph;
}
+ private void waitForActiveStores() {
+ int timeout = this.conf.get(ServerOptions.PD_STORES_WAIT_TIMEOUT);
+ if (timeout <= 0) {
+ return;
+ }
+ PDConfig pdConfig = PDConfig.of(this.pdPeers);
+ pdConfig.setAuthority(PdMetaDriver.PDAuthConfig.service(),
+ PdMetaDriver.PDAuthConfig.token());
+ // same short-lived client as limitStorage(); PDClient has no close()
+ PDClient pdClient = PDClient.create(pdConfig);
+ try {
+ Metapb.PDConfig pd = pdClient.getPDConfig();
Review Comment:
⚠️ Blocking: no. `pd.stores_wait_timeout` is not an upper bound for this
startup wait. `PDConfig.of(this.pdPeers)` keeps the PD client's default
60-second gRPC deadline, so `getPDConfig()` here and each `getActiveStores()`
call inside `waitForStores()` can block for up to 60s; the supplier is invoked
before the deadline check as well. With `pd.stores_wait_timeout=20` and a
black-holed PD, startup can stall well past 20s. Please propagate a per-call
deadline bounded by the remaining wait budget (or otherwise time-bound the RPC)
and add a delayed/unreachable-PD test.
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -482,6 +495,82 @@ private HugeGraph createSysGraphIfNeed() {
return graph;
}
+ private void waitForActiveStores() {
+ int timeout = this.conf.get(ServerOptions.PD_STORES_WAIT_TIMEOUT);
+ if (timeout <= 0) {
+ return;
+ }
+ PDConfig pdConfig = PDConfig.of(this.pdPeers);
+ pdConfig.setAuthority(PdMetaDriver.PDAuthConfig.service(),
+ PdMetaDriver.PDAuthConfig.token());
+ // same short-lived client as limitStorage(); PDClient has no close()
+ PDClient pdClient = PDClient.create(pdConfig);
Review Comment:
⚠️ Blocking: no. `PDClient.create()` is not a one-shot client: the first
`getPDConfig()` call enters `newBlockingStub()`, which invokes `startWatch()`
and opens the watch streams. This local client is discarded after the wait,
while `PDClient` exposes no shutdown (`closeStub()` even notes that the managed
channel is not closed), so every `usePD` startup leaves an unused watcher set
for the process lifetime. Please use a closable one-shot stub or retain and
close this client from the GraphManager lifecycle.
--
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]