You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/02/09 09:19:14 UTC

[GitHub] [ozone] sadanand48 opened a new pull request #1915: HDDS-4742.Make trash work with FS Optimised Buckets.

sadanand48 opened a new pull request #1915:
URL: https://github.com/apache/ozone/pull/1915


   ## What changes were proposed in this pull request?
   Integrate trash with HDDS-2939.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-4742
   
   ## How was this patch tested?
   testTrash() run through TestOzoneFileSystemV1 configs.
   


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] rakeshadr commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
rakeshadr commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576825006



##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java
##########
@@ -205,4 +207,26 @@ public static int getFileCount(String keyName) {
     java.nio.file.Path keyPath = Paths.get(keyName);
     return keyPath.getNameCount();
   }
+
+
+  /**
+   * Returns true if the bucket is FS Optimised.
+   * @param buckeMetadata
+   * @return
+   */
+  public static boolean isFSOptimizedBucket(Map<String, String> buckeMetadata) {

Review comment:
       Typo : buckeMetadata -> bucketMetadata

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -467,7 +541,7 @@ boolean processKeyPath(List<String> keyPathList) {
       for (String keyPath : keyPathList) {
         OFSPath path = new OFSPath(keyPath);
         OzoneManagerProtocolProtos.OMRequest omRequest =
-            getDeleteKeyRequest(path);
+            getDeleteKeysRequest(path);

Review comment:
       Clarification: Is this related to the FSO bucket? This is required for the un optimized bucket, right?




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] amaliujia commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r573500697



##########
File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemV1.java
##########
@@ -380,21 +380,10 @@ public void testRenameDestinationParentDoesntExist() throws Exception {
     }
   }
 
-  @Override
-  @Test
-  @Ignore("TODO:HDDS-2939")
-  public void testTrash() throws Exception {
-  }
-
-  @Override
-  @Test
-  @Ignore("TODO:HDDS-2939")
-  public void testRenameToTrashEnabled() throws Exception {
-  }
-
   @Override
   @Test
   @Ignore("TODO:HDDS-2939")
   public void testListStatusWithIntermediateDir() throws Exception {
   }
+

Review comment:
       nit: undo this line




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576853685



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -467,7 +541,7 @@ boolean processKeyPath(List<String> keyPathList) {
       for (String keyPath : keyPathList) {
         OFSPath path = new OFSPath(keyPath);
         OzoneManagerProtocolProtos.OMRequest omRequest =
-            getDeleteKeyRequest(path);
+            getDeleteKeysRequest(path);

Review comment:
       Yes `DeleteKeysRequest `is for un optimised bucket. Using `DeleteKeyRequest` for unoptimised bucket would cause [this](https://github.com/apache/ozone/pull/1851) issue.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] rakeshadr commented on pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
rakeshadr commented on pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#issuecomment-779882770


   Thanks @sadanand48 for the contribution. +1 for the changes. 


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576853685



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -467,7 +541,7 @@ boolean processKeyPath(List<String> keyPathList) {
       for (String keyPath : keyPathList) {
         OFSPath path = new OFSPath(keyPath);
         OzoneManagerProtocolProtos.OMRequest omRequest =
-            getDeleteKeyRequest(path);
+            getDeleteKeysRequest(path);

Review comment:
       1. No not related to FSO bucket
   2. Yes `DeleteKeysRequest `is for un optimised bucket. Using `DeleteKeyRequest` for unoptimised bucket would cause [this](https://github.com/apache/ozone/pull/1851) issue.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] rakeshadr edited a comment on pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
rakeshadr edited a comment on pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#issuecomment-779882770


   Thanks @sadanand48 for the contribution. +1 for the changes. Waiting for the QA report.


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576688408



##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java
##########
@@ -205,4 +206,25 @@ public static int getFileCount(String keyName) {
     java.nio.file.Path keyPath = Paths.get(keyName);
     return keyPath.getNameCount();
   }
+
+  /**
+   * Returns true if the bucket is FS Optimised.
+   * @param bucket
+   * @return
+   */
+  public static boolean isFSOptimizedBucket(OmBucketInfo bucket) {
+    // layout version V1 represents optimized FS path

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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] rakeshadr commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
rakeshadr commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576528232



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -165,14 +171,43 @@ public boolean rename(Path src, Path dst) throws IOException {
     return true;
   }
 
+  private boolean renameV1(OFSPath srcPath, OFSPath dstPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getRenameKeyRequest(srcPath, dstPath);
+    try {
+      submitRequest(omRequest);
+    } catch (Exception e){
+      LOG.error("couldnt send rename requestV1", e);
+    }
+    return true;
+
+  }
+
   @Override
   public boolean delete(Path path, boolean b) throws IOException {
     ozoneManager.getMetrics().incNumTrashDeletes();
+    OFSPath srcPath = new OFSPath(path);
+    OmBucketInfo bucket = ozoneManager.getBucketInfo(srcPath.getVolumeName(),
+        srcPath.getBucketName());
+    if (OzoneFSUtils.isFSOptimizedBucket(bucket)) {
+      return deleteV1(srcPath);
+    }
     DeleteIterator iterator = new DeleteIterator(path, true);
     iterator.iterate();
     return true;
   }
 
+  private boolean deleteV1(OFSPath srcPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getDeleteKeyRequest(srcPath);

Review comment:
       same as above comment. Do null check for the `omRequest`

##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java
##########
@@ -205,4 +206,25 @@ public static int getFileCount(String keyName) {
     java.nio.file.Path keyPath = Paths.get(keyName);
     return keyPath.getNameCount();
   }
+
+  /**
+   * Returns true if the bucket is FS Optimised.
+   * @param bucket
+   * @return
+   */
+  public static boolean isFSOptimizedBucket(OmBucketInfo bucket) {
+    // layout version V1 represents optimized FS path

Review comment:
       @sadanand48, nice idea to add this to utility function. Can you please do a few changes to avoid duplicate functionality exists in [BasicOzoneClientAdapterImpl#L552](https://github.com/apache/ozone/blob/HDDS-2939/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java#L552).
   
   Can you do changes like:
   
    ```
   OzoneFSUtils.java
   
    /**
      * Returns true if the bucket is FS Optimised.
      * @param buckeMetadata
      * @return
      */
     public static boolean isFSOptimizedBucket(Map<String, String> buckeMetadata) {
       // layout version V1 represents optimized FS path
       boolean layoutVersionEnabled =
               org.apache.commons.lang3.StringUtils.equalsIgnoreCase(
                       OMConfigKeys.OZONE_OM_LAYOUT_VERSION_V1,
                       buckeMetadata.get(OMConfigKeys.OZONE_OM_LAYOUT_VERSION));
   
       boolean fsEnabled =
               Boolean.parseBoolean(buckeMetadata
                       .get(OMConfigKeys.OZONE_OM_ENABLE_FILESYSTEM_PATHS));
   
       return layoutVersionEnabled && fsEnabled;
     }
   ```
   
   ```
   BasicOzoneClientAdapterImpl.java
   
     @Override
     public boolean isFSOptimizedBucket() {
       // layout version V1 represents optimized FS path
       return OzoneFSUtils.isFSOptimizedBucket(bucket.getMetadata());
     }
   
   ```
   
   

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -165,14 +171,43 @@ public boolean rename(Path src, Path dst) throws IOException {
     return true;
   }
 
+  private boolean renameV1(OFSPath srcPath, OFSPath dstPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getRenameKeyRequest(srcPath, dstPath);
+    try {
+      submitRequest(omRequest);
+    } catch (Exception e){
+      LOG.error("couldnt send rename requestV1", e);
+    }
+    return true;
+
+  }
+
   @Override
   public boolean delete(Path path, boolean b) throws IOException {
     ozoneManager.getMetrics().incNumTrashDeletes();
+    OFSPath srcPath = new OFSPath(path);
+    OmBucketInfo bucket = ozoneManager.getBucketInfo(srcPath.getVolumeName(),
+        srcPath.getBucketName());
+    if (OzoneFSUtils.isFSOptimizedBucket(bucket)) {
+      return deleteV1(srcPath);
+    }
     DeleteIterator iterator = new DeleteIterator(path, true);
     iterator.iterate();
     return true;
   }
 
+  private boolean deleteV1(OFSPath srcPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getDeleteKeyRequest(srcPath);
+    try {
+      submitRequest(omRequest);
+    } catch (Throwable e) {
+      LOG.error("Couldn't send delete request.", e);

Review comment:
       Will returning `true` gives a false positive to the user ? Is that expected behavior?

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -165,14 +171,43 @@ public boolean rename(Path src, Path dst) throws IOException {
     return true;
   }
 
+  private boolean renameV1(OFSPath srcPath, OFSPath dstPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getRenameKeyRequest(srcPath, dstPath);
+    try {
+      submitRequest(omRequest);

Review comment:
       Please add a null check for omRequest. Otw, in error case NPE will get thrown and good to avoid NPE in logs.
   
   can do something like:
   ```
   if(omRequest != null) { 
       submitRequest(omRequest);.
       return true;
   }
   return false;
   ```




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] rakeshadr commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
rakeshadr commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576870810



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -467,7 +541,7 @@ boolean processKeyPath(List<String> keyPathList) {
       for (String keyPath : keyPathList) {
         OFSPath path = new OFSPath(keyPath);
         OzoneManagerProtocolProtos.OMRequest omRequest =
-            getDeleteKeyRequest(path);
+            getDeleteKeysRequest(path);

Review comment:
       OK, got it. 
   
   I have gone through the master code and saw it used [getDeleteKeyRequest#470](https://github.com/apache/ozone/blob/master/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java#L470)
   
   Should we fix this in master ?




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576881906



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -467,7 +541,7 @@ boolean processKeyPath(List<String> keyPathList) {
       for (String keyPath : keyPathList) {
         OFSPath path = new OFSPath(keyPath);
         OzoneManagerProtocolProtos.OMRequest omRequest =
-            getDeleteKeyRequest(path);
+            getDeleteKeysRequest(path);

Review comment:
       Currently the master code has one method for rename and one method for delete.  I have added getDeleteKeyRequest and getDeleteKeysRequest in this branch inorder to differentiate between the 2 delete requests.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] amaliujia commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r573501001



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -529,6 +596,4 @@ boolean processKeyPath(List<String> keyPathList) {
     return userInfo.build();
   }
 
-
-

Review comment:
       nit: undo this two lines




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576689846



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -529,6 +596,4 @@ boolean processKeyPath(List<String> keyPathList) {
     return userInfo.build();
   }
 
-
-

Review comment:
       Done.

##########
File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemV1.java
##########
@@ -380,21 +380,10 @@ public void testRenameDestinationParentDoesntExist() throws Exception {
     }
   }
 
-  @Override
-  @Test
-  @Ignore("TODO:HDDS-2939")
-  public void testTrash() throws Exception {
-  }
-
-  @Override
-  @Test
-  @Ignore("TODO:HDDS-2939")
-  public void testRenameToTrashEnabled() throws Exception {
-  }
-
   @Override
   @Test
   @Ignore("TODO:HDDS-2939")
   public void testListStatusWithIntermediateDir() throws Exception {
   }
+

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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#issuecomment-779719319


   Thanks @rakeshadr for the review. Addressed comments.


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] bharatviswa504 commented on pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#issuecomment-776859972


   @sadanand48 
   Can you rebase this PR?


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] rakeshadr merged pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
rakeshadr merged pull request #1915:
URL: https://github.com/apache/ozone/pull/1915


   


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576688929



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -165,14 +171,43 @@ public boolean rename(Path src, Path dst) throws IOException {
     return true;
   }
 
+  private boolean renameV1(OFSPath srcPath, OFSPath dstPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getRenameKeyRequest(srcPath, dstPath);
+    try {
+      submitRequest(omRequest);
+    } catch (Exception e){
+      LOG.error("couldnt send rename requestV1", e);
+    }
+    return true;
+
+  }
+
   @Override
   public boolean delete(Path path, boolean b) throws IOException {
     ozoneManager.getMetrics().incNumTrashDeletes();
+    OFSPath srcPath = new OFSPath(path);
+    OmBucketInfo bucket = ozoneManager.getBucketInfo(srcPath.getVolumeName(),
+        srcPath.getBucketName());
+    if (OzoneFSUtils.isFSOptimizedBucket(bucket)) {
+      return deleteV1(srcPath);
+    }
     DeleteIterator iterator = new DeleteIterator(path, true);
     iterator.iterate();
     return true;
   }
 
+  private boolean deleteV1(OFSPath srcPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getDeleteKeyRequest(srcPath);
+    try {
+      submitRequest(omRequest);
+    } catch (Throwable e) {
+      LOG.error("Couldn't send delete request.", e);

Review comment:
       changed this. it will return false if exception is caught

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -165,14 +171,43 @@ public boolean rename(Path src, Path dst) throws IOException {
     return true;
   }
 
+  private boolean renameV1(OFSPath srcPath, OFSPath dstPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getRenameKeyRequest(srcPath, dstPath);
+    try {
+      submitRequest(omRequest);

Review comment:
       Done.

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -165,14 +171,43 @@ public boolean rename(Path src, Path dst) throws IOException {
     return true;
   }
 
+  private boolean renameV1(OFSPath srcPath, OFSPath dstPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getRenameKeyRequest(srcPath, dstPath);
+    try {
+      submitRequest(omRequest);
+    } catch (Exception e){
+      LOG.error("couldnt send rename requestV1", e);
+    }
+    return true;
+
+  }
+
   @Override
   public boolean delete(Path path, boolean b) throws IOException {
     ozoneManager.getMetrics().incNumTrashDeletes();
+    OFSPath srcPath = new OFSPath(path);
+    OmBucketInfo bucket = ozoneManager.getBucketInfo(srcPath.getVolumeName(),
+        srcPath.getBucketName());
+    if (OzoneFSUtils.isFSOptimizedBucket(bucket)) {
+      return deleteV1(srcPath);
+    }
     DeleteIterator iterator = new DeleteIterator(path, true);
     iterator.iterate();
     return true;
   }
 
+  private boolean deleteV1(OFSPath srcPath) {
+    OzoneManagerProtocolProtos.OMRequest omRequest =
+        getDeleteKeyRequest(srcPath);

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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] sadanand48 commented on a change in pull request #1915: HDDS-4742. Make trash work with FS Optimised Buckets.

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on a change in pull request #1915:
URL: https://github.com/apache/ozone/pull/1915#discussion_r576850575



##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java
##########
@@ -205,4 +207,26 @@ public static int getFileCount(String keyName) {
     java.nio.file.Path keyPath = Paths.get(keyName);
     return keyPath.getNameCount();
   }
+
+
+  /**
+   * Returns true if the bucket is FS Optimised.
+   * @param buckeMetadata
+   * @return
+   */
+  public static boolean isFSOptimizedBucket(Map<String, String> buckeMetadata) {

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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org