sadanand48 commented on code in PR #3175:
URL: https://github.com/apache/ozone/pull/3175#discussion_r841483449


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -986,15 +1076,15 @@ boolean iterate() throws IOException {
         OFSPath ofsPath = new OFSPath(pathKey);
         String ofsPathPrefix =
             ofsPath.getNonKeyPathNoPrefixDelim() + OZONE_URI_DELIMITER;
-        while (keyIterator.hasNext()) {
-          BasicKeyInfo key = keyIterator.next();
-          // Convert key to full path before passing it to processKeyPath
-          // TODO: This conversion is redundant. But want to use only full path
-          //  outside AdapterImpl. - Maybe a refactor later.
-          String keyPath = ofsPathPrefix + key.getName();
-          LOG.trace("iterating key path: {}", keyPath);
-          if (!key.getName().equals("")) {
-            keyPathList.add(keyPath);
+        if (isFSO) {
+          FileStatus[] fileStatuses;
+          fileStatuses = listStatus(path);
+          for (FileStatus fileStatus : fileStatuses) {
+            String keyName =
+                new OFSPath(fileStatus.getPath().toString()).getKeyName();
+            keyName = status.isDirectory() ? addTrailingSlashIfNeeded(keyName) 
:

Review Comment:
   Yes this was not needed, removed



##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -468,6 +468,42 @@ boolean processKeyPath(List<String> keyPathList) {
     }
   }
 
+  /**
+   * To be used only by recursiveBucketDelete().
+   */
+  private class DeleteIteratorWithFSO extends OzoneListingIterator {
+    private final OzoneBucket bucket;
+    private final BasicRootedOzoneClientAdapterImpl adapterImpl;
+    private boolean recursive;
+    private Path f;
+    DeleteIteratorWithFSO(Path f, boolean recursive)
+        throws IOException {
+      super(f, true);
+      this.f = f;
+      this.recursive = recursive;
+      // Initialize bucket here to reduce number of RPC calls
+      OFSPath ofsPath = new OFSPath(f);
+      adapterImpl = (BasicRootedOzoneClientAdapterImpl) adapter;
+      this.bucket = adapterImpl.getBucket(ofsPath, false);

Review Comment:
   Done



##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -567,7 +626,12 @@ public boolean delete(Path f, boolean recursive) throws 
IOException {
         }
       }
 
-      result = innerDelete(f, recursive);
+      if (ofsPath.isBucket() && isFSObucket(ofsPath.getVolumeName(),
+          ofsPath.getBucketName())) {
+        result = recursiveBucketDelete(f, recursive);

Review Comment:
   Done



-- 
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: dev-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ozone.apache.org
For additional commands, e-mail: dev-h...@ozone.apache.org

Reply via email to