ivandika3 commented on code in PR #9796:
URL: https://github.com/apache/ozone/pull/9796#discussion_r2850700708


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -216,44 +221,152 @@ public OMRequest getLastRequestToSubmit() {
 
   private OMResponse submitReadRequestToOM(OMRequest request)
       throws ServiceException {
-    // Read from leader or followers using linearizable read
-    if (ozoneManager.getConfig().isFollowerReadLocalLeaseEnabled() &&
-        allowFollowerReadLocalLease(omRatisServer.getServerDivision(),
-            ozoneManager.getConfig().getFollowerReadLocalLeaseLagLimit(),
-            ozoneManager.getConfig().getFollowerReadLocalLeaseTimeMs())) {
-      ozoneManager.getMetrics().incNumFollowerReadLocalLeaseSuccess();
+    if (request.getCmdType().equals(PrepareStatus)) {
+      // PrepareStatus is an OM request that only target a single OM node.
+      // Therefore, all PrepareStatus requests should be served immediately 
without failover regardless
+      // of the OM node leadership or the read consistency. See 
PrepareSubCommand.
+      // The implementation is not ideal, but exists for compatibility reason.
       return handler.handleReadRequest(request);
-    } 
-    // Get current OM's role
-    RaftServerStatus raftServerStatus = omRatisServer.getLeaderStatus();
-    // === 1. Follower linearizable read ===
-    if (raftServerStatus == NOT_LEADER && omRatisServer.isLinearizableRead()) {
-      ozoneManager.getMetrics().incNumLinearizableRead();
-      return ozoneManager.getOmExecutionFlow().submit(request, false);
     }
-    // === 2. Leader local read (skip ReadIndex if allowed) ===
-    if (raftServerStatus == LEADER_AND_READY || 
request.getCmdType().equals(PrepareStatus)) {
-      if (ozoneManager.getConfig().isAllowLeaderSkipLinearizableRead()) {
-        ozoneManager.getMetrics().incNumLeaderSkipLinearizableRead();
-        // leader directly serves local committed data
+
+    if (!request.hasReadConsistencyHint() || 
!request.getReadConsistencyHint().hasReadConsistency() ||
+        request.getReadConsistencyHint().getReadConsistency() == 
UNKNOWN_READ_CONSISTENCY) {

Review Comment:
   Thanks, updated.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -270,12 +383,19 @@ boolean allowFollowerReadLocalLease(Division 
ratisDivision, long leaseLogLimit,
       return false; // lease time expired
     }
 
+    if (leaseLagLimit == -1) {
+      // Allow infinite lag time, which allows unbounded stale reads

Review Comment:
   Thanks for catching this, updated.



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