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

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


The following commit(s) were added to refs/heads/branch-3 by this push:
     new b559c5fc0fc HBASE-29314 TableDescriptorChecker should verify CF 
configuration set via setConfiguration (#6989)
b559c5fc0fc is described below

commit b559c5fc0fc48db46aed86a4e55fbffdd126ffc3
Author: Junegunn Choi <[email protected]>
AuthorDate: Fri May 16 17:46:37 2025 +0900

    HBASE-29314 TableDescriptorChecker should verify CF configuration set via 
setConfiguration (#6989)
    
    Signed-off-by: Duo Zhang <[email protected]>
    Reviewed-by: guluo <[email protected]>
    (cherry picked from commit 0b89af76ceb76b2a8f1ebdf2bc4c32d98a3443f8)
---
 .../hadoop/hbase/util/TableDescriptorChecker.java  |  3 +-
 .../hbase/util/TestTableDescriptorChecker.java     | 45 ++++++++++++----------
 2 files changed, 26 insertions(+), 22 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
index 36785e5d5a5..a826860aae4 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
@@ -84,7 +84,8 @@ public final class TableDescriptorChecker {
     warnOrThrowExceptionForFailure(logWarn, () -> ConfigKey.validate(conf));
     warnOrThrowExceptionForFailure(logWarn, () -> {
       for (ColumnFamilyDescriptor cfd : td.getColumnFamilies()) {
-        ConfigKey.validate(new 
CompoundConfiguration().addBytesMap(cfd.getValues()));
+        ConfigKey.validate(new 
CompoundConfiguration().addStringMap(cfd.getConfiguration())
+          .addBytesMap(cfd.getValues()));
       }
     });
 
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestTableDescriptorChecker.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestTableDescriptorChecker.java
index 2a8d48783f2..cf68888a2c7 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestTableDescriptorChecker.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestTableDescriptorChecker.java
@@ -17,7 +17,7 @@
  */
 package org.apache.hadoop.hbase.util;
 
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
 
 import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
@@ -55,32 +55,35 @@ public class TestTableDescriptorChecker {
 
     // Error in table configuration.
     t.setValue(key, "xx");
-    try {
-      TableDescriptorChecker.sanityCheck(conf, t.build());
-      fail("Should have thrown IllegalArgumentException");
-    } catch (DoNotRetryIOException e) {
-      // Expected
-    }
+    assertThrows("Should have thrown IllegalArgumentException", 
DoNotRetryIOException.class,
+      () -> TableDescriptorChecker.sanityCheck(conf, t.build()));
 
     // Fix the error.
     t.setValue(key, "1");
     TableDescriptorChecker.sanityCheck(conf, t.build());
 
-    // Error in column family configuration.
-    cf.setValue(key, "xx");
-    t.removeColumnFamily("cf".getBytes());
-    t.setColumnFamily(cf.build());
-    try {
+    // Verify column family configuration.
+    for (boolean viaSetValue : new boolean[] { true, false }) {
+      // Error in column family configuration.
+      if (viaSetValue) {
+        cf.setValue(key, "xx");
+      } else {
+        cf.setConfiguration(key, "xx");
+      }
+      t.removeColumnFamily("cf".getBytes());
+      t.setColumnFamily(cf.build());
+      assertThrows("Should have thrown IllegalArgumentException", 
DoNotRetryIOException.class,
+        () -> TableDescriptorChecker.sanityCheck(conf, t.build()));
+
+      // Fix the error.
+      if (viaSetValue) {
+        cf.setValue(key, "");
+      } else {
+        cf.setConfiguration(key, "");
+      }
+      t.removeColumnFamily("cf".getBytes());
+      t.setColumnFamily(cf.build());
       TableDescriptorChecker.sanityCheck(conf, t.build());
-      fail("Should have thrown IllegalArgumentException");
-    } catch (DoNotRetryIOException e) {
-      // Expected
     }
-
-    // Fix the error.
-    cf.setValue(key, "1");
-    t.removeColumnFamily("cf".getBytes());
-    t.setColumnFamily(cf.build());
-    TableDescriptorChecker.sanityCheck(conf, t.build());
   }
 }

Reply via email to