hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r887316 - in /hadoop/hbase/branches/0.20: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/HLog.java
Date Fri, 04 Dec 2009 18:39:27 GMT
Author: stack
Date: Fri Dec  4 18:39:26 2009
New Revision: 887316

URL: http://svn.apache.org/viewvc?rev=887316&view=rev
Log:
HBASE-1994 Master will lose hlog entries while splitting if region has empty oldlogfile.log

Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HLog.java

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=887316&r1=887315&r2=887316&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Fri Dec  4 18:39:26 2009
@@ -9,6 +9,8 @@
    HBASE-1997  zk tick time bounds maximum zk session time
    HBASE-1979  MurmurHash does not yield the same results as the reference
                C++ implementation when size % 4 >= 2 (Olivier Gillet via Stack)
+   HBASE-1994  Master will lose hlog entries while splitting if region has
+               empty oldlogfile.log (Lars George via Stack)
 
   IMPROVEMENTS
    HBASE-1961  HBase EC2 scripts

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HLog.java?rev=887316&r1=887315&r2=887316&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HLog.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HLog.java Fri
Dec  4 18:39:26 2009
@@ -968,11 +968,18 @@
                     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,



Mime
View raw message