You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2022/06/25 17:59:13 UTC

[hbase] branch master updated: Revert "HBASE-26856 BufferedDataBlockEncoder.OnheapDecodedCell value can get corrupted"

This is an automated email from the ASF dual-hosted git repository.

apurtell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 42853aae57f Revert "HBASE-26856 BufferedDataBlockEncoder.OnheapDecodedCell value can get corrupted"
42853aae57f is described below

commit 42853aae57fd46634d8b8580fff3103eb532f5b7
Author: Andrew Purtell <ap...@apache.org>
AuthorDate: Sat Jun 25 10:58:25 2022 -0700

    Revert "HBASE-26856 BufferedDataBlockEncoder.OnheapDecodedCell value can get corrupted"
    
    This reverts commit f526609331ba5d6c2377135fdac3ff1dbe71c175.
    
    See also HBASE-27151 TestMultiRespectsLimits.testBlockMultiLimits repeatable failure
---
 .../io/encoding/BufferedDataBlockEncoder.java      | 24 +++++-----------------
 1 file changed, 5 insertions(+), 19 deletions(-)

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 06ec122e742..8ab17285d9d 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
@@ -232,10 +232,9 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder {
       int tOffset = 0;
       if (this.includeTags) {
         if (this.tagCompressionContext == null) {
+          tagsArray = valAndTagsBuffer.array();
           tOffset =
             valAndTagsBuffer.arrayOffset() + vOffset + this.valueLength + tagsLenSerializationSize;
-          tagsArray = Bytes.copy(valAndTagsBuffer.array(), tOffset, this.tagsLength);
-          tOffset = 0;
         } else {
           tagsArray = Bytes.copy(tagsBuffer, 0, this.tagsLength);
           tOffset = 0;
@@ -244,9 +243,9 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder {
       return new OnheapDecodedCell(Bytes.copy(keyBuffer, 0, this.keyLength),
         currentKey.getRowLength(), currentKey.getFamilyOffset(), currentKey.getFamilyLength(),
         currentKey.getQualifierOffset(), currentKey.getQualifierLength(), currentKey.getTimestamp(),
-        currentKey.getTypeByte(), Bytes.copy(valAndTagsBuffer.array(),
-          valAndTagsBuffer.arrayOffset() + vOffset, this.valueLength),
-        0, this.valueLength, memstoreTS, tagsArray, tOffset, this.tagsLength);
+        currentKey.getTypeByte(), valAndTagsBuffer.array(),
+        valAndTagsBuffer.arrayOffset() + vOffset, this.valueLength, memstoreTS, tagsArray, tOffset,
+        this.tagsLength);
     }
 
     private Cell toOffheapCell(ByteBuffer valAndTagsBuffer, int vOffset,
@@ -255,26 +254,13 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder {
       int tOffset = 0;
       if (this.includeTags) {
         if (this.tagCompressionContext == null) {
+          tagsBuf = valAndTagsBuffer;
           tOffset = vOffset + this.valueLength + tagsLenSerializationSize;
-          byte[] output = new byte[this.tagsLength];
-          ByteBufferUtils.copyFromBufferToArray(output, valAndTagsBuffer, tOffset, 0,
-            this.tagsLength);
-          tagsBuf = ByteBuffer.wrap(output);
-          tOffset = 0;
         } else {
           tagsBuf = ByteBuffer.wrap(Bytes.copy(tagsBuffer, 0, this.tagsLength));
           tOffset = 0;
         }
       }
-
-      if (this.valueLength > 0) {
-        byte[] output = new byte[this.valueLength];
-        ByteBufferUtils.copyFromBufferToArray(output, valAndTagsBuffer, vOffset, 0,
-          this.valueLength);
-        valAndTagsBuffer = ByteBuffer.wrap(output);
-        vOffset = 0;
-      }
-
       return new OffheapDecodedExtendedCell(
         ByteBuffer.wrap(Bytes.copy(keyBuffer, 0, this.keyLength)), currentKey.getRowLength(),
         currentKey.getFamilyOffset(), currentKey.getFamilyLength(), currentKey.getQualifierOffset(),