You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2020/10/01 08:15:10 UTC

[hbase] branch branch-2.3 updated: HBASE-24981 Enable table replication fails from 1.x to 2.x if table already exist at peer

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

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


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new f8ccd54  HBASE-24981 Enable table replication fails from 1.x to 2.x if table already exist at peer
f8ccd54 is described below

commit f8ccd5446cdb04bab63bbdfda76fe95e882ce3c4
Author: Sanjeet Nishad <sa...@gmail.com>
AuthorDate: Thu Oct 1 13:24:31 2020 +0530

    HBASE-24981 Enable table replication fails from 1.x to 2.x if table already exist at peer
    
    Closes #2353
    
    Signed-off-by: stack <st...@apache.org>
    Signed-off-by: Viraj Jasani <vj...@apache.org>
    Signed-off-by: Pankaj Kumar <pa...@apache.org>
---
 .../client/ColumnFamilyDescriptorBuilder.java      |  5 ----
 .../client/TestColumnFamilyDescriptorBuilder.java  | 31 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java
index 0fb0a27..e845ee9 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java
@@ -294,11 +294,6 @@ public class ColumnFamilyDescriptorBuilder {
     DEFAULT_VALUES.put(BLOCKCACHE, String.valueOf(DEFAULT_BLOCKCACHE));
     DEFAULT_VALUES.put(KEEP_DELETED_CELLS, String.valueOf(DEFAULT_KEEP_DELETED));
     DEFAULT_VALUES.put(DATA_BLOCK_ENCODING, String.valueOf(DEFAULT_DATA_BLOCK_ENCODING));
-    DEFAULT_VALUES.put(CACHE_DATA_ON_WRITE, String.valueOf(DEFAULT_CACHE_DATA_ON_WRITE));
-    DEFAULT_VALUES.put(CACHE_INDEX_ON_WRITE, String.valueOf(DEFAULT_CACHE_INDEX_ON_WRITE));
-    DEFAULT_VALUES.put(CACHE_BLOOMS_ON_WRITE, String.valueOf(DEFAULT_CACHE_BLOOMS_ON_WRITE));
-    DEFAULT_VALUES.put(EVICT_BLOCKS_ON_CLOSE, String.valueOf(DEFAULT_EVICT_BLOCKS_ON_CLOSE));
-    DEFAULT_VALUES.put(PREFETCH_BLOCKS_ON_OPEN, String.valueOf(DEFAULT_PREFETCH_BLOCKS_ON_OPEN));
     // Do NOT add this key/value by default. NEW_VERSION_BEHAVIOR is NOT defined in hbase1 so
     // it is not possible to make an hbase1 HCD the same as an hbase2 HCD and so the replication
     // compare of schemas will fail. It is OK not adding the below to the initial map because of
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestColumnFamilyDescriptorBuilder.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestColumnFamilyDescriptorBuilder.java
index 82479ed..f305229 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestColumnFamilyDescriptorBuilder.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestColumnFamilyDescriptorBuilder.java
@@ -41,6 +41,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.ExpectedException;
+import java.util.Map;
 
 @Category({MiscTests.class, SmallTests.class})
 public class TestColumnFamilyDescriptorBuilder {
@@ -193,4 +194,34 @@ public class TestColumnFamilyDescriptorBuilder {
     builder.setTimeToLive(ttl);
     Assert.assertEquals(43282800, builder.build().getTimeToLive());
   }
+
+  /**
+   * Test for verifying the ColumnFamilyDescriptorBuilder's default values so that backward
+   * compatibility with hbase-1.x can be mantained (see HBASE-24981).
+   */
+  @Test
+  public void testDefaultBuilder() {
+    final Map<String, String> defaultValueMap = ColumnFamilyDescriptorBuilder.getDefaultValues();
+    assertEquals(defaultValueMap.size(), 11);
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.BLOOMFILTER),
+      BloomType.ROW.toString());
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.REPLICATION_SCOPE), "0");
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.MAX_VERSIONS), "1");
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.MIN_VERSIONS), "0");
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.COMPRESSION),
+      Compression.Algorithm.NONE.toString());
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.TTL),
+      Integer.toString(Integer.MAX_VALUE));
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.BLOCKSIZE),
+      Integer.toString(64 * 1024));
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.IN_MEMORY),
+      Boolean.toString(false));
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.BLOCKCACHE),
+      Boolean.toString(true));
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.KEEP_DELETED_CELLS),
+      KeepDeletedCells.FALSE.toString());
+    assertEquals(defaultValueMap.get(ColumnFamilyDescriptorBuilder.DATA_BLOCK_ENCODING),
+      DataBlockEncoding.NONE.toString());
+
+  }
 }