From cda22507a929b6643aa313d6ad9bc3eeb2b252c4 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 4 Mar 2010 05:20:37 +0000 Subject: [PATCH] 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 --- .../org/apache/hadoop/hbase/regionserver/wal/HLog.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 87de278a985..ccbea45924b 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 @@ -670,7 +670,7 @@ public class HLog implements HConstants, Syncable { // region being flushed is removed if the sequence number of the flush // is greater than or equal to the value in lastSeqWritten. this.lastSeqWritten.putIfAbsent(regionName, Long.valueOf(seqNum)); - doWrite(regionInfo, logKey, logEdit, logKey.getWriteTime()); + doWrite(regionInfo, logKey, logEdit); this.unflushedEntries.incrementAndGet(); this.numEntries.incrementAndGet(); } @@ -722,7 +722,7 @@ public class HLog implements HConstants, Syncable { int counter = 0; for (KeyValue kv: edits) { HLogKey logKey = makeKey(regionName, tableName, seqNum[counter++], now); - doWrite(info, logKey, kv, now); + doWrite(info, logKey, kv); 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 { if (!this.enabled) { 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; writeTime += took;