From 8d70de20e0d2e81abebd1f65f4b6d518cf0cf09e Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Sun, 30 Dec 2012 17:00:53 +0000 Subject: [PATCH] HBASE-7299 TestMultiParallel fails intermittently in trunk builds (Chunhui) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1426965 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/client/TestMultiParallel.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java index 9d1efff69da..b66ebd6d8a7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java @@ -65,6 +65,7 @@ public class TestMultiParallel { UTIL.startMiniCluster(slaves); HTable t = UTIL.createTable(Bytes.toBytes(TEST_TABLE), Bytes.toBytes(FAMILY)); UTIL.createMultiRegions(t, Bytes.toBytes(FAMILY)); + UTIL.waitTableAvailable(Bytes.toBytes(TEST_TABLE), 15 * 1000); t.close(); } @@ -226,6 +227,11 @@ public class TestMultiParallel { doTestFlushCommits(true); } + /** + * Set table auto flush to false and test flushing commits + * @param doAbort true if abort one regionserver in the testing + * @throws Exception + */ private void doTestFlushCommits(boolean doAbort) throws Exception { // Load the data LOG.info("get new table"); @@ -242,7 +248,14 @@ public class TestMultiParallel { table.flushCommits(); if (doAbort) { LOG.info("Aborted=" + UTIL.getMiniHBaseCluster().abortRegionServer(0)); - + // If we wait for no regions being online after we abort the server, we + // could ensure the master has re-assigned the regions on killed server + // after writing successfully. It means the server we aborted is dead + // and detected by matser + while (UTIL.getMiniHBaseCluster().getRegionServer(0) + .getNumberOfOnlineRegions() != 0) { + Thread.sleep(10); + } // try putting more keys after the abort. same key/qual... just validating // no exceptions thrown puts = constructPutRequests();