imbajin commented on code in PR #3383:
URL: https://github.com/apache/hugegraph/pull/3383#discussion_r4337198654


##########
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/KvServiceGrpcImpl.java:
##########
@@ -158,6 +158,12 @@ public void get(K request, StreamObserver<KResponse> 
responseObserver) {
         KResponse response;
         KResponse.Builder builder = KResponse.newBuilder();
         try {
+            /*
+             * A leader elected a moment ago may not have applied every 
committed write yet,
+             * and a Server that read such a value would cache schema older 
than a revision it
+             * acknowledged: read after a ReadIndex barrier.
+             */
+            RaftEngine.getInstance().waitReadIndex();

Review Comment:
   ⚠️ Important: `waitReadIndex()` blocks the calling gRPC worker for up to 
`raft.rpc-timeout` (10 seconds by default), and both new reads use the shared 
PD `hg-grpc` executor. With the default 600 core workers and an 
`Integer.MAX_VALUE` queue, 600 concurrent `get`/`scanPrefix` calls stalled by a 
quorum loss can occupy every worker while unrelated PD RPCs pile up. Please 
bound or isolate these waits so a burst of ReadIndex failures cannot starve the 
rest of the PD services. Evidence: `GRpcServerConfig.configure` installs 
`HgExecutorUtil` for the server, `PDConfig.ThreadPoolGrpc` defaults to 600 core 
workers and a queue of `Integer.MAX_VALUE`, and `RaftEngine.waitReadIndex()` 
waits synchronously for the configured timeout.



-- 
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]

Reply via email to