hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1342019 - /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
Date Wed, 23 May 2012 20:17:44 GMT
Author: tedyu
Date: Wed May 23 20:17:44 2012
New Revision: 1342019

URL: http://svn.apache.org/viewvc?rev=1342019&view=rev
Log:
HBASE-6065 Log for flush would append a non-sequential edit in the hlog, leading to possible
data loss (Chunhui)

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java

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=1342019&r1=1342018&r2=1342019&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 Wed
May 23 20:17:44 2012
@@ -1303,8 +1303,15 @@ public class HLogSplitter {
      * Update region's maximum edit log SeqNum.
      */
     void updateRegionMaximumEditLogSeqNum(Entry entry) {
-      regionMaximumEditLogSeqNum.put(entry.getKey().getEncodedRegionName(),
-          entry.getKey().getLogSeqNum());
+      synchronized (regionMaximumEditLogSeqNum) {
+        Long currentMaxSeqNum=regionMaximumEditLogSeqNum.get(entry.getKey().getEncodedRegionName());
+        if (currentMaxSeqNum == null
+            || entry.getKey().getLogSeqNum() > currentMaxSeqNum) {
+          regionMaximumEditLogSeqNum.put(entry.getKey().getEncodedRegionName(),
+              entry.getKey().getLogSeqNum());
+        }
+      }
+
     }
 
     Long getRegionMaximumEditLogSeqNum(byte[] region) {



Mime
View raw message