hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject svn commit: r1557865 - /hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
Date Mon, 13 Jan 2014 21:51:15 GMT
Author: eclark
Date: Mon Jan 13 21:51:15 2014
New Revision: 1557865

URL: http://svn.apache.org/r1557865
Log:
HBASE-10315 Canary shouldn't exit with 3 if there is no master running.

Modified:
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java?rev=1557865&r1=1557864&r2=1557865&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
Mon Jan 13 21:51:15 2014
@@ -243,14 +243,22 @@ public final class Canary implements Too
         // 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) {
           LOG.error("The monitor is running too long (" + currentTimeLength
               + ") after timeout limit:" + this.timeout
               + " will be killed itself !!");
-          monitor.errorCode = TIMEOUT_ERROR_EXIT_CODE;
+          if (monitor.initialized) {
+            System.exit(TIMEOUT_ERROR_EXIT_CODE);
+          } else {
+            System.exit(INIT_ERROR_EXIT_CODE);
+          }
           break;
         }
       }
@@ -320,6 +328,7 @@ public final class Canary implements Too
     protected HBaseAdmin admin;
     protected String[] targets;
     protected boolean useRegExp;
+    protected boolean initialized = false;
 
     protected boolean done = false;
     protected int errorCode = 0;
@@ -376,6 +385,7 @@ public final class Canary implements Too
         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 +566,7 @@ public final class Canary implements Too
     public void run() {
       if (this.initAdmin() && this.checkNoTableNames()) {
         Map<String, List<HRegionInfo>> rsAndRMap = this.filterRegionServerByName();
+        this.initialized = true;
         this.monitorRegionServers(rsAndRMap);
       }
       this.done = true;



Mime
View raw message