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 AA4FB10E50 for ; Tue, 14 Jan 2014 20:48:58 +0000 (UTC) Received: (qmail 86112 invoked by uid 500); 14 Jan 2014 20:48:46 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 85936 invoked by uid 500); 14 Jan 2014 20:48:42 -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 85825 invoked by uid 99); 14 Jan 2014 20:48:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jan 2014 20:48:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CDED88BE9BD; Tue, 14 Jan 2014 20:48:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhavanki@apache.org To: commits@accumulo.apache.org Date: Tue, 14 Jan 2014 20:48:47 -0000 Message-Id: <1c383a642c594dad9d10d668bbc0a488@git.apache.org> In-Reply-To: <3a410955b44143c0bc684c95203b5ed5@git.apache.org> References: <3a410955b44143c0bc684c95203b5ed5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [09/17] git commit: ACCUMULO-2182 Backport ACCUMULO-2104 and ACCUMULO-2106 to 1.5.x ACCUMULO-2182 Backport ACCUMULO-2104 and ACCUMULO-2106 to 1.5.x This commit is an adaption of the backport to 1.4.x, adapted due to files moving between the releases. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a3eae058 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a3eae058 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a3eae058 Branch: refs/heads/master Commit: a3eae058d8fff13c768aa7ae1828cee617426878 Parents: 0603edb Author: Bill Havanki Authored: Tue Jan 14 15:43:53 2014 -0500 Committer: Bill Havanki Committed: Tue Jan 14 15:43:53 2014 -0500 ---------------------------------------------------------------------- .../org/apache/accumulo/test/randomwalk/State.java | 13 +++++++++++++ .../test/randomwalk/image/ImageFixture.java | 17 ++++++++++++++++- .../randomwalk/multitable/MultiTableFixture.java | 14 ++++++++++++++ .../randomwalk/sequential/SequentialFixture.java | 14 ++++++++++++++ .../test/randomwalk/shard/ShardFixture.java | 15 +++++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/a3eae058/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java index d31d88b..65d26c6 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java @@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.MultiTableBatchWriter; +import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; @@ -143,6 +144,18 @@ public class State { return mtbw; } + public boolean isMultiTableBatchWriterInitialized() { + return mtbw != null; + } + + public void resetMultiTableBatchWriter() { + if (!mtbw.isClosed()) { + log.warn("Setting non-closed MultiTableBatchWriter to null (leaking resources)"); + } + + mtbw = null; + } + public String getMapReduceJars() { String acuHome = System.getenv("ACCUMULO_HOME"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a3eae058/test/src/main/java/org/apache/accumulo/test/randomwalk/image/ImageFixture.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/image/ImageFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/image/ImageFixture.java index 5dc8928..86df45d 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/image/ImageFixture.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/image/ImageFixture.java @@ -27,6 +27,8 @@ import java.util.TreeSet; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.MultiTableBatchWriter; +import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.test.randomwalk.Fixture; @@ -105,7 +107,20 @@ public class ImageFixture extends Fixture { @Override public void tearDown(State state) throws Exception { - + // We have resources we need to clean up + if (state.isMultiTableBatchWriterInitialized()) { + MultiTableBatchWriter mtbw = state.getMultiTableBatchWriter(); + try { + mtbw.close(); + } catch (MutationsRejectedException e) { + log.error("Ignoring mutations that weren't flushed", e); + } + + // Reset the MTBW on the state to null + state.resetMultiTableBatchWriter(); + } + + // Now we can safely delete the tables log.debug("Dropping tables: " + imageTableName + " " + indexTableName); Connector conn = state.getConnector(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a3eae058/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/MultiTableFixture.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/MultiTableFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/MultiTableFixture.java index 01ebdd7..ee0fff6 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/MultiTableFixture.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/MultiTableFixture.java @@ -20,6 +20,8 @@ import java.net.InetAddress; import java.util.ArrayList; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.MultiTableBatchWriter; +import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.test.randomwalk.Fixture; import org.apache.accumulo.test.randomwalk.State; @@ -40,6 +42,18 @@ public class MultiTableFixture extends Fixture { @Override public void tearDown(State state) throws Exception { + // We have resources we need to clean up + if (state.isMultiTableBatchWriterInitialized()) { + MultiTableBatchWriter mtbw = state.getMultiTableBatchWriter(); + try { + mtbw.close(); + } catch (MutationsRejectedException e) { + log.error("Ignoring mutations that weren't flushed", e); + } + + // Reset the MTBW on the state to null + state.resetMultiTableBatchWriter(); + } Connector conn = state.getConnector(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a3eae058/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/SequentialFixture.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/SequentialFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/SequentialFixture.java index 2b89264..b7377b7 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/SequentialFixture.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/SequentialFixture.java @@ -20,6 +20,8 @@ import java.net.InetAddress; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.MultiTableBatchWriter; +import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.test.randomwalk.Fixture; @@ -55,6 +57,18 @@ public class SequentialFixture extends Fixture { @Override public void tearDown(State state) throws Exception { + // We have resources we need to clean up + if (state.isMultiTableBatchWriterInitialized()) { + MultiTableBatchWriter mtbw = state.getMultiTableBatchWriter(); + try { + mtbw.close(); + } catch (MutationsRejectedException e) { + log.error("Ignoring mutations that weren't flushed", e); + } + + // Reset the MTBW on the state to null + state.resetMultiTableBatchWriter(); + } log.debug("Dropping tables: " + seqTableName); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a3eae058/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/ShardFixture.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/ShardFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/ShardFixture.java index 8de30ae..97e33b4 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/ShardFixture.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/ShardFixture.java @@ -22,6 +22,8 @@ import java.util.SortedSet; import java.util.TreeSet; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.MultiTableBatchWriter; +import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.test.randomwalk.Fixture; import org.apache.accumulo.test.randomwalk.State; @@ -94,6 +96,19 @@ public class ShardFixture extends Fixture { @Override public void tearDown(State state) throws Exception { + // We have resources we need to clean up + if (state.isMultiTableBatchWriterInitialized()) { + MultiTableBatchWriter mtbw = state.getMultiTableBatchWriter(); + try { + mtbw.close(); + } catch (MutationsRejectedException e) { + log.error("Ignoring mutations that weren't flushed", e); + } + + // Reset the MTBW on the state to null + state.resetMultiTableBatchWriter(); + } + Connector conn = state.getConnector(); conn.tableOperations().delete((String) state.get("indexTableName"));