From b24bd4095ac595e4f0850ffd052d351c823f0fbd Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Tue, 2 Mar 2021 11:23:10 +0100 Subject: [PATCH] HBASE-25611 ExportSnapshot chmod flag uses value as decimal (#3003) Signed-off-by: Wellington Chevreuil --- .../apache/hadoop/hbase/util/AbstractHBaseTool.java | 12 ++++++++++-- .../apache/hadoop/hbase/snapshot/ExportSnapshot.java | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/AbstractHBaseTool.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/AbstractHBaseTool.java index adb69ff45fa8..8aaba41adf1e 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/AbstractHBaseTool.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/AbstractHBaseTool.java @@ -233,16 +233,24 @@ protected void addOptWithArg(String shortOpt, String longOpt, String description } public int getOptionAsInt(CommandLine cmd, String opt, int defaultValue) { + return getOptionAsInt(cmd, opt, defaultValue, 10); + } + + public int getOptionAsInt(CommandLine cmd, String opt, int defaultValue, int radix) { if (cmd.hasOption(opt)) { - return Integer.parseInt(cmd.getOptionValue(opt)); + return Integer.parseInt(cmd.getOptionValue(opt), radix); } else { return defaultValue; } } public long getOptionAsLong(CommandLine cmd, String opt, int defaultValue) { + return getOptionAsLong(cmd, opt, defaultValue, 10); + } + + public long getOptionAsLong(CommandLine cmd, String opt, int defaultValue, int radix) { if (cmd.hasOption(opt)) { - return Long.parseLong(cmd.getOptionValue(opt)); + return Long.parseLong(cmd.getOptionValue(opt), radix); } else { return defaultValue; } diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java index c215243ed783..a95a9f4d5528 100644 --- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java +++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java @@ -927,7 +927,7 @@ protected void processOptions(CommandLine cmd) { mappers = getOptionAsInt(cmd, Options.MAPPERS.getLongOpt(), mappers); filesUser = cmd.getOptionValue(Options.CHUSER.getLongOpt(), filesUser); filesGroup = cmd.getOptionValue(Options.CHGROUP.getLongOpt(), filesGroup); - filesMode = getOptionAsInt(cmd, Options.CHMOD.getLongOpt(), filesMode); + filesMode = getOptionAsInt(cmd, Options.CHMOD.getLongOpt(), filesMode, 8); bandwidthMB = getOptionAsInt(cmd, Options.BANDWIDTH.getLongOpt(), bandwidthMB); overwrite = cmd.hasOption(Options.OVERWRITE.getLongOpt()); // And verifyChecksum and verifyTarget with values read from old args in processOldArgs(...).