hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-18377 Error handling for FileNotFoundException should consider RemoteException in openReader()
Date Tue, 18 Jul 2017 13:53:01 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 0616811fa -> ce677583d


HBASE-18377 Error handling for FileNotFoundException should consider RemoteException in openReader()


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ce677583
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ce677583
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ce677583

Branch: refs/heads/branch-1.4
Commit: ce677583deac236fa94b3edbb8e61a4095e43831
Parents: 0616811
Author: tedyu <yuzhihong@gmail.com>
Authored: Tue Jul 18 06:52:54 2017 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Tue Jul 18 06:52:54 2017 -0700

----------------------------------------------------------------------
 .../regionserver/WALEntryStream.java            | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ce677583/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
index c4d552c..4f49955 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
@@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.util.LeaseNotRecoveredException;
 import org.apache.hadoop.hbase.wal.WAL.Entry;
 import org.apache.hadoop.hbase.wal.WAL.Reader;
 import org.apache.hadoop.hbase.wal.WALFactory;
+import org.apache.hadoop.ipc.RemoteException;
 
 /**
  * Streaming access to WAL entries. This class is given a queue of WAL {@link Path}, and
continually
@@ -316,6 +317,15 @@ public class WALEntryStream implements Iterator<Entry>, Closeable,
Iterable<Entr
     }
   }
 
+  private void handleFileNotFound(Path path, FileNotFoundException fnfe) throws IOException
{
+    // If the log was archived, continue reading from there
+    Path archivedLog = getArchivedLog(path);
+    if (!path.equals(archivedLog)) {
+      openReader(archivedLog);
+    } else {
+      throw fnfe;
+    }
+  }
   private void openReader(Path path) throws IOException {
     try {
       // Detect if this is a new file, if so get a new reader else
@@ -329,13 +339,11 @@ public class WALEntryStream implements Iterator<Entry>, Closeable,
Iterable<Entr
         resetReader();
       }
     } catch (FileNotFoundException fnfe) {
-      // If the log was archived, continue reading from there
-      Path archivedLog = getArchivedLog(path);
-      if (!path.equals(archivedLog)) {
-        openReader(archivedLog);
-      } else {
-        throw fnfe;
-      }
+      handleFileNotFound(path, fnfe);
+    }  catch (RemoteException re) {
+      IOException ioe = re.unwrapRemoteException(FileNotFoundException.class);
+      if (!(ioe instanceof FileNotFoundException)) throw ioe;
+      handleFileNotFound(path, (FileNotFoundException)ioe);
     } catch (LeaseNotRecoveredException lnre) {
       // HBASE-15019 the WAL was not closed due to some hiccup.
       LOG.warn("Try to recover the WAL lease " + currentPath, lnre);


Mime
View raw message