Skip to content

Commit

Permalink
HADOOP-17227. S3A Marker Tool tuning (#2254)
Browse files Browse the repository at this point in the history
Contributed by Steve Loughran.
  • Loading branch information
steveloughran committed Sep 4, 2020
1 parent 1b9109d commit 3835400
Show file tree
Hide file tree
Showing 6 changed files with 394 additions and 109 deletions.
Expand Up @@ -46,6 +46,7 @@
import org.slf4j.LoggerFactory;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -758,8 +759,8 @@ public int run(String[] args, PrintStream out) throws Exception {
*/
static class Destroy extends S3GuardTool {
public static final String NAME = "destroy";
public static final String PURPOSE = "destroy Metadata Store data "
+ DATA_IN_S3_IS_PRESERVED;
public static final String PURPOSE = "destroy the Metadata Store including its"
+ " contents" + DATA_IN_S3_IS_PRESERVED;
private static final String USAGE = NAME + " [OPTIONS] [s3a://BUCKET]\n" +
"\t" + PURPOSE + "\n\n" +
"Common options:\n" +
Expand Down Expand Up @@ -1252,7 +1253,7 @@ public static class BucketInfo extends S3GuardTool {

@VisibleForTesting
public static final String IS_MARKER_AWARE =
"The S3A connector is compatible with buckets where"
"\tThe S3A connector is compatible with buckets where"
+ " directory markers are not deleted";

public BucketInfo(Configuration conf) {
Expand Down Expand Up @@ -1328,8 +1329,9 @@ public int run(String[] args, PrintStream out)
authMode = conf.getBoolean(METADATASTORE_AUTHORITATIVE, false);
final long ttl = conf.getTimeDuration(METADATASTORE_METADATA_TTL,
DEFAULT_METADATASTORE_METADATA_TTL, TimeUnit.MILLISECONDS);
println(out, "\tMetadata time to live: %s=%s milliseconds",
METADATASTORE_METADATA_TTL, ttl);
println(out, "\tMetadata time to live: (set in %s) = %s",
METADATASTORE_METADATA_TTL,
DurationFormatUtils.formatDurationHMS(ttl));
printStoreDiagnostics(out, store);
} else {
println(out, "Filesystem %s is not using S3Guard", fsUri);
Expand Down Expand Up @@ -1463,10 +1465,18 @@ public int run(String[] args, PrintStream out)
private void processMarkerOption(final PrintStream out,
final S3AFileSystem fs,
final String marker) {
println(out, "%nSecurity");
DirectoryPolicy markerPolicy = fs.getDirectoryMarkerPolicy();
String desc = markerPolicy.describe();
println(out, "%nThe directory marker policy is \"%s\"%n", desc);

println(out, "\tThe directory marker policy is \"%s\"", desc);

String pols = DirectoryPolicyImpl.availablePolicies()
.stream()
.map(DirectoryPolicy.MarkerPolicy::getOptionName)
.collect(Collectors.joining(", "));
println(out, "\tAvailable Policies: %s", pols);
printOption(out, "\tAuthoritative paths",
AUTHORITATIVE_PATH, "");
DirectoryPolicy.MarkerPolicy mp = markerPolicy.getMarkerPolicy();

String desiredMarker = marker == null
Expand All @@ -1478,12 +1488,6 @@ private void processMarkerOption(final PrintStream out,
// simple awareness test -provides a way to validate compatibility
// on the command line
println(out, IS_MARKER_AWARE);
String pols = DirectoryPolicyImpl.availablePolicies()
.stream()
.map(DirectoryPolicy.MarkerPolicy::getOptionName)
.collect(Collectors.joining(", "));
println(out, "Available Policies: %s", pols);

} else {
// compare with current policy
if (!optionName.equalsIgnoreCase(desiredMarker)) {
Expand Down

0 comments on commit 3835400

Please sign in to comment.