smengcl commented on code in PR #4573:
URL: https://github.com/apache/ozone/pull/4573#discussion_r1183002268


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1108,8 +1111,14 @@ public List<OmBucketInfo> listBuckets(final String 
volumeName,
         // We should return only the keys, whose keys match with prefix and
         // the keys after the startBucket.
         if (key.startsWith(seekPrefix) && key.compareTo(startKey) >= 0) {
-          result.add(omBucketInfo);
-          currentCount++;
+          if (isSnapshot && !listSnapshot(
+              volumeName, omBucketInfo.getBucketName()).isEmpty()) {
+            result.add(omBucketInfo);
+            currentCount++;
+          } else if (!isSnapshot) {
+            result.add(omBucketInfo);
+            currentCount++;
+          }

Review Comment:
   ```suggestion
             if (!hasSnapshot) {
               // Snapshot filter off
               result.add(omBucketInfo);
               currentCount++;
             } else if (
                 !listSnapshot(volumeName, omBucketInfo.getBucketName())
                     .isEmpty()) {
               // Snapshot filter on.
               // Add to result list only when the bucket has at least one 
snapshot
               result.add(omBucketInfo);
               currentCount++;
             }
   ```



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