You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2012/05/23 22:17:44 UTC
svn commit: r1342019 -
/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
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) {