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


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java:
##########
@@ -147,4 +157,158 @@ public long getLastSequenceNumberFromDB() {
   public boolean isOmTablesInitialized() {
     return omTablesInitialized;
   }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public List<OmVolumeArgs> listVolumes(String startKey,
+       int maxKeys) throws IOException {
+    List<OmVolumeArgs> result = Lists.newArrayList();
+
+    String volumeName;
+    OmVolumeArgs omVolumeArgs;
+
+    boolean startKeyIsEmpty = Strings.isNullOrEmpty(startKey);
+
+    // Unlike in {@link OmMetadataManagerImpl}, the volumes are queried 
directly
+    // from the volume table (not through cache) since Recon does not use
+    // Table cache.
+    try (TableIterator<String, ? extends Table.KeyValue<String, OmVolumeArgs>>
+             iterator = getVolumeTable().iterator()) {
+
+      while (iterator.hasNext() && result.size() < maxKeys) {
+        Table.KeyValue<String, OmVolumeArgs> kv = iterator.next();
+        omVolumeArgs = kv.getValue();
+        volumeName = omVolumeArgs.getVolume();
+
+
+        if (!startKeyIsEmpty) {
+          if (volumeName.equals(startKey)) {
+            startKeyIsEmpty = true;
+          }
+          continue;
+        }
+
+        result.add(omVolumeArgs);
+      }
+    }
+
+    return result;
+  }
+
+  /**
+   * Return all volumes in the file system.
+   * This method can be optimized by using username as a filter.
+   * @return a list of volume names under the system
+   */
+  @Override
+  public List<OmVolumeArgs> listVolumes() throws IOException {

Review Comment:
   This is only used in `RootEntityHandler`. I leave it here so that there is 
no unintended behavior change in `RootEntityHandler`. Another task / ticket can 
be created if `RootEntityHandler` needs to use the bounded `listVolumes(String 
startKey, int maxKeys)`.



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