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
This commit is contained in:
Jonathan Hsieh 2012-08-09 21:52:19 +00:00
parent a77305afda
commit 21d473f356
1 changed files with 8 additions and 18 deletions

View File

@ -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) {
HBaseAdmin admin = new HBaseAdmin(util.getConfiguration());
public void doAnAction() throws Exception {
util.flush();
admin.flush(TABLE_NAME);
}
});
}
List<AtomicGetReader> 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;
}