jojochuang commented on code in PR #7329:
URL: https://github.com/apache/ozone/pull/7329#discussion_r1808082586


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -215,6 +222,28 @@ private OMResponse internalProcessRequest(OMRequest 
request) throws
         //  Added the assertion.
         assert (omClientRequest != null);
         OMClientRequest finalOmClientRequest = omClientRequest;
+
+        ClientInvocationId clientInvocationId = ClientInvocationId.valueOf(
+            
ClientId.valueOf(UUID.nameUUIDFromBytes(ProtobufRpcEngine.Server.getClientId())),
+            ProtobufRpcEngine.Server.getCallId());
+        RetryCache.Entry cacheEntry =
+            
omRatisServer.getServerDivision().getRetryCache().getIfPresent(clientInvocationId);
+        // if this request has been executed before, return the cached result.
+        if (cacheEntry != null) {
+          if (cacheEntry.getReplyFuture().isDone()) {
+            RaftClientReply raftClientReply;
+            try {
+              raftClientReply = cacheEntry.getReplyFuture().get();
+            } catch (ExecutionException ex) {
+              throw new ServiceException(ex.getMessage(), ex);
+            } catch (InterruptedException ex) {
+              Thread.currentThread().interrupt();
+              throw new ServiceException(ex.getMessage(), ex);
+            }
+            return 
OMRatisHelper.getOMResponseFromRaftClientReply(raftClientReply);
+          }
+        }

Review Comment:
   This method is executed by Hadoop RPC server handler (note that client sends 
requests to OM via Hadoop RPC, and the leader creates a raft request out of the 
Hadoop RPC request)



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