From 39c0b8f6db2c609fcc74f09ece00fdfb8c5aa003 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Fri, 2 Oct 2015 13:28:59 -0700 Subject: [PATCH] HBASE-13744 TestCorruptedRegionStoreFile is flaky --- .../TestCorruptedRegionStoreFile.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCorruptedRegionStoreFile.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCorruptedRegionStoreFile.java index 8c9312c0712..7d1a39c12b4 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCorruptedRegionStoreFile.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCorruptedRegionStoreFile.java @@ -28,6 +28,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; @@ -50,9 +51,7 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; @Category({MasterTests.class, LargeTests.class}) public class TestCorruptedRegionStoreFile { @@ -63,7 +62,7 @@ public class TestCorruptedRegionStoreFile { private static final String FAMILY_NAME_STR = "f"; private static final byte[] FAMILY_NAME = Bytes.toBytes(FAMILY_NAME_STR); - private static final int NUM_FILES = 25; + private static final int NUM_FILES = 10; private static final int ROW_PER_FILE = 2000; private static final int NUM_ROWS = NUM_FILES * ROW_PER_FILE; @@ -74,9 +73,9 @@ public class TestCorruptedRegionStoreFile { private int rowCount; private static void setupConf(Configuration conf) { - conf.setLong("hbase.hstore.compaction.min", 20); - conf.setLong("hbase.hstore.compaction.max", 39); - conf.setLong("hbase.hstore.blockingStoreFiles", 40); + // Disable compaction so the store file count stays constant + conf.setLong("hbase.hstore.compactionThreshold", NUM_FILES + 1); + conf.setLong("hbase.hstore.blockingStoreFiles", NUM_FILES * 2); } private void setupTable(final TableName tableName) throws IOException { @@ -94,6 +93,7 @@ public class TestCorruptedRegionStoreFile { if ((rowCount++ % ROW_PER_FILE) == 0) { // flush it + ((HTable)table).flushCommits(); UTIL.getHBaseAdmin().flush(tableName); } } @@ -115,8 +115,8 @@ public class TestCorruptedRegionStoreFile { storeFiles.add(link.getOriginPath()); } }); - assertTrue("expected at least 1 store file", storeFiles.size() > 0); - LOG.info("store-files: " + storeFiles); + assertTrue("Expected at least " + NUM_FILES + " store files", storeFiles.size() >= NUM_FILES); + LOG.info("Store files: " + storeFiles); } @Before