HBASE-3081 Log Splitting & Replay: Distinguish between Network IOE and Parsing IOE

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1023186 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-10-16 05:35:27 +00:00
parent 63ba21eca5
commit aab46757ec
3 changed files with 21 additions and 6 deletions

View File

@ -588,6 +588,8 @@ Release 0.21.0 - Unreleased
HBASE-3113 Don't reassign regions if cluster is being shutdown HBASE-3113 Don't reassign regions if cluster is being shutdown
HBASE-2933 Skip EOF Errors during Log Recovery HBASE-2933 Skip EOF Errors during Log Recovery
(Nicolas Spiegelberg via Stack) (Nicolas Spiegelberg via Stack)
HBASE-3081 Log Splitting & Replay: Distinguish between Network IOE and
Parsing IOE (Nicolas Spiegelberg via Stack)
IMPROVEMENTS IMPROVEMENTS

View File

@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.text.ParseException;
import java.util.AbstractList; import java.util.AbstractList;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -1870,11 +1871,15 @@ public class HRegion implements HeapSize { // , Writable{
"log spliting, so we have this data in another edit. " + "log spliting, so we have this data in another edit. " +
"Continuing, but renaming " + edits + " as " + p, eof); "Continuing, but renaming " + edits + " as " + p, eof);
} catch (IOException ioe) { } 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); Path p = HLog.moveAsideBadEditsFile(fs, edits);
LOG.warn("File corruption encountered! " + LOG.warn("File corruption encountered! " +
"Continuing, but renaming " + edits + " as " + p, ioe); "Continuing, but renaming " + edits + " as " + p, ioe);
} else { } else {
// other IO errors may be transient (bad network connection,
// checksum exception on one datanode, etc). throw & retry
throw ioe; throw ioe;
} }
} }

View File

@ -23,6 +23,7 @@ import static org.apache.hadoop.hbase.util.FSUtils.recoverFileLease;
import java.io.EOFException; import java.io.EOFException;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -246,12 +247,19 @@ public class HLogSplitter {
LOG.info("EOF from hlog " + logPath + ". continuing"); LOG.info("EOF from hlog " + logPath + ". continuing");
processedLogs.add(logPath); processedLogs.add(logPath);
} catch (IOException e) { } catch (IOException e) {
if (skipErrors) { // If the IOE resulted from bad file format,
LOG.warn("Got while parsing hlog " + logPath // then this problem is idempotent and retrying won't help
+ ". Marking as corrupted", e); if (e.getCause() instanceof ParseException) {
corruptedLogs.add(logPath); LOG.warn("ParseException from hlog " + logPath + ". continuing");
processedLogs.add(logPath);
} else { } else {
throw e; if (skipErrors) {
LOG.info("Got while parsing hlog " + logPath +
". Marking as corrupted", e);
corruptedLogs.add(logPath);
} else {
throw e;
}
} }
} }
} }