HBASE-2284 fsWriteLatency metric may be incorrectly reported

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@918859 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-03-04 05:20:37 +00:00
parent b4e29fb201
commit cda22507a9
1 changed files with 4 additions and 3 deletions

View File

@ -670,7 +670,7 @@ public class HLog implements HConstants, Syncable {
// region being flushed is removed if the sequence number of the flush // region being flushed is removed if the sequence number of the flush
// is greater than or equal to the value in lastSeqWritten. // is greater than or equal to the value in lastSeqWritten.
this.lastSeqWritten.putIfAbsent(regionName, Long.valueOf(seqNum)); this.lastSeqWritten.putIfAbsent(regionName, Long.valueOf(seqNum));
doWrite(regionInfo, logKey, logEdit, logKey.getWriteTime()); doWrite(regionInfo, logKey, logEdit);
this.unflushedEntries.incrementAndGet(); this.unflushedEntries.incrementAndGet();
this.numEntries.incrementAndGet(); this.numEntries.incrementAndGet();
} }
@ -722,7 +722,7 @@ public class HLog implements HConstants, Syncable {
int counter = 0; int counter = 0;
for (KeyValue kv: edits) { for (KeyValue kv: edits) {
HLogKey logKey = makeKey(regionName, tableName, seqNum[counter++], now); HLogKey logKey = makeKey(regionName, tableName, seqNum[counter++], now);
doWrite(info, logKey, kv, now); doWrite(info, logKey, kv);
this.numEntries.incrementAndGet(); this.numEntries.incrementAndGet();
} }
@ -869,13 +869,14 @@ public class HLog implements HConstants, Syncable {
} }
} }
protected void doWrite(HRegionInfo info, HLogKey logKey, KeyValue logEdit, final long now) protected void doWrite(HRegionInfo info, HLogKey logKey, KeyValue logEdit)
throws IOException { throws IOException {
if (!this.enabled) { if (!this.enabled) {
return; return;
} }
try { try {
this.editsSize.addAndGet(logKey.heapSize() + logEdit.heapSize()); this.editsSize.addAndGet(logKey.heapSize() + logEdit.heapSize());
long now = System.currentTimeMillis();
this.writer.append(new HLog.Entry(logKey, logEdit)); this.writer.append(new HLog.Entry(logKey, logEdit));
long took = System.currentTimeMillis() - now; long took = System.currentTimeMillis() - now;
writeTime += took; writeTime += took;