|
@@ -439,6 +439,10 @@ public abstract class S3GuardTool extends Configured implements Tool {
|
|
static class SetCapacity extends S3GuardTool {
|
|
static class SetCapacity extends S3GuardTool {
|
|
public static final String NAME = "set-capacity";
|
|
public static final String NAME = "set-capacity";
|
|
public static final String PURPOSE = "Alter metadata store IO capacity";
|
|
public static final String PURPOSE = "Alter metadata store IO capacity";
|
|
|
|
+ public static final String READ_CAP_INVALID = "Read capacity must have "
|
|
|
|
+ + "value greater than or equal to 1.";
|
|
|
|
+ public static final String WRITE_CAP_INVALID = "Write capacity must have "
|
|
|
|
+ + "value greater than or equal to 1.";
|
|
private static final String USAGE = NAME + " [OPTIONS] [s3a://BUCKET]\n" +
|
|
private static final String USAGE = NAME + " [OPTIONS] [s3a://BUCKET]\n" +
|
|
"\t" + PURPOSE + "\n\n" +
|
|
"\t" + PURPOSE + "\n\n" +
|
|
"Common options:\n" +
|
|
"Common options:\n" +
|
|
@@ -478,11 +482,17 @@ public abstract class S3GuardTool extends Configured implements Tool {
|
|
|
|
|
|
String readCap = getCommandFormat().getOptValue(READ_FLAG);
|
|
String readCap = getCommandFormat().getOptValue(READ_FLAG);
|
|
if (StringUtils.isNotEmpty(readCap)) {
|
|
if (StringUtils.isNotEmpty(readCap)) {
|
|
|
|
+ Preconditions.checkArgument(Integer.parseInt(readCap) > 0,
|
|
|
|
+ READ_CAP_INVALID);
|
|
|
|
+
|
|
S3GuardTool.println(out, "Read capacity set to %s", readCap);
|
|
S3GuardTool.println(out, "Read capacity set to %s", readCap);
|
|
options.put(S3GUARD_DDB_TABLE_CAPACITY_READ_KEY, readCap);
|
|
options.put(S3GUARD_DDB_TABLE_CAPACITY_READ_KEY, readCap);
|
|
}
|
|
}
|
|
String writeCap = getCommandFormat().getOptValue(WRITE_FLAG);
|
|
String writeCap = getCommandFormat().getOptValue(WRITE_FLAG);
|
|
if (StringUtils.isNotEmpty(writeCap)) {
|
|
if (StringUtils.isNotEmpty(writeCap)) {
|
|
|
|
+ Preconditions.checkArgument(Integer.parseInt(writeCap) > 0,
|
|
|
|
+ WRITE_CAP_INVALID);
|
|
|
|
+
|
|
S3GuardTool.println(out, "Write capacity set to %s", writeCap);
|
|
S3GuardTool.println(out, "Write capacity set to %s", writeCap);
|
|
options.put(S3GUARD_DDB_TABLE_CAPACITY_WRITE_KEY, writeCap);
|
|
options.put(S3GUARD_DDB_TABLE_CAPACITY_WRITE_KEY, writeCap);
|
|
}
|
|
}
|