Index: src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java (revision 1205279) +++ src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java (working copy) @@ -1538,11 +1538,18 @@ // Cleaning up of lastSeqWritten is in the finally clause because we // don't want to confuse getOldestOutstandingSeqNum() this.lastSeqWritten.remove(getSnapshotName(encodedRegionName)); - Long l = this.lastSeqWritten.remove(encodedRegionName); - if (l != null) { - LOG.warn("Why is there a raw encodedRegionName in lastSeqWritten? name=" + - Bytes.toString(encodedRegionName) + ", seqid=" + l); - } + + // So, we don't want to remove our region from lastSeqWritten if we are + // just flushing but we do want to remove ourselves if flushing on close + // (on close, the final flush will happen with updates blocked). To tell + // between the two cases, compare seqids. We can remove ourselves if the + // id passed in here is same as when flush started -- no new edits have + // come in on this region; either no new edits came in or the update + // lock is up because we are closing so safe to remove ourselves. + Long seq = this.lastSeqWritten.get(encodedRegionName); + if (seq != null && logSeqId >= seq.longValue()) { + this.lastSeqWritten.remove(encodedRegionName); + } this.cacheFlushLock.unlock(); } }