From ddb51af35508c080f69a2106a2b4423c14a19aae Mon Sep 17 00:00:00 2001 From: pritam Date: Wed, 3 Aug 2011 22:03:01 +0000 Subject: [PATCH] Fix FileNotFoundException in HLog.java --- .../apache/hadoop/hbase/regionserver/wal/HLog.java | 35 +++++++++++--------- 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/VENDOR.hbase/hbase-trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java b/VENDOR.hbase/hbase-trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java index f842367..6cbc3c4 100644 --- a/VENDOR.hbase/hbase-trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java +++ b/VENDOR.hbase/hbase-trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java @@ -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 filesSorted = new TreeSet(); if (files == null) return filesSorted; for (FileStatus status: files) { -- 1.7.4