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


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OmConfig.java:
##########
@@ -141,6 +141,15 @@ public class OmConfig extends ReconfigurableConfig {
   )
   private boolean listAllVolumesAllowed = Defaults.LIST_ALL_VOLUMES_ALLOWED;
 
+  @Config(key = "allow.leader.skip.linearizable.read",
+      defaultValue = "FALSE",

Review Comment:
   ```suggestion
         defaultValue = "false",
   ```



##########
hadoop-hdds/common/src/main/resources/ozone-default.xml:
##########
@@ -650,6 +650,20 @@
       ozone.om.https-bind-host.service1.om1
     </description>
   </property>
+  <property>
+    <name>ozone.om.volume.listall.allowed</name>
+    <value>true</value>
+    <tag>OM, MANAGEMENT</tag>
+    <description>
+      Allows everyone to list all volumes when set to true. Defaults to true.
+      When set to false, non-admin users can only list the volumes they have
+      access to. Admins can always list all volumes. Note that this config
+      only applies to OzoneNativeAuthorizer. For other authorizers, admin
+      needs to set policies accordingly to allow all volume listing
+      e.g. for Ranger, a new policy with special volume "/" can be added to
+      allow group public LIST access.
+    </description>
+  </property>

Review Comment:
   This was removed in HDDS-12301, please don't add it back.
   
   ```suggestion
   ```



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -4678,6 +4678,10 @@ public boolean getEnableFileSystemPaths() {
     return config.isFileSystemPathEnabled();
   }
 
+  public boolean isAllowLeaderSkipLinearizableRead() {
+    return config.isAllowLeaderSkipLinearizableRead();
+  }
+

Review Comment:
   No need to add passthrough for config.
   
   ```suggestion
   ```



##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OmConfig.java:
##########
@@ -141,6 +141,15 @@ public class OmConfig extends ReconfigurableConfig {
   )
   private boolean listAllVolumesAllowed = Defaults.LIST_ALL_VOLUMES_ALLOWED;
 
+  @Config(key = "allow.leader.skip.linearizable.read",

Review Comment:
   Add prefix for easier text search.
   
   ```suggestion
     @Config(key = "ozone.om.allow.leader.skip.linearizable.read",
   ```



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -184,14 +184,27 @@ public OMRequest getLastRequestToSubmit() {
 
   private OMResponse submitReadRequestToOM(OMRequest request)
       throws ServiceException {
-    // Read from leader or followers using linearizable read
-    if (omRatisServer.isLinearizableRead()) {
+    // 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);
     }
-    // Check if this OM is the leader.
-    RaftServerStatus raftServerStatus = omRatisServer.getLeaderStatus();
-    if (raftServerStatus == LEADER_AND_READY ||
-        request.getCmdType().equals(PrepareStatus)) {
+    // === 2. Leader local read (skip ReadIndex if allowed) ===
+    if (raftServerStatus == LEADER_AND_READY || 
request.getCmdType().equals(PrepareStatus)) {
+      if (ozoneManager.isAllowLeaderSkipLinearizableRead()) {

Review Comment:
   ```suggestion
         if (ozoneManager.getConfig().isAllowLeaderSkipLinearizableRead()) {
   ```



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