steveloughran commented on a change in pull request #1003: HADOOP-16384: Avoid 
inconsistencies between DDB and S3
URL: https://github.com/apache/hadoop/pull/1003#discussion_r302156330
 
 

 ##########
 File path: 
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/PurgeS3GuardTable.java
 ##########
 @@ -0,0 +1,238 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.s3a.s3guard;
+
+import javax.annotation.Nullable;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import com.amazonaws.services.dynamodbv2.xspec.ExpressionSpecBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.s3a.S3AFileSystem;
+import org.apache.hadoop.service.Service;
+import org.apache.hadoop.service.launcher.LauncherExitCodes;
+import org.apache.hadoop.service.launcher.ServiceLaunchException;
+import org.apache.hadoop.service.launcher.ServiceLauncher;
+import org.apache.hadoop.util.DurationInfo;
+import org.apache.hadoop.util.ExitUtil;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.hadoop.fs.s3a.s3guard.DumpS3GuardTable.serviceMain;
+import static 
org.apache.hadoop.fs.s3a.s3guard.PathMetadataDynamoDBTranslation.PARENT;
+
+/**
+ * Purge the S3Guard table of a FileSystem from all entries related to
+ * that table.
+ * Will fail if there is no table, or the store is in auth mode.
+ * <pre>
+ *   hadoop org.apache.hadoop.fs.s3a.s3guard.PurgeS3GuardTable \
+ *   -force s3a://example-bucket/
+ * </pre>
+ *
+ */
+@InterfaceAudience.Private
+@InterfaceStability.Unstable
+public class PurgeS3GuardTable extends AbstractS3GuardDiagnostic {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(PurgeS3GuardTable.class);
+
+  public static final String NAME = "PurgeS3GuardTable";
+
+  public static final String FORCE = "-force";
+
+  private static final String USAGE_MESSAGE = NAME
+      + " [-force] <filesystem>";
+
+  private boolean force;
+
+  private long filesFound;
+  private long filesDeleted;
+
+  public PurgeS3GuardTable(final String name) {
+    super(name);
+  }
+
+  public PurgeS3GuardTable() {
+    this(NAME);
+  }
+
+  public PurgeS3GuardTable(
+      final S3AFileSystem filesystem,
+      final DynamoDBMetadataStore store,
 
 Review comment:
   changed the classname. Not creating one for the local store as it makes no 
sense to write a command line entry point to purge the table unique to that 
process.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to