Repository: phoenix Updated Branches: refs/heads/4.4-HBase-1.1 35e15149d -> 02d4ad7ed
PHOENIX-1911 Tests could fail if region and wal did not close on windows (Alicia Ying Shu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/02d4ad7e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/02d4ad7e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/02d4ad7e Branch: refs/heads/4.4-HBase-1.1 Commit: 02d4ad7edcf2dafa8a2b2c63ed08f7a80d5ab402 Parents: 35e1514 Author: Enis Soztutar <[email protected]> Authored: Mon Apr 27 12:50:44 2015 -0700 Committer: Enis Soztutar <[email protected]> Committed: Mon Apr 27 12:59:01 2015 -0700 ---------------------------------------------------------------------- .../recovery/TestPerRegionIndexWriteCache.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/02d4ad7e/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java index f42dbd7..cd28627 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/recovery/TestPerRegionIndexWriteCache.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import java.util.Random; import java.util.Set; import org.apache.hadoop.fs.FileSystem; @@ -50,8 +51,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Multimap; public class TestPerRegionIndexWriteCache { - private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); - private static final TableName tableName = TableName.valueOf("t1"); + private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + private static TableName tableName = TableName.valueOf("t1");; private static final byte[] row = Bytes.toBytes("row"); private static final byte[] family = Bytes.toBytes("family"); private static final byte[] qual = Bytes.toBytes("qual"); @@ -66,6 +67,7 @@ public class TestPerRegionIndexWriteCache { HRegion r1; HRegion r2; + WAL wal; @SuppressWarnings("deprecation") @Before @@ -76,8 +78,10 @@ public class TestPerRegionIndexWriteCache { FileSystem newFS = FileSystem.newInstance(TEST_UTIL.getConfiguration()); HRegionInfo hri = new HRegionInfo(tableName, null, null, false); Path basedir = FSUtils.getTableDir(hbaseRootDir, tableName); + Random rn = new Random(); + tableName = TableName.valueOf("TestPerRegion" + rn.nextInt()); WALFactory walFactory = new WALFactory(TEST_UTIL.getConfiguration(), null, "TestPerRegionIndexWriteCache"); - WAL wal = walFactory.getWAL(Bytes.toBytes("logs")); + wal = walFactory.getWAL(Bytes.toBytes("logs")); HTableDescriptor htd = new HTableDescriptor(tableName); HColumnDescriptor a = new HColumnDescriptor(Bytes.toBytes("a")); htd.addFamily(a); @@ -109,9 +113,15 @@ public class TestPerRegionIndexWriteCache { @After public void cleanUp() throws Exception { - TEST_UTIL.cleanupTestDir(); + try{ + r1.close(); + r2.close(); + wal.close(); + } catch (Exception ignored) {} + FileSystem newFS = FileSystem.get(TEST_UTIL.getConfiguration()); + newFS.delete(TEST_UTIL.getDataTestDir(), true); } - + @Test public void testAddRemoveSingleRegion() {
