From 85c85a81cae38cd3616a2b5f02bca90b6695555f Mon Sep 17 00:00:00 2001 From: Elliott Neil Clark Date: Mon, 13 Jan 2014 11:01:27 -0800 Subject: [PATCH] HBASE-10315 Canary shouldn't exit with 3 if there is no master running. --- .../src/main/java/org/apache/hadoop/hbase/tool/Canary.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java index 2a3b229..b18a5b7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java @@ -243,7 +243,11 @@ public final class Canary implements Tool { // exit if any error occurs if (this.failOnError && monitor.hasError()) { monitorThread.interrupt(); - System.exit(monitor.errorCode); + if (monitor.initialized) { + System.exit(monitor.errorCode); + } else { + System.exit(INIT_ERROR_EXIT_CODE); + } } currentTimeLength = System.currentTimeMillis() - startTime; if (currentTimeLength > this.timeout) { @@ -320,6 +324,7 @@ public final class Canary implements Tool { protected HBaseAdmin admin; protected String[] targets; protected boolean useRegExp; + protected boolean initialized = false; protected boolean done = false; protected int errorCode = 0; @@ -376,6 +381,7 @@ public final class Canary implements Tool { try { if (this.targets != null && this.targets.length > 0) { String[] tables = generateMonitorTables(this.targets); + this.initialized = true; for (String table : tables) { Canary.sniff(admin, sink, table); } @@ -556,6 +562,7 @@ public final class Canary implements Tool { public void run() { if (this.initAdmin() && this.checkNoTableNames()) { Map> rsAndRMap = this.filterRegionServerByName(); + this.initialized = true; this.monitorRegionServers(rsAndRMap); } this.done = true; -- 1.8.4.3