ChenSammi commented on code in PR #7456:
URL: https://github.com/apache/ozone/pull/7456#discussion_r1915968112


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java:
##########
@@ -56,20 +60,36 @@ public XceiverClientCreator(ConfigurationSource conf, 
ClientTrustManager trustMa
     if (securityEnabled) {
       Preconditions.checkNotNull(trustManager);
     }
+    shortCircuitEnabled = 
conf.getObject(OzoneClientConfig.class).isShortCircuitEnabled();
+    if (shortCircuitEnabled) {
+      domainSocketFactory = DomainSocketFactory.getInstance(conf);
+    }
   }
 
   public boolean isSecurityEnabled() {
     return securityEnabled;
   }
 
+  public boolean isShortCircuitEnabled() {
+    return shortCircuitEnabled && domainSocketFactory.isServiceReady();
+  }
+
   protected XceiverClientSpi newClient(Pipeline pipeline) throws IOException {
+    return newClient(pipeline, null);
+  }
+
+  protected XceiverClientSpi newClient(Pipeline pipeline, DatanodeDetails dn) 
throws IOException {
     XceiverClientSpi client;
     switch (pipeline.getType()) {
     case RATIS:
       client = XceiverClientRatis.newXceiverClientRatis(pipeline, conf, 
trustManager, errorInjector);
       break;
     case STAND_ALONE:
-      client = new XceiverClientGrpc(pipeline, conf, trustManager);
+      if (dn != null) {
+        client = new XceiverClientShortCircuit(pipeline, conf, dn);

Review Comment:
   If the getBlock request fails on local,  BlockInputStream will try to 
fallback to GRPC, which is covered by 
TestShortCircuitChunkInputStream#testFallbackToGrpc(). This covers the missing 
and DN crash case. 
   
   For the file content corrupt case, it will fail the read, just like GRPC 
client. There is no retry for this failure.



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