hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject git commit: HBASE-11353 Wrong Write Request Count
Date Mon, 16 Jun 2014 07:58:52 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 34ae4a94d -> 46562f8fa


HBASE-11353 Wrong Write Request Count


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/46562f8f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/46562f8f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/46562f8f

Branch: refs/heads/0.98
Commit: 46562f8fa44976f61b8b106bca5ac76abaf90d05
Parents: 34ae4a9
Author: Nicolas Liochon <nkeywal@gmail.com>
Authored: Mon Jun 16 09:54:15 2014 +0200
Committer: Nicolas Liochon <nkeywal@gmail.com>
Committed: Mon Jun 16 09:55:50 2014 +0200

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java      |  2 --
 .../hadoop/hbase/regionserver/TestHRegion.java  | 26 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/46562f8f/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 970994d..4142707 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -1981,7 +1981,6 @@ public class HRegion implements HeapSize { // , Writable{
     checkReadOnly();
     checkResources();
     startRegionOperation(Operation.DELETE);
-    this.writeRequestsCount.increment();
     try {
       delete.getRow();
       // All edits for the given row (across all column families) must happen atomically.
@@ -2090,7 +2089,6 @@ public class HRegion implements HeapSize { // , Writable{
     // will be extremely rare; we'll deal with it when it happens.
     checkResources();
     startRegionOperation(Operation.PUT);
-    this.writeRequestsCount.increment();
     try {
       // All edits for the given row (across all column families) must happen atomically.
       doBatchMutate(put);

http://git-wip-us.apache.org/repos/asf/hbase/blob/46562f8f/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
index 9ec93e7..52713ed 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
@@ -4916,6 +4916,32 @@ public class TestHRegion {
     }
   }
 
+  @Test
+  public void testWriteRequestsCounter() throws IOException {
+    byte[] fam = Bytes.toBytes("info");
+    byte[][] families = { fam };
+    this.region = initHRegion(tableName, method, CONF, families);
+
+    Assert.assertEquals(0L, region.getWriteRequestsCount());
+
+    Put put = new Put(row);
+    put.add(fam, fam, fam);
+
+    Assert.assertEquals(0L, region.getWriteRequestsCount());
+    region.put(put);
+    Assert.assertEquals(1L, region.getWriteRequestsCount());
+    region.put(put);
+    Assert.assertEquals(2L, region.getWriteRequestsCount());
+    region.put(put);
+    Assert.assertEquals(3L, region.getWriteRequestsCount());
+
+    region.delete(new Delete(row));
+    Assert.assertEquals(4L, region.getWriteRequestsCount());
+
+    HRegion.closeHRegion(this.region);
+    this.region = null;
+  }
+
   private static HRegion initHRegion(byte[] tableName, String callingMethod,
       byte[]... families) throws IOException {
     return initHRegion(tableName, callingMethod, HBaseConfiguration.create(),


Mime
View raw message