You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ch...@apache.org on 2023/02/20 10:16:15 UTC

[hbase] branch branch-2.5 updated: HBASE-27654 IndexBlockEncoding is missing in HFileContextBuilder copy constructor (#5044)

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

chenglei pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.5 by this push:
     new 3dd64aa0516 HBASE-27654 IndexBlockEncoding is missing in HFileContextBuilder copy constructor (#5044)
3dd64aa0516 is described below

commit 3dd64aa0516f8b52e98ae1a856ef30a0ef6944d6
Author: chenglei <ch...@apache.org>
AuthorDate: Mon Feb 20 18:16:08 2023 +0800

    HBASE-27654 IndexBlockEncoding is missing in HFileContextBuilder copy constructor (#5044)
    
    Signed-off-by: Bryan Beaudreault <bb...@apache.org>
---
 .../org/apache/hadoop/hbase/io/hfile/HFileContextBuilder.java     | 1 +
 .../src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileContextBuilder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileContextBuilder.java
index f2131951000..0394f12144e 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileContextBuilder.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileContextBuilder.java
@@ -84,6 +84,7 @@ public class HFileContextBuilder {
     this.columnFamily = hfc.getColumnFamily();
     this.tableName = hfc.getTableName();
     this.cellComparator = hfc.getCellComparator();
+    this.indexBlockEncoding = hfc.getIndexBlockEncoding();
   }
 
   public HFileContextBuilder withHBaseCheckSum(boolean useHBaseCheckSum) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java
index bf152b47e2a..0d5190d16b3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java
@@ -70,6 +70,7 @@ import org.apache.hadoop.hbase.io.ByteBuffAllocator;
 import org.apache.hadoop.hbase.io.compress.Compression;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoder;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
+import org.apache.hadoop.hbase.io.encoding.IndexBlockEncoding;
 import org.apache.hadoop.hbase.io.hfile.HFile.Reader;
 import org.apache.hadoop.hbase.io.hfile.HFile.Writer;
 import org.apache.hadoop.hbase.io.hfile.ReaderContext.ReaderType;
@@ -1070,4 +1071,11 @@ public class TestHFile {
     alloc.clean();
   }
 
+  @Test
+  public void testHFileContextBuilderWithIndexEncoding() throws IOException {
+    HFileContext context =
+      new HFileContextBuilder().withIndexBlockEncoding(IndexBlockEncoding.PREFIX_TREE).build();
+    HFileContext newContext = new HFileContextBuilder(context).build();
+    assertTrue(newContext.getIndexBlockEncoding() == IndexBlockEncoding.PREFIX_TREE);
+  }
 }