szetszwo commented on code in PR #9319:
URL: https://github.com/apache/ozone/pull/9319#discussion_r2543113143


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -184,12 +184,12 @@ public OMRequest getLastRequestToSubmit() {
 
   private OMResponse submitReadRequestToOM(OMRequest request)
       throws ServiceException {
+    // Get current OM's role
+    RaftServerStatus raftServerStatus = omRatisServer.getLeaderStatus();
     // Read from leader or followers using linearizable read
-    if (omRatisServer.isLinearizableRead()) {
+    if (omRatisServer.isLinearizableRead() && raftServerStatus == NOT_LEADER) {

Review Comment:
   We should make it configurable.  Even for leader, it could serve stale data 
(i.e. non-linearizable read) due to a leader change.  When setting it to 
linearizable, the expectation is that all the reads are linearizable.
   
   BTW, we should enable Ratis leader lease:
   ```
   key: raft.server.read.leader.lease.enabled (boolean, default=false)
   ```



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