ashishkumar50 commented on code in PR #4842:
URL: https://github.com/apache/ozone/pull/4842#discussion_r1222899824


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/DeleteVolumeHandler.java:
##########
@@ -18,27 +18,220 @@
 
 package org.apache.hadoop.ozone.shell.volume;
 
+import com.google.common.base.Strings;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.ozone.client.OzoneBucket;
 import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.client.OzoneKey;
+import org.apache.hadoop.ozone.client.OzoneVolume;
 import org.apache.hadoop.ozone.shell.OzoneAddress;
 
+import picocli.CommandLine;
 import picocli.CommandLine.Command;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static 
org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_KEY;
+import static org.apache.hadoop.fs.FileSystem.FS_DEFAULT_NAME_KEY;
+import static org.apache.hadoop.hdds.scm.net.NetConstants.PATH_SEPARATOR_STR;
+import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME;
 
 /**
  * Executes deleteVolume call for the shell.
  */
 @Command(name = "delete",
-    description = "deletes a volume if it is empty")
+    description = "deletes a volume")
 public class DeleteVolumeHandler extends VolumeHandler {
+  @CommandLine.Option(
+      names = {"-skipTrash"},
+      description = "Delete volume without trash"
+  )
+  private boolean bSkipTrash = false;
+  @CommandLine.Option(
+      names = {"-r"},
+      description = "Delete volume recursively"
+  )
+  private boolean bRecursive = false;
+  @CommandLine.Option(
+      names = {"-id", "--om-service-id"},
+      description = "Ozone Manager Service ID"
+  )
+  private String omServiceId;
+  private ExecutorService executor;
+  private List<String> bucketIdList = new ArrayList<>();
+  private AtomicInteger cleanedBucketCounter =
+      new AtomicInteger();
+  private int totalBucketCount;
+  private OzoneVolume vol;
+  private AtomicInteger numberOfBucketsCleaned = new AtomicInteger(0);
+  private volatile Throwable exception;
+  private static final int MAX_KEY_DELETE_BATCH_SIZE = 1000;
 
   @Override
   protected void execute(OzoneClient client, OzoneAddress address)
       throws IOException {
 
     String volumeName = address.getVolumeName();
-
+    try {
+      if (bRecursive) {
+        if (!bSkipTrash) {
+          out().printf("Use -skipTrash for recursive volume delete%n");
+          return;
+        }
+        if (OmUtils.isServiceIdsDefined(getConf()) &&
+            Strings.isNullOrEmpty(omServiceId)) {

Review Comment:
   I think AND is correct, because if serviceIds are configured then we need 
omserviceId.



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