diff --git a/CHANGES.txt b/CHANGES.txt index b0b2880bda2..cacdd2b8abf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -458,6 +458,8 @@ Release 0.21.0 - Unreleased HBASE-2364 Ignore Deprecations during build (Paul Smith via Stack) HBASE-2338 log recovery: deleted items may be resurrected (Aravind Menon via Stack) + HBASE-2359 WALEdit doesn't implement HeapSize + (Kannan Muthukkaruppan via Stack) NEW FEATURES HBASE-1961 HBase EC2 scripts diff --git a/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java b/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java index d2b01fe2e1f..b363a6aeb81 100644 --- a/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java +++ b/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java @@ -137,15 +137,11 @@ public class HLog implements HConstants, Syncable { } public interface Writer { - void init(FileSystem fs, Path path, Configuration c) throws IOException; - void close() throws IOException; - void sync() throws IOException; - void append(Entry entry) throws IOException; - + long getLength() throws IOException; } // used to indirectly tell syncFs to force the sync @@ -176,9 +172,6 @@ public class HLog implements HConstants, Syncable { private final AtomicInteger numEntries = new AtomicInteger(0); - // Size of edits written so far. Used figuring when to rotate logs. - private final AtomicLong editsSize = new AtomicLong(0); - // If > than this size, roll the log. private final long logrollsize; @@ -365,7 +358,7 @@ public class HLog implements HConstants, Syncable { LOG.info((oldFile != null? "Roll " + FSUtils.getPath(oldFile) + ", entries=" + this.numEntries.get() + - ", calcsize=" + this.editsSize.get() + ", filesize=" + + ", filesize=" + this.fs.getFileStatus(oldFile).getLen() + ". ": "") + "New hlog " + FSUtils.getPath(newPath)); // Can we delete any of the old log files? @@ -384,7 +377,6 @@ public class HLog implements HConstants, Syncable { } } this.numEntries.set(0); - this.editsSize.set(0); } } finally { this.cacheFlushLock.unlock(); @@ -682,7 +674,7 @@ public class HLog implements HConstants, Syncable { // sync txn to file system this.sync(isMetaRegion); - if (this.editsSize.get() > this.logrollsize) { + if (this.writer.getLength() > this.logrollsize) { if (listener != null) { listener.logRollRequested(); } @@ -737,7 +729,7 @@ public class HLog implements HConstants, Syncable { } // sync txn to file system this.sync(info.isMetaRegion()); - if (this.editsSize.get() > this.logrollsize) { + if (this.writer.getLength() > this.logrollsize) { requestLogRoll(); } } @@ -883,7 +875,6 @@ public class HLog implements HConstants, Syncable { return; } try { - this.editsSize.addAndGet(logKey.heapSize() + logEdit.heapSize()); long now = System.currentTimeMillis(); this.writer.append(new HLog.Entry(logKey, logEdit)); long took = System.currentTimeMillis() - now; diff --git a/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogKey.java b/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogKey.java index eb3ae377ff2..4e97470964c 100644 --- a/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogKey.java +++ b/core/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogKey.java @@ -37,7 +37,7 @@ import java.io.*; *
Some Transactional edits (START, COMMIT, ABORT) will not have an
* associated row.
*/
-public class HLogKey implements WritableComparable