hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject hbase git commit: HBASE-16792 Reuse KeyValue.KeyOnlyKeyValue in BufferedDataBlockEncoder.SeekerState (Binlijin)
Date Mon, 17 Oct 2016 06:57:05 GMT
Repository: hbase
Updated Branches:
  refs/heads/master bda5fd5a1 -> 1e3d8c822


HBASE-16792 Reuse KeyValue.KeyOnlyKeyValue in
BufferedDataBlockEncoder.SeekerState (Binlijin)


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

Branch: refs/heads/master
Commit: 1e3d8c822608482b9dc34040fd19333979d1a607
Parents: bda5fd5
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Mon Oct 17 12:26:36 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Mon Oct 17 12:26:36 2016 +0530

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/KeyValue.java  | 15 +++++++++++++++
 .../hbase/io/encoding/BufferedDataBlockEncoder.java  |  4 ++--
 .../apache/hadoop/hbase/regionserver/HRegion.java    |  4 ++--
 3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1e3d8c82/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
index 8f8554c..f9a621a 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
@@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ClassSize;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.io.RawComparator;
+
 import com.google.common.annotations.VisibleForTesting;
 
 /**
@@ -2641,6 +2642,20 @@ public class KeyValue implements ExtendedCell {
       this.rowLen = Bytes.toShort(this.bytes, this.offset);
     }
 
+    public void set(KeyOnlyKeyValue keyOnlyKeyValue) {
+      this.bytes = keyOnlyKeyValue.bytes;
+      this.length = keyOnlyKeyValue.length;
+      this.offset = keyOnlyKeyValue.offset;
+      this.rowLen = keyOnlyKeyValue.rowLen;
+    }
+
+    public void clear() {
+      rowLen = -1;
+      bytes = null;
+      offset = 0;
+      length = 0;
+    }
+
     @Override
     public int getKeyOffset() {
       return this.offset;

http://git-wip-us.apache.org/repos/asf/hbase/blob/1e3d8c82/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
index 4d3a26c..edecd9a 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
@@ -139,7 +139,7 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder
{
     protected void invalidate() {
       valueOffset = -1;
       tagsCompressedLength = 0;
-      currentKey = new KeyValue.KeyOnlyKeyValue();
+      currentKey.clear();
       uncompressTags = true;
       currentBuffer = null;
     }
@@ -188,7 +188,7 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder
{
             keyBuffer, nextState.lastCommonPrefix, nextState.keyLength
                 - nextState.lastCommonPrefix);
       }
-      currentKey = nextState.currentKey;
+      currentKey.set(nextState.currentKey);
 
       valueOffset = nextState.valueOffset;
       keyLength = nextState.keyLength;

http://git-wip-us.apache.org/repos/asf/hbase/blob/1e3d8c82/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 f61eb4b..ca92f06 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
@@ -356,9 +356,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     // We need to ensure that while we are calculating the smallestReadPoint
     // no new RegionScanners can grab a readPoint that we are unaware of.
     // We achieve this by synchronizing on the scannerReadPoints object.
-    synchronized(scannerReadPoints) {
+    synchronized (scannerReadPoints) {
       minimumReadPoint = mvcc.getReadPoint();
-      for (Long readPoint: this.scannerReadPoints.values()) {
+      for (Long readPoint : this.scannerReadPoints.values()) {
         if (readPoint < minimumReadPoint) {
           minimumReadPoint = readPoint;
         }


Mime
View raw message