Author: stack
Date: Sat Oct 16 05:35:27 2010
New Revision: 1023186
URL: http://svn.apache.org/viewvc?rev=1023186&view=rev
Log:
HBASE-3081 Log Splitting & Replay: Distinguish between Network IOE and Parsing
IOE
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
Modified: hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1023186&r1=1023185&r2=1023186&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sat Oct 16 05:35:27 2010
@@ -588,6 +588,8 @@ Release 0.21.0 - Unreleased
HBASE-3113 Don't reassign regions if cluster is being shutdown
HBASE-2933 Skip EOF Errors during Log Recovery
(Nicolas Spiegelberg via Stack)
+ HBASE-3081 Log Splitting & Replay: Distinguish between Network IOE and
+ Parsing IOE (Nicolas Spiegelberg via Stack)
IMPROVEMENTS
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1023186&r1=1023185&r2=1023186&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Sat Oct 16 05:35:27 2010
@@ -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;
@@ -1870,11 +1871,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/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java?rev=1023186&r1=1023185&r2=1023186&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
Sat Oct 16 05:35:27 2010
@@ -23,6 +23,7 @@ import static org.apache.hadoop.hbase.ut
import java.io.EOFException;
import java.io.IOException;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -246,12 +247,19 @@ public class HLogSplitter {
LOG.info("EOF from hlog " + logPath + ". continuing");
processedLogs.add(logPath);
} catch (IOException e) {
- if (skipErrors) {
- LOG.warn("Got while parsing hlog " + logPath
- + ". Marking as corrupted", e);
- corruptedLogs.add(logPath);
+ // 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 {
- throw e;
+ if (skipErrors) {
+ LOG.info("Got while parsing hlog " + logPath +
+ ". Marking as corrupted", e);
+ corruptedLogs.add(logPath);
+ } else {
+ throw e;
+ }
}
}
}