chihsuan commented on code in PR #10633:
URL: https://github.com/apache/ozone/pull/10633#discussion_r3551607446


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java:
##########
@@ -190,25 +193,28 @@ protected List< OmKeyLocationInfo > 
allocateBlock(ScmClient scmClient,
       ReplicationConfig replicationConfig, ExcludeList excludeList,
       long requestedSize, long scmBlockSize, int preallocateBlocksMax,
       boolean grpcBlockTokenEnabled, String serviceID, OMMetrics omMetrics,
-      boolean shouldSortDatanodes, UserInfo userInfo)
+      boolean shouldSortDatanodes, UserInfo userInfo, KeyManager keyManager)
       throws IOException {
     int dataGroupSize = replicationConfig instanceof ECReplicationConfig
         ? ((ECReplicationConfig) replicationConfig).getData() : 1;
     int numBlocks = (int) Math.min(preallocateBlocksMax,
         (requestedSize - 1) / (scmBlockSize * dataGroupSize) + 1);
 
-    String clientMachine = "";
-    if (shouldSortDatanodes) {
-      clientMachine = userInfo.getRemoteAddress();
-    }
+    final boolean sortOnOm =
+        shouldSortDatanodes && keyManager.isSortDatanodesForWriteEnabled();
+    // When SCM sorts, it still needs the real client address; the OM-sort path
+    // sends an empty address so SCM skips its sort.
+    final String scmClientMachine =
+        (shouldSortDatanodes && !sortOnOm) ? userInfo.getRemoteAddress() : "";
+    final String omClientMachine = sortOnOm ? userInfo.getRemoteAddress() : "";

Review Comment:
   Thanks for the suggestion, addressed in 
https://github.com/apache/ozone/pull/10633/changes/16086e2b30d983938df8b632fb3a78cfa82a1642



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