hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1154658 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/util/FSUtils.java src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
Date Sun, 07 Aug 2011 05:52:54 GMT
Author: stack
Date: Sun Aug  7 05:52:54 2011
New Revision: 1154658

URL: http://svn.apache.org/viewvc?rev=1154658&view=rev
Log:
HBASE-4162 Fix TestHRegionInfo.testGetSetOfHTD: delete /tmp/hbase-<username> if it already
exists.

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1154658&r1=1154657&r2=1154658&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun Aug  7 05:52:54 2011
@@ -190,6 +190,8 @@ Release 0.91.0 - Unreleased
    HBASE-4159  HBaseServer - IPC Reader threads are not daemons (Douglas
                Campbell)
    HBASE-4171  HBase shell broken in trunk (Lars Hofhansl)
+   HBASE-4162  Fix TestHRegionInfo.testGetSetOfHTD: delete /tmp/hbase-<username>
+               if it already exists (Mikhail Bautin)
 
   IMPROVEMENTS
    HBASE-3290  Max Compaction Size (Nicolas Spiegelberg via Stack)  

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1154658&r1=1154657&r2=1154658&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Sun Aug  7 05:52:54
2011
@@ -1004,6 +1004,18 @@ public class FSUtils {
   }
 
   /**
+   * Deletes a table's directory from the file system if exists. Used in unit
+   * tests.
+   */
+  public static void deleteTableDescriptorIfExists(String tableName,
+      Configuration conf) throws IOException {
+    FileSystem fs = getCurrentFileSystem(conf);
+    Path tableInfoPath = getTableInfoPath(getRootDir(conf), tableName);
+    if (fs.exists(tableInfoPath))
+      deleteDirectory(fs, tableInfoPath);
+  }
+
+  /**
    * Called when we are creating a table to write out the tables' descriptor.
    * @param fs
    * @param hTableDescriptor

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java?rev=1154658&r1=1154657&r2=1154658&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java Sun
Aug  7 05:52:54 2011
@@ -25,6 +25,8 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.IOException;
+
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -60,9 +62,15 @@ public class TestHRegionInfo {
   }
   
   @Test
-  public void testGetSetOfHTD() {
+  public void testGetSetOfHTD() throws IOException {
     HBaseTestingUtility HTU = new HBaseTestingUtility();
     final String tablename = "testGetSetOfHTD";
+
+    // Delete the temporary table directory that might still be there from the
+    // previous test run.
+    FSUtils.deleteTableDescriptorIfExists(tablename,
+        HTU.getConfiguration());
+
     HTableDescriptor htd = new HTableDescriptor(tablename);
     FSUtils.createTableDescriptor(htd, HTU.getConfiguration());
     HRegionInfo hri = new HRegionInfo(Bytes.toBytes("testGetSetOfHTD"),



Mime
View raw message