From 21d473f356ce7b2ab0e6fd776a15cd5054c0ad67 Mon Sep 17 00:00:00 2001 From: Jonathan Hsieh Date: Thu, 9 Aug 2012 21:52:19 +0000 Subject: [PATCH] HBASE-6552 TestAcidGuarantees system test should flush more aggressively (Gregory Chanan) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1371501 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/TestAcidGuarantees.java | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java index 10039f59de1..ad4f8e5596f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java @@ -30,6 +30,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.MultithreadedTestUtil.RepeatingTestThread; import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; import org.apache.hadoop.hbase.client.Get; +import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; @@ -241,15 +242,6 @@ public class TestAcidGuarantees implements Tool { int numGetters, int numScanners, int numUniqueRows) throws Exception { - runTestAtomicity(millisToRun, numWriters, numGetters, numScanners, - numUniqueRows, true); - } - - public void runTestAtomicity(long millisToRun, - int numWriters, - int numGetters, - int numScanners, - int numUniqueRows, boolean useFlusher) throws Exception { createTableIfMissing(); TestContext ctx = new TestContext(util.getConfiguration()); @@ -266,13 +258,12 @@ public class TestAcidGuarantees implements Tool { ctx.addThread(writer); } // Add a flusher - if (useFlusher) { - ctx.addThread(new RepeatingTestThread(ctx) { - public void doAnAction() throws Exception { - util.flush(); - } - }); - } + ctx.addThread(new RepeatingTestThread(ctx) { + HBaseAdmin admin = new HBaseAdmin(util.getConfiguration()); + public void doAnAction() throws Exception { + admin.flush(TABLE_NAME); + } + }); List getters = Lists.newArrayList(); for (int i = 0; i < numGetters; i++) { @@ -360,8 +351,7 @@ public class TestAcidGuarantees implements Tool { int numGetters = c.getInt("numGetters", 2); int numScanners = c.getInt("numScanners", 2); int numUniqueRows = c.getInt("numUniqueRows", 3); - // cannot run flusher in real cluster case. - runTestAtomicity(millis, numWriters, numGetters, numScanners, numUniqueRows, false); + runTestAtomicity(millis, numWriters, numGetters, numScanners, numUniqueRows); return 0; }