hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [1/2] git commit: HBASE-11341 ZKProcedureCoordinatorRpcs should respond only to members
Date Tue, 17 Jun 2014 10:35:46 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 6104fe767 -> 2773118ea
  refs/heads/master 463fc9fbd -> 6304eb2cc


HBASE-11341 ZKProcedureCoordinatorRpcs should respond only to members


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

Branch: refs/heads/master
Commit: 6304eb2ccee33b137950999c39720bc68a170e25
Parents: 463fc9f
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Tue Jun 17 11:17:33 2014 +0100
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Tue Jun 17 11:17:33 2014 +0100

----------------------------------------------------------------------
 .../hadoop/hbase/procedure/ZKProcedureUtil.java  | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6304eb2c/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java
index 7d46625..f3a483a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java
@@ -184,7 +184,8 @@ public abstract class ZKProcedureUtil
    * Is this in the procedure barrier acquired znode path
    */
   boolean isAcquiredPathNode(String path) {
-    return path.startsWith(this.acquiredZnode) && !path.equals(acquiredZnode);
+    return path.startsWith(this.acquiredZnode) && !path.equals(acquiredZnode) &&
+      isMemberNode(path, acquiredZnode);
   }
 
   /**
@@ -198,9 +199,23 @@ public abstract class ZKProcedureUtil
    * Is this in the procedure barrier reached znode path
    */
   boolean isReachedPathNode(String path) {
-    return path.startsWith(this.reachedZnode) && !path.equals(reachedZnode);
+    return path.startsWith(this.reachedZnode) && !path.equals(reachedZnode) &&
+      isMemberNode(path, reachedZnode);
   }
 
+  /*
+   * Returns true if the specified path is a member of the "statePath"
+   *      /hbase/<ProcName>/<state>/<instance>/member
+   *      |------ state path -----|
+   *      |------------------ path ------------------|
+   */
+  private boolean isMemberNode(final String path, final String statePath) {
+    int count = 0;
+    for (int i = statePath.length(); i < path.length(); ++i) {
+      count += (path.charAt(i) == ZKUtil.ZNODE_PATH_SEPARATOR) ? 1 : 0;
+    }
+    return count == 2;
+  }
 
   /**
    * Is this in the procedure barrier abort znode path


Mime
View raw message