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-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

View File

@ -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 { // , Writable{
"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;
}
}

View File

@ -23,6 +23,7 @@ import static org.apache.hadoop.hbase.util.FSUtils.recoverFileLease;
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,15 +247,22 @@ public class HLogSplitter {
LOG.info("EOF from hlog " + logPath + ". continuing");
processedLogs.add(logPath);
} catch (IOException 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.warn("Got while parsing hlog " + logPath
+ ". Marking as corrupted", e);
LOG.info("Got while parsing hlog " + logPath +
". Marking as corrupted", e);
corruptedLogs.add(logPath);
} else {
throw e;
}
}
}
}
writeEditsBatchToRegions(editsByRegion, logWriters, rootDir, fs, conf);
}
if (fs.listStatus(srcDir).length > processedLogs.size()