HBASE-1994 Master will lose hlog entries while splitting if region has empty oldlogfile.log

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@887314 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-12-04 18:37:00 +00:00
parent c3eb2c844f
commit 0a09b675d6
2 changed files with 14 additions and 5 deletions

View File

@ -119,6 +119,8 @@ Release 0.21.0 - Unreleased
HBASE-1997 zk tick time bounds maximum zk session time
HBASE-2003 [shell] deleteall ignores column if specified
HBASE-2018 Updates to .META. blocked under high MemStore load
HBASE-1994 Master will lose hlog entries while splitting if region has
empty oldlogfile.log (Lars George via Stack)
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -1158,11 +1158,18 @@ public class HLog implements HConstants, Syncable {
Path oldlogfile = null;
SequenceFile.Reader old = null;
if (fs.exists(logfile)) {
LOG.warn("Old hlog file " + logfile
+ " already exists. Copying existing file to new file");
oldlogfile = new Path(logfile.toString() + ".old");
fs.rename(logfile, oldlogfile);
old = new SequenceFile.Reader(fs, oldlogfile, conf);
FileStatus stat = fs.getFileStatus(logfile);
if (stat.getLen() <= 0) {
LOG.warn("Old hlog file " + logfile + " is zero " +
"length. Deleting existing file");
fs.delete(logfile, false);
} else {
LOG.warn("Old hlog file " + logfile + " already " +
"exists. Copying existing file to new file");
oldlogfile = new Path(logfile.toString() + ".old");
fs.rename(logfile, oldlogfile);
old = new SequenceFile.Reader(fs, oldlogfile, conf);
}
}
SequenceFile.Writer w =
SequenceFile.createWriter(fs, conf, logfile,