Skip to content

Commit 299c63f

Browse files
committed
CDPD-2929. HADOOP-17227. S3A Marker Tool tuning (apache#2254)
Contributed by Steve Loughran. Change-Id: Ia36f058456db94c7358bc113ef298652445b03d3
1 parent eb803ec commit 299c63f

File tree

6 files changed

+394
-109
lines changed

6 files changed

+394
-109
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardTool.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.slf4j.LoggerFactory;
4747

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

12531254
@VisibleForTesting
12541255
public static final String IS_MARKER_AWARE =
1255-
"The S3A connector is compatible with buckets where"
1256+
"\tThe S3A connector is compatible with buckets where"
12561257
+ " directory markers are not deleted";
12571258

12581259
public BucketInfo(Configuration conf) {
@@ -1328,8 +1329,9 @@ public int run(String[] args, PrintStream out)
13281329
authMode = conf.getBoolean(METADATASTORE_AUTHORITATIVE, false);
13291330
final long ttl = conf.getTimeDuration(METADATASTORE_METADATA_TTL,
13301331
DEFAULT_METADATASTORE_METADATA_TTL, TimeUnit.MILLISECONDS);
1331-
println(out, "\tMetadata time to live: %s=%s milliseconds",
1332-
METADATASTORE_METADATA_TTL, ttl);
1332+
println(out, "\tMetadata time to live: (set in %s) = %s",
1333+
METADATASTORE_METADATA_TTL,
1334+
DurationFormatUtils.formatDurationHMS(ttl));
13331335
printStoreDiagnostics(out, store);
13341336
} else {
13351337
println(out, "Filesystem %s is not using S3Guard", fsUri);
@@ -1463,10 +1465,18 @@ public int run(String[] args, PrintStream out)
14631465
private void processMarkerOption(final PrintStream out,
14641466
final S3AFileSystem fs,
14651467
final String marker) {
1468+
println(out, "%nSecurity");
14661469
DirectoryPolicy markerPolicy = fs.getDirectoryMarkerPolicy();
14671470
String desc = markerPolicy.describe();
1468-
println(out, "%nThe directory marker policy is \"%s\"%n", desc);
1469-
1471+
println(out, "\tThe directory marker policy is \"%s\"", desc);
1472+
1473+
String pols = DirectoryPolicyImpl.availablePolicies()
1474+
.stream()
1475+
.map(DirectoryPolicy.MarkerPolicy::getOptionName)
1476+
.collect(Collectors.joining(", "));
1477+
println(out, "\tAvailable Policies: %s", pols);
1478+
printOption(out, "\tAuthoritative paths",
1479+
AUTHORITATIVE_PATH, "");
14701480
DirectoryPolicy.MarkerPolicy mp = markerPolicy.getMarkerPolicy();
14711481

14721482
String desiredMarker = marker == null
@@ -1478,12 +1488,6 @@ private void processMarkerOption(final PrintStream out,
14781488
// simple awareness test -provides a way to validate compatibility
14791489
// on the command line
14801490
println(out, IS_MARKER_AWARE);
1481-
String pols = DirectoryPolicyImpl.availablePolicies()
1482-
.stream()
1483-
.map(DirectoryPolicy.MarkerPolicy::getOptionName)
1484-
.collect(Collectors.joining(", "));
1485-
println(out, "Available Policies: %s", pols);
1486-
14871491
} else {
14881492
// compare with current policy
14891493
if (!optionName.equalsIgnoreCase(desiredMarker)) {

0 commit comments

Comments
 (0)