hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1479717 - in /hbase/branches/0.95/hbase-server/src: main/java/org/apache/hadoop/hbase/util/FSUtils.java test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
Date Mon, 06 May 2013 23:14:53 GMT
Author: enis
Date: Mon May  6 23:14:53 2013
New Revision: 1479717

URL: http://svn.apache.org/r1479717
Log:
HBASE-8478 HBASE-2231 breaks TestHRegion#testRecoveredEditsReplayCompaction under hadoop2
profile

Modified:
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1479717&r1=1479716&r2=1479717&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
Mon May  6 23:14:53 2013
@@ -1342,7 +1342,9 @@ public abstract class FSUtils {
 
   /**
    * Calls fs.listStatus() and treats FileNotFoundException as non-fatal
-   * This accommodates differences between hadoop versions
+   * This accommodates differences between hadoop versions, where hadoop 1
+   * does not throw a FileNotFoundException, and return an empty FileStatus[]
+   * while Hadoop 2 will throw FileNotFoundException.
    *
    * @param fs file system
    * @param dir directory

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java?rev=1479717&r1=1479716&r2=1479717&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
Mon May  6 23:14:53 2013
@@ -95,6 +95,7 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.test.MetricsAssertHelper;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper;
+import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.util.IncrementingEnvironmentEdge;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.PairOfSameType;
@@ -422,8 +423,11 @@ public class TestHRegion extends HBaseTe
 
       //now find the compacted file, and manually add it to the recovered edits
       Path tmpDir = region.getRegionFileSystem().getTempDir();
-      FileStatus[] files = region.getRegionFileSystem().getFileSystem().listStatus(tmpDir);
-      assertEquals(1, files.length);
+      FileStatus[] files = FSUtils.listStatus(fs, tmpDir);
+      String errorMsg = "Expected to find 1 file in the region temp directory " +
+          "from the compaction, could not find any";
+      assertNotNull(errorMsg, files);
+      assertEquals(errorMsg, 1, files.length);
       //move the file inside region dir
       Path newFile = region.getRegionFileSystem().commitStoreFile(Bytes.toString(family),
files[0].getPath());
 
@@ -459,8 +463,9 @@ public class TestHRegion extends HBaseTe
         LOG.info(sf.getPath());
       }
       assertEquals(1, region.getStore(family).getStorefilesCount());
-      files = region.getRegionFileSystem().getFileSystem().listStatus(tmpDir);
-      assertEquals(0, files.length);
+      files = FSUtils.listStatus(fs, tmpDir);
+      assertTrue("Expected to find 0 files inside " + tmpDir,
+        files == null || files.length == 0);
 
       for (long i = minSeqId; i < maxSeqId; i++) {
         Get get = new Get(Bytes.toBytes(i));
@@ -3176,6 +3181,7 @@ public class TestHRegion extends HBaseTe
       ctx.addThread(new RepeatingTestThread(ctx) {
     	private int flushesSinceCompact = 0;
     	private final int maxFlushesSinceCompact = 20;
+        @Override
         public void doAnAction() throws Exception {
           if (region.flushcache()) {
             ++flushesSinceCompact;



Mime
View raw message