Author: stack Date: Sat Oct 3 05:07:34 2009 New Revision: 821249 URL: http://svn.apache.org/viewvc?rev=821249&view=rev Log: HBASE-1883 HRegion passes the wrong minSequenceNumber to doReconstructionLog
Modified: hadoop/hbase/branches/0.20/CHANGES.txt hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java Modified: hadoop/hbase/branches/0.20/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=821249&r1=821248&r2=821249&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/CHANGES.txt (original) +++ hadoop/hbase/branches/0.20/CHANGES.txt Sat Oct 3 05:07:34 2009 @@ -40,6 +40,8 @@ (Lars George via Stack) HBASE-1869 IndexedTable delete fails when used in conjunction with RowLock() (Keith Thomas via Stack) + HBASE-1883 HRegion passes the wrong minSequenceNumber to doReconstructionLog + (Clint Morgan via Stack) IMPROVEMENTS HBASE-1819 Update to 0.20.1 hadoop and zk 3.2.1 Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=821249&r1=821248&r2=821249&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Sat Oct 3 05:07:34 2009 @@ -299,7 +299,8 @@ // Load in all the HStores. long maxSeqId = -1; - long minSeqId = Integer.MAX_VALUE; + long minSeqIdToRecover = Integer.MAX_VALUE; + for (HColumnDescriptor c : this.regionInfo.getTableDesc().getFamilies()) { Store store = instantiateHStore(this.basedir, c, oldLogFile, reporter); this.stores.put(c.getName(), store); @@ -307,13 +308,15 @@ if (storeSeqId > maxSeqId) { maxSeqId = storeSeqId; } - if (storeSeqId < minSeqId) { - minSeqId = storeSeqId; + + long storeSeqIdBeforeRecovery = store.getMaxSeqIdBeforeLogRecovery(); + if (storeSeqIdBeforeRecovery < minSeqIdToRecover) { + minSeqIdToRecover = storeSeqIdBeforeRecovery; } } // Play log if one. Delete when done. - doReconstructionLog(oldLogFile, minSeqId, maxSeqId, reporter); + doReconstructionLog(oldLogFile, minSeqIdToRecover, maxSeqId, reporter); if (fs.exists(oldLogFile)) { if (LOG.isDebugEnabled()) { LOG.debug("Deleting old log file: " + oldLogFile); Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=821249&r1=821248&r2=821249&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java Sat Oct 3 05:07:34 2009 @@ -129,6 +129,9 @@ // reflected in the TreeMaps). private volatile long maxSeqId = -1; + // The most-recent log-seq-id before we recovered from the LOG. + private long maxSeqIdBeforeLogRecovery = -1; + private final Path regionCompactionDir; private final Object compactLock = new Object(); private final int compactionThreshold; @@ -216,13 +219,15 @@ // loadStoreFiles calculates this.maxSeqId. as side-effect. this.storefiles.putAll(loadStoreFiles()); + this.maxSeqIdBeforeLogRecovery = this.maxSeqId; + // Do reconstruction log. long newId = runReconstructionLog(reconstructionLog, this.maxSeqId, reporter); if (newId != -1) { this.maxSeqId = newId; // start with the log id we just recovered. } } - + HColumnDescriptor getFamily() { return this.family; } @@ -230,6 +235,10 @@ long getMaxSequenceId() { return this.maxSeqId; } + + long getMaxSeqIdBeforeLogRecovery() { + return maxSeqIdBeforeLogRecovery; + } /** * @param tabledir