accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ujustgotbi...@apache.org
Subject [1/3] git commit: ACCUMULO-2027 Synchronized access to ZooKeeperInstance methods that mutated state
Date Fri, 27 Dec 2013 17:27:29 GMT
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 7838d4035 -> 4aa48e1cb


ACCUMULO-2027 Synchronized access to ZooKeeperInstance methods that mutated state

The usage pattern of a ZooKeeperInstance is to have many clients use the same
instance. Internall, the ZooKeeperInstances keeps a cache of information in a
ZooCache, which will manage connections to Zookeeper for getting and putting
data.

With the addition of close semantics on the ZKI, it is expected the ZKI will
free resources and halt operations for all clients. This requires ZKI method
calls to be linearizable, otherwise race conditions as described in
ACCUMULO-2027 will occur when a ZKI is simultaneously asked to close and
retrieve information.

This patch resolves that race condition by synchronizing all methods on a ZKI
that interact with an ZKI instance's ZooCache.


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 975e8c05e8d11f3848e6c800f4d2772026f6c3a3
Parents: 43ab1ef
Author: Bill Slacum <billslacum@koverse.com>
Authored: Fri Dec 27 12:05:47 2013 -0500
Committer: Bill Slacum <billslacum@koverse.com>
Committed: Fri Dec 27 12:09:44 2013 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/core/client/ZooKeeperInstance.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/975e8c05/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
b/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index fcadd38..5016acb 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -138,7 +138,7 @@ public class ZooKeeperInstance implements Instance {
   }
 
   @Override
-  public String getInstanceID() {
+  public synchronized String getInstanceID() {
     if (closed)
       throw new RuntimeException("ZooKeeperInstance has been closed.");
     if (instanceId == null) {
@@ -163,7 +163,7 @@ public class ZooKeeperInstance implements Instance {
   }
 
   @Override
-  public List<String> getMasterLocations() {
+  public synchronized List<String> getMasterLocations() {
     if (closed)
       throw new RuntimeException("ZooKeeperInstance has been closed.");
     String masterLocPath = ZooUtil.getRoot(this) + Constants.ZMASTER_LOCK;
@@ -180,7 +180,7 @@ public class ZooKeeperInstance implements Instance {
   }
 
   @Override
-  public String getRootTabletLocation() {
+  public synchronized String getRootTabletLocation() {
     if (closed)
       throw new RuntimeException("ZooKeeperInstance has been closed.");
     String zRootLocPath = ZooUtil.getRoot(this) + Constants.ZROOT_TABLET_LOCATION;
@@ -197,7 +197,7 @@ public class ZooKeeperInstance implements Instance {
   }
 
   @Override
-  public String getInstanceName() {
+  public synchronized String getInstanceName() {
     if (closed)
       throw new RuntimeException("ZooKeeperInstance has been closed.");
     if (instanceName == null)


Mime
View raw message