hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1181919 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Date Tue, 11 Oct 2011 17:42:02 GMT
Author: nspiegelberg
Date: Tue Oct 11 17:42:02 2011
New Revision: 1181919

URL: http://svn.apache.org/viewvc?rev=1181919&view=rev
Log:
Fix FileNotFoundException in HLog.java

Summary:
When deploying HBase over Avatarnode HDFS the following diff :
D293997 breaks initialization of a region, since it throws an exception
for listStatus() if the parent directory does not exist instead of just
returning null. This results in the region never being opened.

Test Plan: Test on dev cluster.
Reviewed By: nspiegelberg
Reviewers: hkuang, nspiegelberg
CC: hbase@lists, nspiegelberg
Revert Plan:
Tags:

- begin *PUBLIC* platform impact section -
Bugzilla: #
- end platform impact -

Differential Revision: 295918

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java?rev=1181919&r1=1181918&r2=1181919&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java Tue
Oct 11 17:42:02 2011
@@ -1783,23 +1783,26 @@ public class HLog implements Syncable {
       final Path regiondir)
   throws IOException {
     Path editsdir = getRegionDirRecoveredEditsDir(regiondir);
-    FileStatus [] files = fs.listStatus(editsdir, new PathFilter () {
-      @Override
-      public boolean accept(Path p) {
-        boolean result = false;
-        try {
-          // Return files and only files that match the editfile names pattern.
-          // There can be other files in this directory other than edit files.
-          // In particular, on error, we'll move aside the bad edit file giving
-          // it a timestamp suffix.  See moveAsideBadEditsFile.
-          Matcher m = EDITFILES_NAME_PATTERN.matcher(p.getName());
-          result = fs.isFile(p) && m.matches();
-        } catch (IOException e) {
-          LOG.warn("Failed isFile check on " + p);
+    FileStatus [] files = null;
+    if (fs.exists(editsdir)) {
+      files = fs.listStatus(editsdir, new PathFilter () {
+        @Override
+        public boolean accept(Path p) {
+          boolean result = false;
+          try {
+            // Return files and only files that match the editfile names pattern.
+            // There can be other files in this directory other than edit files.
+            // In particular, on error, we'll move aside the bad edit file giving
+            // it a timestamp suffix.  See moveAsideBadEditsFile.
+            Matcher m = EDITFILES_NAME_PATTERN.matcher(p.getName());
+            result = fs.isFile(p) && m.matches();
+          } catch (IOException e) {
+            LOG.warn("Failed isFile check on " + p);
+          }
+          return result;
         }
-        return result;
-      }
-    });
+      });
+    }
     NavigableSet<Path> filesSorted = new TreeSet<Path>();
     if (files == null) return filesSorted;
     for (FileStatus status: files) {



Mime
View raw message