[1/2] hbase git commit: Backport "HBASE-21126 Add ability for HBase Canary to ignore a configurable number of ZooKeeper down nodes" to branch-2.0

2018-12-06 Thread stack
Repository: hbase
Updated Branches:
  refs/heads/branch-2 5cb8c3e9c -> f86d311f7


Backport "HBASE-21126 Add ability for HBase Canary to ignore a configurable 
number of ZooKeeper down nodes" to branch-2.0

Signed-off-by: Michael Stack 


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2ebf5ab0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2ebf5ab0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2ebf5ab0

Branch: refs/heads/branch-2
Commit: 2ebf5ab02fda95fde61341db37fede89b0416130
Parents: 5cb8c3e
Author: David Manning 
Authored: Wed Aug 29 12:06:59 2018 -0700
Committer: stack 
Committed: Thu Dec 6 21:20:51 2018 -0800

--
 .../main/java/org/apache/hadoop/hbase/tool/Canary.java   | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/2ebf5ab0/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
--
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 40f4aa6..71af23e 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
@@ -599,7 +599,6 @@ public final class Canary implements Tool {
* True if we are to run in zookeeper 'mode'.
*/
   private boolean zookeeperMode = false;
-
   private long permittedFailures = 0;
   private boolean regionServerAllRegions = false;
   private boolean writeSniffing = false;
@@ -892,6 +891,8 @@ public final class Canary implements Tool {
 "random one.");
 System.err.println(" -zookeeper  set 'zookeeper mode'; grab 
zookeeper.znode.parent on " +
 "each ensemble member");
+System.err.println(" -permittedZookeeperFailures  Ignore first N 
failures when attempting to " +
+"connect to individual zookeeper nodes in the ensemble");
 System.err.println(" -daemon continuous check at defined 
intervals.");
 System.err.println(" -intervalinterval between checks in seconds");
 System.err.println(" -e  consider table/regionserver argument 
as regular " +
@@ -957,8 +958,7 @@ public final class Canary implements Tool {
   monitor =
   new ZookeeperMonitor(connection, monitorTargets, this.useRegExp,
   getSink(connection.getConfiguration(), 
ZookeeperStdOutSink.class),
-  this.executor, this.treatFailureAsError,
-  this.permittedFailures);
+  this.executor, this.treatFailureAsError, this.permittedFailures);
 } else {
   monitor =
   new RegionMonitor(connection, monitorTargets, this.useRegExp,
@@ -1078,10 +1078,9 @@ public final class Canary implements Tool {
 public RegionMonitor(Connection connection, String[] monitorTargets, 
boolean useRegExp,
 Sink sink, ExecutorService executor, boolean writeSniffing, TableName 
writeTableName,
 boolean treatFailureAsError, HashMap 
configuredReadTableTimeouts,
-long configuredWriteTableTimeout,
-long allowedFailures) {
+long configuredWriteTableTimeout, long allowedFailures) {
   super(connection, monitorTargets, useRegExp, sink, executor, 
treatFailureAsError,
-  allowedFailures);
+  allowedFailures);
   Configuration conf = connection.getConfiguration();
   this.writeSniffing = writeSniffing;
   this.writeTableName = writeTableName;



hbase git commit: Backport "HBASE-21126 Add ability for HBase Canary to ignore a configurable number of ZooKeeper down nodes" to branch-2.0

2018-12-05 Thread stack
Repository: hbase
Updated Branches:
  refs/heads/branch-2.0 a93d4be03 -> 14f0f72ac


Backport "HBASE-21126 Add ability for HBase Canary to ignore a configurable 
number of ZooKeeper down nodes" to branch-2.0

Signed-off-by: Michael Stack 


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/14f0f72a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/14f0f72a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/14f0f72a

Branch: refs/heads/branch-2.0
Commit: 14f0f72ac49f986ab80678d8b85589076a9e38c5
Parents: a93d4be
Author: David Manning 
Authored: Wed Aug 29 12:06:59 2018 -0700
Committer: stack 
Committed: Wed Dec 5 22:22:11 2018 -0800

--
 .../org/apache/hadoop/hbase/tool/Canary.java| 50 +++-
 .../hadoop/hbase/tool/TestCanaryTool.java   | 35 +-
 2 files changed, 61 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/14f0f72a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
--
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 66cf637..e6aa0bd 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
@@ -599,6 +599,7 @@ public final class Canary implements Tool {
* True if we are to run in zookeeper 'mode'.
*/
   private boolean zookeeperMode = false;
+  private long permittedFailures = 0;
   private boolean regionServerAllRegions = false;
   private boolean writeSniffing = false;
   private long configuredWriteTableTimeout = DEFAULT_TIMEOUT;
@@ -755,6 +756,19 @@ public final class Canary implements Tool {
 }
 this.configuredReadTableTimeouts.put(nameTimeout[0], timeoutVal);
   }
+} else if (cmd.equals("-permittedZookeeperFailures")) {
+  i++;
+
+  if (i == args.length) {
+System.err.println("-permittedZookeeperFailures needs a numeric 
value argument.");
+printUsageAndExit();
+  }
+  try {
+this.permittedFailures = Long.parseLong(args[i]);
+  } catch (NumberFormatException e) {
+System.err.println("-permittedZookeeperFailures needs a numeric 
value argument.");
+printUsageAndExit();
+  }
 } else {
   // no options match
   System.err.println(cmd + " options is invalid.");
@@ -776,6 +790,10 @@ public final class Canary implements Tool {
 printUsageAndExit();
   }
 }
+if (this.permittedFailures != 0 && !this.zookeeperMode) {
+  System.err.println("-permittedZookeeperFailures requires -zookeeper 
mode.");
+  printUsageAndExit();
+}
 if (!this.configuredReadTableTimeouts.isEmpty() && (this.regionServerMode 
|| this.zookeeperMode)) {
   System.err.println("-readTableTimeouts can only be configured in region 
mode.");
   printUsageAndExit();
@@ -873,6 +891,8 @@ public final class Canary implements Tool {
 "random one.");
 System.err.println(" -zookeeper  set 'zookeeper mode'; grab 
zookeeper.znode.parent on " +
 "each ensemble member");
+System.err.println(" -permittedZookeeperFailures  Ignore first N 
failures when attempting to " +
+"connect to individual zookeeper nodes in the ensemble");
 System.err.println(" -daemon continuous check at defined 
intervals.");
 System.err.println(" -intervalinterval between checks in seconds");
 System.err.println(" -e  consider table/regionserver argument 
as regular " +
@@ -931,19 +951,19 @@ public final class Canary implements Tool {
   new RegionServerMonitor(connection, monitorTargets, this.useRegExp,
   getSink(connection.getConfiguration(), 
RegionServerStdOutSink.class),
   this.executor, this.regionServerAllRegions,
-  this.treatFailureAsError);
+  this.treatFailureAsError, this.permittedFailures);
 } else if (this.zookeeperMode) {
   monitor =
   new ZookeeperMonitor(connection, monitorTargets, this.useRegExp,
   getSink(connection.getConfiguration(), 
ZookeeperStdOutSink.class),
-  this.executor, this.treatFailureAsError);
+  this.executor, this.treatFailureAsError, this.permittedFailures);
 } else {
   monitor =
   new RegionMonitor(connection, monitorTargets, this.useRegExp,
   getSink(connection.getConfiguration(), RegionStdOutSink.class),
   this.executor, this.writeSniffing,
   this.writeTableName, this.treatFailureAsError, 

hbase git commit: Backport "HBASE-21126 Add ability for HBase Canary to ignore a configurable number of ZooKeeper down nodes" to branch-2.0

2018-12-05 Thread stack
Repository: hbase
Updated Branches:
  refs/heads/branch-2.1 7c1f15bd2 -> f60617ca0


Backport "HBASE-21126 Add ability for HBase Canary to ignore a configurable 
number of ZooKeeper down nodes" to branch-2.0

Signed-off-by: Michael Stack 


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/f60617ca
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f60617ca
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f60617ca

Branch: refs/heads/branch-2.1
Commit: f60617ca0f7d142f22aced96f1e7865ae107a291
Parents: 7c1f15b
Author: David Manning 
Authored: Wed Aug 29 12:06:59 2018 -0700
Committer: stack 
Committed: Wed Dec 5 22:19:20 2018 -0800

--
 .../main/java/org/apache/hadoop/hbase/tool/Canary.java   | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/f60617ca/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
--
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 40f4aa6..71af23e 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
@@ -599,7 +599,6 @@ public final class Canary implements Tool {
* True if we are to run in zookeeper 'mode'.
*/
   private boolean zookeeperMode = false;
-
   private long permittedFailures = 0;
   private boolean regionServerAllRegions = false;
   private boolean writeSniffing = false;
@@ -892,6 +891,8 @@ public final class Canary implements Tool {
 "random one.");
 System.err.println(" -zookeeper  set 'zookeeper mode'; grab 
zookeeper.znode.parent on " +
 "each ensemble member");
+System.err.println(" -permittedZookeeperFailures  Ignore first N 
failures when attempting to " +
+"connect to individual zookeeper nodes in the ensemble");
 System.err.println(" -daemon continuous check at defined 
intervals.");
 System.err.println(" -intervalinterval between checks in seconds");
 System.err.println(" -e  consider table/regionserver argument 
as regular " +
@@ -957,8 +958,7 @@ public final class Canary implements Tool {
   monitor =
   new ZookeeperMonitor(connection, monitorTargets, this.useRegExp,
   getSink(connection.getConfiguration(), 
ZookeeperStdOutSink.class),
-  this.executor, this.treatFailureAsError,
-  this.permittedFailures);
+  this.executor, this.treatFailureAsError, this.permittedFailures);
 } else {
   monitor =
   new RegionMonitor(connection, monitorTargets, this.useRegExp,
@@ -1078,10 +1078,9 @@ public final class Canary implements Tool {
 public RegionMonitor(Connection connection, String[] monitorTargets, 
boolean useRegExp,
 Sink sink, ExecutorService executor, boolean writeSniffing, TableName 
writeTableName,
 boolean treatFailureAsError, HashMap 
configuredReadTableTimeouts,
-long configuredWriteTableTimeout,
-long allowedFailures) {
+long configuredWriteTableTimeout, long allowedFailures) {
   super(connection, monitorTargets, useRegExp, sink, executor, 
treatFailureAsError,
-  allowedFailures);
+  allowedFailures);
   Configuration conf = connection.getConfiguration();
   this.writeSniffing = writeSniffing;
   this.writeTableName = writeTableName;