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


##########
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:
   Leaders always serves committed data but committed data can become stale:
   
   1. Leader A has committed x=3
   2. Another server B is newly elected to be a leader but A does not know
   3. New Leader B has committed x=4.
   4. Old Leader A receives a client request and returns x=3.   <--- This is 
stale data
   



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