This is an automated email from the ASF dual-hosted git repository.
diqiu50 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 535dc992a7 [#10284] fix(catalog-jdbc): keep jdbc pool size properties
visible (#10314)
535dc992a7 is described below
commit 535dc992a72d82efd0e4d7cfe70035170d9d4e52
Author: Qi Yu <[email protected]>
AuthorDate: Mon Mar 9 21:59:00 2026 +0800
[#10284] fix(catalog-jdbc): keep jdbc pool size properties visible (#10314)
### What changes were proposed in this pull request?
This PR fixes JDBC catalog property visibility for connection pool
sizing.
### Why are the changes needed?
returns catalog properties via , which filters hidden properties. Since
and were incorrectly marked hidden, they disappeared when loading
catalog properties after creation.
Fix: #10284
### Does this PR introduce _any_ user-facing change?
Yes.
Users who set / during JDBC catalog creation can now see them in loaded
catalog properties as expected.
### How was this patch tested?
UTs
---------
Co-authored-by: Copilot <[email protected]>
---
.../jdbc/JdbcCatalogPropertiesMetadata.java | 4 +-
.../jdbc/TestJdbcCatalogPropertiesMetadata.java | 111 +++++++++++++++++++++
docs/jdbc-clickhouse-catalog.md | 6 +-
3 files changed, 118 insertions(+), 3 deletions(-)
diff --git
a/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java
b/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java
index 0499ab221c..470bb81ef9 100644
---
a/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java
+++
b/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java
@@ -93,7 +93,7 @@ public class JdbcCatalogPropertiesMetadata extends
BaseCatalogPropertiesMetadata
false /* required */,
false /* immutable */,
JdbcConfig.POOL_MIN_SIZE.getDefaultValue(),
- true /* hidden */,
+ false /* hidden */,
false /* reserved */),
integerPropertyEntry(
JdbcConfig.POOL_MAX_SIZE.getKey(),
@@ -101,7 +101,7 @@ public class JdbcCatalogPropertiesMetadata extends
BaseCatalogPropertiesMetadata
false /* required */,
false /* immutable */,
JdbcConfig.POOL_MAX_SIZE.getDefaultValue(),
- true /* hidden */,
+ false /* hidden */,
false /* reserved */),
booleanPropertyEntry(
JdbcConfig.TEST_ON_BORROW.getKey(),
diff --git
a/catalogs/catalog-jdbc-common/src/test/java/org/apache/gravitino/catalog/jdbc/TestJdbcCatalogPropertiesMetadata.java
b/catalogs/catalog-jdbc-common/src/test/java/org/apache/gravitino/catalog/jdbc/TestJdbcCatalogPropertiesMetadata.java
new file mode 100644
index 0000000000..84099abd0c
--- /dev/null
+++
b/catalogs/catalog-jdbc-common/src/test/java/org/apache/gravitino/catalog/jdbc/TestJdbcCatalogPropertiesMetadata.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino.catalog.jdbc;
+
+import com.google.common.collect.ImmutableMap;
+import java.time.Instant;
+import java.util.Map;
+import org.apache.gravitino.Catalog;
+import org.apache.gravitino.Namespace;
+import org.apache.gravitino.catalog.jdbc.config.JdbcConfig;
+import
org.apache.gravitino.catalog.jdbc.converter.JdbcColumnDefaultValueConverter;
+import org.apache.gravitino.catalog.jdbc.converter.JdbcTypeConverter;
+import
org.apache.gravitino.catalog.jdbc.converter.SqliteColumnDefaultValueConverter;
+import org.apache.gravitino.catalog.jdbc.converter.SqliteTypeConverter;
+import org.apache.gravitino.catalog.jdbc.operation.JdbcDatabaseOperations;
+import org.apache.gravitino.catalog.jdbc.operation.JdbcTableOperations;
+import org.apache.gravitino.catalog.jdbc.operation.SqliteDatabaseOperations;
+import org.apache.gravitino.catalog.jdbc.operation.SqliteTableOperations;
+import org.apache.gravitino.meta.AuditInfo;
+import org.apache.gravitino.meta.CatalogEntity;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class TestJdbcCatalogPropertiesMetadata {
+
+ @Test
+ public void testPoolSizePropertiesAreNotHidden() {
+ JdbcCatalogPropertiesMetadata propertiesMetadata = new
JdbcCatalogPropertiesMetadata();
+
+
Assertions.assertFalse(propertiesMetadata.isHiddenProperty(JdbcConfig.POOL_MIN_SIZE.getKey()));
+
Assertions.assertFalse(propertiesMetadata.isHiddenProperty(JdbcConfig.POOL_MAX_SIZE.getKey()));
+ }
+
+ @Test
+ public void testCatalogPropertiesKeepPoolSizeAfterLoad() {
+ Map<String, String> createProperties =
+ ImmutableMap.<String, String>builder()
+ .put(JdbcConfig.JDBC_URL.getKey(), "jdbc:sqlite::memory:")
+ .put(JdbcConfig.JDBC_DRIVER.getKey(), "org.sqlite.JDBC")
+ .put(JdbcConfig.USERNAME.getKey(), "user")
+ .put(JdbcConfig.PASSWORD.getKey(), "password")
+ .put(JdbcConfig.POOL_MIN_SIZE.getKey(), "5")
+ .put(JdbcConfig.POOL_MAX_SIZE.getKey(), "20")
+ .build();
+
+ CatalogEntity catalogEntity =
+ CatalogEntity.builder()
+ .withId(1L)
+ .withName("jdbc_catalog")
+ .withNamespace(Namespace.of("metalake"))
+ .withType(Catalog.Type.RELATIONAL)
+ .withProvider("jdbc-test")
+ .withComment("test")
+ .withProperties(createProperties)
+ .withAuditInfo(
+
AuditInfo.builder().withCreator("test").withCreateTime(Instant.now()).build())
+ .build();
+
+ JdbcCatalog loadCatalog =
+ new TestJdbcCatalog()
+ .withCatalogConf(catalogEntity.getProperties())
+ .withCatalogEntity(catalogEntity);
+
+ Map<String, String> loadedProperties = loadCatalog.properties();
+ Assertions.assertEquals("5",
loadedProperties.get(JdbcConfig.POOL_MIN_SIZE.getKey()));
+ Assertions.assertEquals("20",
loadedProperties.get(JdbcConfig.POOL_MAX_SIZE.getKey()));
+ }
+
+ private static class TestJdbcCatalog extends JdbcCatalog {
+ @Override
+ public String shortName() {
+ return "jdbc-test";
+ }
+
+ @Override
+ protected JdbcTypeConverter createJdbcTypeConverter() {
+ return new SqliteTypeConverter();
+ }
+
+ @Override
+ protected JdbcDatabaseOperations createJdbcDatabaseOperations() {
+ return new SqliteDatabaseOperations(":memory:");
+ }
+
+ @Override
+ protected JdbcTableOperations createJdbcTableOperations() {
+ return new SqliteTableOperations();
+ }
+
+ @Override
+ protected JdbcColumnDefaultValueConverter
createJdbcColumnDefaultValueConverter() {
+ return new SqliteColumnDefaultValueConverter();
+ }
+ }
+}
diff --git a/docs/jdbc-clickhouse-catalog.md b/docs/jdbc-clickhouse-catalog.md
index 9b248c3da7..d50a952353 100644
--- a/docs/jdbc-clickhouse-catalog.md
+++ b/docs/jdbc-clickhouse-catalog.md
@@ -29,7 +29,11 @@ ClickHouse catalog is not included in the standard Gravitino
server distribution
| Metadata/DDL | Supports JDBC-based metadata management and DDL
|
| Column defaults | Supports column default values
|
| Drivers | Requires user-provided ClickHouse JDBC driver in
`${GRAVITINO_HOME}/catalogs/jdbc-clickhouse/libs`, please download the jar from
[link](https://repo1.maven.org/maven2/com/clickhouse/clickhouse-jdbc/0.7.1/) |
-| Supported version | All the codes are tested by ClickHouse `24.8.14`, but
should be compatible with other versions as well.
|
+| Supported version | All the codes are tested by ClickHouse `24.8.14`, newer
versions like `25.x` may also work but we did not conduct thorough tests.
Report to the community if something does not work as expected. |
+
+:::note
+ClickHouse Driver 0.7.1 is recommended for better compatibility. Some older
versions of the ClickHouse JDBC driver have issues such as incorrect metadata
reporting that may cause problems with Gravitino's metadata management. If you
encounter issues, please check the driver version and consider upgrading to
0.7.1 or later. If the problem still persists, please report it to the
Gravitino community for further investigation.
+:::
### Catalog properties