From 0864c33f1e77a78b838efddc48f0b32bdceb3ff4 Mon Sep 17 00:00:00 2001 From: zhangduo Date: Sat, 23 Jun 2018 20:48:48 +0800 Subject: [PATCH] HBASE-20777 TestAsyncTableBatch is flakey --- .../org/apache/hadoop/hbase/client/TestAsyncTableBatch.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java index 3a7614b..99dac35 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java @@ -42,6 +42,7 @@ import java.util.stream.IntStream; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.coprocessor.ObserverContext; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessor; @@ -109,6 +110,11 @@ public class TestAsyncTableBatch { @BeforeClass public static void setUp() throws Exception { + TEST_UTIL.getConfiguration().setLong(HConstants.HBASE_RPC_TIMEOUT_KEY, 1000); + TEST_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, 1000); + TEST_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 100); + TEST_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_META_OPERATION_TIMEOUT, 60000); + TEST_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, 60000); TEST_UTIL.startMiniCluster(3); SPLIT_KEYS = new byte[8][]; for (int i = 111; i < 999; i += 111) { @@ -125,6 +131,7 @@ public class TestAsyncTableBatch { @Before public void setUpBeforeTest() throws IOException, InterruptedException { + TEST_UTIL.ensureSomeRegionServersAvailable(3); TEST_UTIL.createTable(TABLE_NAME, FAMILY, SPLIT_KEYS); TEST_UTIL.waitTableAvailable(TABLE_NAME); } @@ -190,7 +197,7 @@ public class TestAsyncTableBatch { table.putAll(IntStream.range(0, COUNT) .mapToObj(i -> new Put(getRow(i)).addColumn(FAMILY, CQ, Bytes.toBytes(i))) .collect(Collectors.toList())).get(); - TEST_UTIL.getMiniHBaseCluster().getRegionServer(0).abort("Aborting for tests"); + TEST_UTIL.getMiniHBaseCluster().abortRegionServer(0); Thread.sleep(100); table.putAll(IntStream.range(COUNT, 2 * COUNT) .mapToObj(i -> new Put(getRow(i)).addColumn(FAMILY, CQ, Bytes.toBytes(i))) @@ -222,8 +229,8 @@ public class TestAsyncTableBatch { actions.add(new Increment(Bytes.toBytes(3)).addColumn(FAMILY, CQ, 1)); actions.add(new Append(Bytes.toBytes(4)).addColumn(FAMILY, CQ, Bytes.toBytes(4))); RowMutations rm = new RowMutations(Bytes.toBytes(5)); - rm.add(new Put(Bytes.toBytes(5)).addColumn(FAMILY, CQ, Bytes.toBytes(100L))); - rm.add(new Put(Bytes.toBytes(5)).addColumn(FAMILY, CQ1, Bytes.toBytes(200L))); + rm.add((Mutation) new Put(Bytes.toBytes(5)).addColumn(FAMILY, CQ, Bytes.toBytes(100L))); + rm.add((Mutation) new Put(Bytes.toBytes(5)).addColumn(FAMILY, CQ1, Bytes.toBytes(200L))); actions.add(rm); actions.add(new Get(Bytes.toBytes(6))); -- 2.7.4