diff --git src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java index 227d243..041bb87 100644 --- src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java +++ src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java @@ -240,12 +240,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()); @@ -266,6 +274,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); } }); @@ -355,7 +372,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; }