HBASE-20683 Incorrect return value for PreUpgradeValidator

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Peter Somogyi 2018-06-05 12:21:27 +02:00
parent 323eccc65b
commit 00289b8ffa
1 changed files with 6 additions and 7 deletions

View File

@ -56,12 +56,12 @@ public class PreUpgradeValidator extends AbstractHBaseTool {
private boolean validateDBE; private boolean validateDBE;
/** /**
* Check DataBlockEncodings for column families. * Check DataBlockEncodings of column families are compatible.
* *
* @return DataBlockEncoding compatible with HBase 2 * @return number of column families with incompatible DataBlockEncoding
* @throws IOException if a remote or network exception occurs * @throws IOException if a remote or network exception occurs
*/ */
private boolean validateDBE() throws IOException { private int validateDBE() throws IOException {
int incompatibilities = 0; int incompatibilities = 0;
LOG.info("Validating Data Block Encodings"); LOG.info("Validating Data Block Encodings");
@ -92,17 +92,16 @@ public class PreUpgradeValidator extends AbstractHBaseTool {
+ "upgrade until these encodings are converted to a supported one.", incompatibilities); + "upgrade until these encodings are converted to a supported one.", incompatibilities);
LOG.warn("Check http://hbase.apache.org/book.html#upgrade2.0.prefix-tree.removed " LOG.warn("Check http://hbase.apache.org/book.html#upgrade2.0.prefix-tree.removed "
+ "for instructions."); + "for instructions.");
return false;
} else { } else {
LOG.info("The used Data Block Encodings are compatible with HBase 2.0."); LOG.info("The used Data Block Encodings are compatible with HBase 2.0.");
return true;
} }
return incompatibilities;
} }
@Override @Override
protected void addOptions() { protected void addOptions() {
addOptNoArg("all", "Run all pre-upgrade validations"); addOptNoArg("all", "Run all pre-upgrade validations");
addOptNoArg("validateDBE", "Validate DataBlockEncoding are compatible on the cluster"); addOptNoArg("validateDBE", "Validate DataBlockEncodings are compatible");
} }
@Override @Override
@ -115,7 +114,7 @@ public class PreUpgradeValidator extends AbstractHBaseTool {
protected int doWork() throws Exception { protected int doWork() throws Exception {
boolean validationFailed = false; boolean validationFailed = false;
if (validateDBE || validateAll) { if (validateDBE || validateAll) {
if (validateDBE()) { if (validateDBE() > 0) {
validationFailed = true; validationFailed = true;
} }
} }