You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:05:07 UTC
svn commit: r1181396 - in
/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver:
HRegion.java wal/HLog.java
Author: nspiegelberg
Date: Tue Oct 11 02:05:05 2011
New Revision: 1181396
URL: http://svn.apache.org/viewvc?rev=1181396&view=rev
Log:
HBASE-3081: Log Splitting & Replay - Distinguish between Network IOE and Parsing IOE
Summary:
Originally, if HBase got an IOE from HDFS while splitting or opening a region,
it would abort the operation. The assumption being that this is a network
failure that will likely disappear at a later time or different partition of the
network. However, if HBase gets parsing exceptions, we want to log the problem
and continue opening/splitting the region anyways, because parsing is an
idempotent problem and retries won't fix this issue.
Test Plan:
mvn clean test
DiffCamp Revision: 165921
Reviewed By: kannan
CC: dhruba, kannan
Revert Plan:
OK
Modified:
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
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/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1181396&r1=1181395&r2=1181396&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Tue Oct 11 02:05:05 2011
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
+import java.text.ParseException;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
@@ -2032,11 +2033,15 @@ public class HRegion implements HeapSize
"log spliting, so we have this data in another edit. " +
"Continuing, but renaming " + edits + " as " + p, eof);
} catch (IOException ioe) {
- if (ioe.getMessage().startsWith("File is corrupt")) {
+ // If the IOE resulted from bad file format,
+ // then this problem is idempotent and retrying won't help
+ if (ioe.getCause() instanceof ParseException) {
Path p = HLog.moveAsideBadEditsFile(fs, edits);
LOG.warn("File corruption encountered! " +
"Continuing, but renaming " + edits + " as " + p, ioe);
} else {
+ // other IO errors may be transient (bad network connection,
+ // checksum exception on one datanode, etc). throw & retry
throw ioe;
}
}
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=1181396&r1=1181395&r2=1181396&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 02:05:05 2011
@@ -30,6 +30,7 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -1313,13 +1314,20 @@ public class HLog implements Syncable {
LOG.warn("EOF from hlog " + logPath + ". continuing");
processedLogs.add(logPath);
} catch (IOException e) {
- if (skipErrors) {
- LOG.info("Got while parsing hlog " + logPath +
- ". Marking as corrupted", e);
- corruptedLogs.add(logPath);
- } else {
- throw e;
- }
+ // If the IOE resulted from bad file format,
+ // then this problem is idempotent and retrying won't help
+ if (e.getCause() instanceof ParseException) {
+ LOG.warn("ParseException from hlog " + logPath + ". continuing");
+ processedLogs.add(logPath);
+ } else {
+ if (skipErrors) {
+ LOG.info("Got while parsing hlog " + logPath +
+ ". Marking as corrupted", e);
+ corruptedLogs.add(logPath);
+ } else {
+ throw e;
+ }
+ }
}
}
writeEditsBatchToRegions(editsByRegion, logWriters, rootDir, fs, conf);