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


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMFailoverProxyProviderBase.java:
##########
@@ -425,6 +427,25 @@ public List<OMProxyInfo<T>> getOMProxies() {
     return omProxies.getProxies();
   }
 
+  /**
+   * Determines whether an eligible read request may be sent to an OM follower.
+   *
+   * <p>An explicit consistency hint takes precedence over the configured
+   * default follower-read behavior.</p>
+   */
+  public static boolean shouldUseFollowerRead(OMRequest request,
+      boolean omServiceSupportsFollowerRead,
+      boolean defaultFollowerReadEnabled) {
+    if (!omServiceSupportsFollowerRead || 
!OmUtils.shouldSendToFollower(request)) {
+      return false;
+    }
+    if (request.hasReadConsistencyHint()) {
+      return ReadConsistency.fromProto(request.getReadConsistencyHint()
+          .getReadConsistency()).allowFollowerRead();
+    }
+    return defaultFollowerReadEnabled;
+  }

Review Comment:
   Yes, we can raise and address this refactor in a separate ticket. Currently, 
my focus is to support Hadoop RPC since majority of Ozone clusters are using 
Hadoop RPC.



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