You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by en...@apache.org on 2015/04/27 21:51:25 UTC

phoenix git commit: PHOENIX-1911 Tests could fail if region and wal did not close on windows (Alicia Ying Shu)

Repository: phoenix
Updated Branches:
  refs/heads/master 986b87f37 -> 0e87d666f


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/0e87d666
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0e87d666
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0e87d666

Branch: refs/heads/master
Commit: 0e87d666fc7b50fec132838535b48efe3aa15608
Parents: 986b87f
Author: Enis Soztutar <en...@apache.org>
Authored: Mon Apr 27 12:50:44 2015 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Mon Apr 27 12:50:48 2015 -0700

----------------------------------------------------------------------
 .../recovery/TestPerRegionIndexWriteCache.java  | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0e87d666/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() {