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 e4d6c1b4618..051c442683a 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 @@ -235,12 +235,20 @@ public class TestAcidGuarantees implements Tool { } } - public void runTestAtomicity(long millisToRun, int numWriters, int numGetters, int numScanners, int numUniqueRows) throws Exception { + runTestAtomicity(millisToRun, numWriters, numGetters, numScanners, numUniqueRows, false); + } + + public void runTestAtomicity(long millisToRun, + int numWriters, + int numGetters, + int numScanners, + int numUniqueRows, + final boolean systemTest) throws Exception { createTableIfMissing(); TestContext ctx = new TestContext(util.getConfiguration()); @@ -261,6 +269,15 @@ public class TestAcidGuarantees implements Tool { HBaseAdmin admin = new HBaseAdmin(util.getConfiguration()); public void doAnAction() throws Exception { admin.flush(TABLE_NAME); + // Flushing has been a source of ACID violations previously (see HBASE-2856), so ideally, + // we would flush as often as possible. On a running cluster, this isn't practical: + // (1) we will cause a lot of load due to all the flushing and compacting + // (2) we cannot change the flushing/compacting related Configuration options to try to + // alleviate this + // (3) it is an unrealistic workload, since no one would actually flush that often. + // Therefore, let's flush every minute to have more flushes than usual, but not overload + // the running cluster. + if (systemTest) Thread.sleep(60000); } }); @@ -350,7 +367,7 @@ public class TestAcidGuarantees implements Tool { int numGetters = c.getInt("numGetters", 2); int numScanners = c.getInt("numScanners", 2); int numUniqueRows = c.getInt("numUniqueRows", 3); - runTestAtomicity(millis, numWriters, numGetters, numScanners, numUniqueRows); + runTestAtomicity(millis, numWriters, numGetters, numScanners, numUniqueRows, true); return 0; }