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 2B3C817D57 for ; Wed, 22 Apr 2015 22:34:25 +0000 (UTC) Received: (qmail 70470 invoked by uid 500); 22 Apr 2015 22:34:25 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 70371 invoked by uid 500); 22 Apr 2015 22:34:25 -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 70223 invoked by uid 99); 22 Apr 2015 22:34:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2015 22:34:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CDD44DFF0B; Wed, 22 Apr 2015 22:34:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kturner@apache.org To: commits@accumulo.apache.org Date: Wed, 22 Apr 2015 22:34:24 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/4] accumulo git commit: ACCUMULO-3745 Always obtain locks in same order in SourceSwitching iter Repository: accumulo Updated Branches: refs/heads/master 9abf6a318 -> 58cfee84d ACCUMULO-3745 Always obtain locks in same order in SourceSwitching iter [~ecn] and I sat together and fixed this. We are not sure how to test. We both visually analyzed all locking to ensure it was done in the same order. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/95e234c7 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/95e234c7 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/95e234c7 Branch: refs/heads/master Commit: 95e234c7e468d61211d6f1d65ee1955d2bf53a9b Parents: fca7cb4 Author: Keith Turner Authored: Wed Apr 22 15:05:06 2015 -0400 Committer: Keith Turner Committed: Wed Apr 22 15:05:06 2015 -0400 ---------------------------------------------------------------------- .../system/SourceSwitchingIterator.java | 29 +++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/95e234c7/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java index 6c40176..7684352 100644 --- a/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java @@ -69,11 +69,11 @@ public class SourceSwitchingIterator implements SortedKeyValueIterator())); + copies.add(this); } public SourceSwitchingIterator(DataSource source) { @@ -81,8 +81,14 @@ public class SourceSwitchingIterator implements SortedKeyValueIterator deepCopy(IteratorEnvironment env) { - return new SourceSwitchingIterator(source.getDeepCopyDataSource(env), onlySwitchAfterRow, copies); + public SortedKeyValueIterator deepCopy(IteratorEnvironment env) { + synchronized (copies) { + synchronized(this){ + SourceSwitchingIterator ssi = new SourceSwitchingIterator(source.getDeepCopyDataSource(env), onlySwitchAfterRow, copies); + copies.add(ssi); + return ssi; + } + } } @Override @@ -186,14 +192,17 @@ public class SourceSwitchingIterator implements SortedKeyValueIterator