|
@@ -57,6 +57,7 @@ import org.apache.hadoop.fs.s3a.impl.DirectoryPolicyImpl;
|
|
import org.apache.hadoop.fs.s3a.impl.StoreContext;
|
|
import org.apache.hadoop.fs.s3a.impl.StoreContext;
|
|
import org.apache.hadoop.fs.s3a.s3guard.S3GuardTool;
|
|
import org.apache.hadoop.fs.s3a.s3guard.S3GuardTool;
|
|
import org.apache.hadoop.fs.shell.CommandFormat;
|
|
import org.apache.hadoop.fs.shell.CommandFormat;
|
|
|
|
+import org.apache.hadoop.thirdparty.com.google.common.base.Preconditions;
|
|
import org.apache.hadoop.util.DurationInfo;
|
|
import org.apache.hadoop.util.DurationInfo;
|
|
import org.apache.hadoop.util.ExitUtil;
|
|
import org.apache.hadoop.util.ExitUtil;
|
|
|
|
|
|
@@ -395,10 +396,22 @@ public final class MarkerTool extends S3GuardTool {
|
|
} else {
|
|
} else {
|
|
filterPolicy = null;
|
|
filterPolicy = null;
|
|
}
|
|
}
|
|
|
|
+ int minMarkerCount = scanArgs.getMinMarkerCount();
|
|
|
|
+ int maxMarkerCount = scanArgs.getMaxMarkerCount();
|
|
|
|
+ if (minMarkerCount > maxMarkerCount) {
|
|
|
|
+ // swap min and max if they are wrong.
|
|
|
|
+ // this is to ensure any test scripts written to work around
|
|
|
|
+ // HADOOP-17332 and min/max swapping continue to work.
|
|
|
|
+ println(out, "Swapping -min (%d) and -max (%d) values",
|
|
|
|
+ minMarkerCount, maxMarkerCount);
|
|
|
|
+ int m = minMarkerCount;
|
|
|
|
+ minMarkerCount = maxMarkerCount;
|
|
|
|
+ maxMarkerCount = m;
|
|
|
|
+ }
|
|
ScanResult result = scan(target,
|
|
ScanResult result = scan(target,
|
|
scanArgs.isDoPurge(),
|
|
scanArgs.isDoPurge(),
|
|
- scanArgs.getMaxMarkerCount(),
|
|
|
|
- scanArgs.getMinMarkerCount(),
|
|
|
|
|
|
+ minMarkerCount,
|
|
|
|
+ maxMarkerCount,
|
|
scanArgs.getLimit(),
|
|
scanArgs.getLimit(),
|
|
filterPolicy);
|
|
filterPolicy);
|
|
return result;
|
|
return result;
|
|
@@ -513,6 +526,11 @@ public final class MarkerTool extends S3GuardTool {
|
|
final DirectoryPolicy filterPolicy)
|
|
final DirectoryPolicy filterPolicy)
|
|
throws IOException, ExitUtil.ExitException {
|
|
throws IOException, ExitUtil.ExitException {
|
|
|
|
|
|
|
|
+ // safety check: min and max are correctly ordered at this point.
|
|
|
|
+ Preconditions.checkArgument(minMarkerCount <= maxMarkerCount,
|
|
|
|
+ "The min marker count of %d is greater than the max value of %d",
|
|
|
|
+ minMarkerCount, maxMarkerCount);
|
|
|
|
+
|
|
ScanResult result = new ScanResult();
|
|
ScanResult result = new ScanResult();
|
|
|
|
|
|
// Mission Accomplished
|
|
// Mission Accomplished
|