Skip to content

Commit

Permalink
HBASE-21378 [hbck2] checkHBCKSupport blocks assigning hbase:meta or h…
Browse files Browse the repository at this point in the history
…base:namespace when master is not initialized
  • Loading branch information
tianjy1990 authored and saintstack committed Oct 28, 2018
1 parent dd8a0e2 commit 458152d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class HBCK2 extends Configured implements Tool {
private Configuration conf;
private static final String TWO_POINT_ONE = "2.1.0";
private static final String MININUM_VERSION = "2.0.3";
private boolean skipCheck = false;
/**
* Wait 1ms on lock by default.
*/
Expand All @@ -89,6 +90,10 @@ public class HBCK2 extends Configured implements Tool {
* Check for HBCK support.
*/
void checkHBCKSupport(Connection connection) throws IOException {
if(skipCheck){
LOG.info("hbck support check skipped");
return;
}
try (Admin admin = connection.getAdmin()) {
checkVersion(admin.getClusterMetrics(EnumSet.of(ClusterMetrics.Option.HBASE_VERSION)).
getHBaseVersion());
Expand Down Expand Up @@ -314,6 +319,8 @@ public int run(String[] args) throws IOException {
options.addOption(peerPort);
Option version = Option.builder("v").longOpt(VERSION).desc("this hbck2 version").build();
options.addOption(version);
Option skip = Option.builder("s").longOpt("skip").desc("skip hbase version check").build();
options.addOption(skip);

// Parse command-line.
CommandLineParser parser = new DefaultParser();
Expand Down Expand Up @@ -349,6 +356,9 @@ public int run(String[] args) throws IOException {
if (commandLine.hasOption(parent.getOpt())) {
getConf().set(HConstants.ZOOKEEPER_ZNODE_PARENT, commandLine.getOptionValue(parent.getOpt()));
}
if(commandLine.hasOption(skip.getOpt())){
skipCheck = true;
}

// Now process commands.
String[] commands = commandLine.getArgs();
Expand Down

0 comments on commit 458152d

Please sign in to comment.