Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 86F8D10760 for ; Fri, 27 Dec 2013 17:27:49 +0000 (UTC) Received: (qmail 42581 invoked by uid 500); 27 Dec 2013 17:26:46 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 42538 invoked by uid 500); 27 Dec 2013 17:26:43 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 42513 invoked by uid 99); 27 Dec 2013 17:26:36 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Dec 2013 17:26:36 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1270B81ADDD; Fri, 27 Dec 2013 17:26:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ujustgotbilld@apache.org To: commits@accumulo.apache.org Date: Fri, 27 Dec 2013 17:26:36 -0000 Message-Id: <62a1cdfd5b604ef29db281d76ef09fea@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: ACCUMULO-2027 Synchronized access to ZooKeeperInstance methods that mutated state Updated Branches: refs/heads/1.5.1-SNAPSHOT 280b6a6de -> 74495249d 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.5.1-SNAPSHOT Commit: 975e8c05e8d11f3848e6c800f4d2772026f6c3a3 Parents: 43ab1ef Author: Bill Slacum Authored: Fri Dec 27 12:05:47 2013 -0500 Committer: Bill Slacum 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 getMasterLocations() { + public synchronized List 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)