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


##########
hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto:
##########
@@ -2355,6 +2357,67 @@ message DeleteObjectTaggingRequest {
 message DeleteObjectTaggingResponse {
 }
 
+enum ReadConsistencyProto {
+  // Unknown consistency, the read consistency behavior is decided
+  // by the OM
+  UNKNOWN_READ_CONSISTENCY = 0;

Review Comment:
   Got it, updated. We might add some kind of suffix or prefix (e.g. 
`UNSPECIFIED_CONSISTENCY`) since AFAIK once one one enum uses `UNSPECIFIED` 
other enum within the scope cannot use `UNSPECIFIED` anymore. Please let me 
know what you think.



##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/HadoopRpcOMFollowerReadFailoverProxyProvider.java:
##########
@@ -213,7 +228,26 @@ public Object invoke(Object proxy, final Method method, 
final Object[] args)
         return method.invoke(this, args);
       }
       OMRequest omRequest = parseOMRequest(args);
-      if (useFollowerRead && OmUtils.shouldSendToFollower(omRequest)) {
+
+      // Apply default consistency hint once, before any routing decision.
+      // In the future, we will support per-request hints which allows client 
(e.g. S3 clients)
+      // to specify a custom request header (e.g. x-ozone-read-consistency) as 
a consistency hint
+      // for read requests.
+      boolean isFollowerReadEligible = useFollowerRead && 
OmUtils.shouldSendToFollower(omRequest);
+      if (!omRequest.hasReadConsistencyHint()) {
+        ReadConsistencyProto defaultReadConsistency = isFollowerReadEligible
+            ? followerReadConsistencyType : leaderReadConsistencyType;
+        if (defaultReadConsistency != null &&
+            defaultReadConsistency != 
ReadConsistencyProto.UNKNOWN_READ_CONSISTENCY) {
+          omRequest = omRequest.toBuilder()
+              .setReadConsistencyHint(ReadConsistencyHint.newBuilder()
+                  .setReadConsistency(defaultReadConsistency).build())
+              .build();

Review Comment:
   Thanks for this optimization, 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