This is an automated email from the ASF dual-hosted git repository. yuqi1129 pushed a commit to branch cherry-pick-3ce91977-to-branch-1.3 in repository https://gitbox.apache.org/repos/asf/gravitino.git
commit 8fc8b1594fce399d4c55e66ad91d283a19770d25 Author: yuqi <[email protected]> AuthorDate: Wed Oct 21 11:25:31 2026 +0800 fix(jdbc): Resolve branch-1.3 cherry-pick conflicts --- .../catalog/jdbc/JdbcCatalogPropertiesMetadata.java | 15 --------------- .../catalog/jdbc/utils/DataSourceUtils.java | 20 ++++++-------------- .../jdbc/TestJdbcCatalogPropertiesMetadata.java | 10 ++-------- .../catalog/mysql/MysqlTablePropertiesMetadata.java | 2 +- .../mysql/TestMysqlTablePropertiesMetadata.java | 10 +--------- .../mysql/operation/TestMysqlTableOperations.java | 6 ------ .../TestMysqlTableOperationsSqlGeneration.java | 6 +++++- docs/jdbc-clickhouse-catalog.md | 15 +-------------- docs/jdbc-doris-catalog.md | 15 +-------------- docs/jdbc-hologres-catalog.md | 14 -------------- docs/jdbc-mysql-catalog.md | 15 +-------------- docs/jdbc-oceanbase-catalog.md | 15 +-------------- docs/jdbc-postgresql-catalog.md | 16 +--------------- docs/jdbc-starrocks-catalog.md | 15 +-------------- .../connector/jdbc/TestJdbcPropertiesConverter.java | 9 +++------ 15 files changed, 24 insertions(+), 159 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 976fb04a58..5dc879452e 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 @@ -46,11 +46,7 @@ public class JdbcCatalogPropertiesMetadata extends BaseCatalogPropertiesMetadata JdbcConfig.PASSWORD.getKey(), JdbcConfig.POOL_MIN_SIZE.getKey(), JdbcConfig.POOL_MAX_SIZE.getKey(), -<<<<<<< HEAD -======= - JdbcConfig.POOL_MAX_IDLE.getKey(), JdbcConfig.POOL_MAX_WAIT_MS.getKey(), ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) JdbcConfig.TEST_ON_BORROW.getKey(), JdbcConfig.CONNECT_TIMEOUT_MS.getKey(), JdbcConfig.VERIFY_ON_CREATE.getKey()); @@ -112,23 +108,12 @@ public class JdbcCatalogPropertiesMetadata extends BaseCatalogPropertiesMetadata JdbcConfig.POOL_MAX_SIZE.getDefaultValue(), false /* hidden */, false /* reserved */), -<<<<<<< HEAD -======= - integerPropertyEntry( - JdbcConfig.POOL_MAX_IDLE.getKey(), - JdbcConfig.POOL_MAX_IDLE.getDoc(), - false /* required */, - false /* immutable */, - JdbcConfig.POOL_MAX_IDLE.getDefaultValue(), - false /* hidden */, - false /* reserved */), longOptionalPropertyEntry( JdbcConfig.POOL_MAX_WAIT_MS.getKey(), JdbcConfig.POOL_MAX_WAIT_MS.getDoc(), false /* immutable */, JdbcConfig.POOL_MAX_WAIT_MS.getDefaultValue(), false /* hidden */), ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) booleanPropertyEntry( JdbcConfig.TEST_ON_BORROW.getKey(), JdbcConfig.TEST_ON_BORROW.getDoc(), diff --git a/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/utils/DataSourceUtils.java b/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/utils/DataSourceUtils.java index 50fc33f016..c298fbd4d1 100644 --- a/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/utils/DataSourceUtils.java +++ b/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/utils/DataSourceUtils.java @@ -121,25 +121,17 @@ public class DataSourceUtils { // Set each time a connection is taken out from the connection pool, a test statement will be // executed to confirm whether the connection is valid. basicDataSource.setTestOnBorrow(jdbcConfig.getTestOnBorrow()); -<<<<<<< HEAD basicDataSource.setValidationQuery(POOL_TEST_QUERY); - basicDataSource.setMaxWait(Duration.ofMillis(jdbcConfig.getMaxWaitMs())); - // Apply the driver-aware connect timeout as a DBCP connection property (not a pool key, so the - // pool stays lazy). It bounds a single connection and takes effect on the first real connection - // — i.e. create-time verification — so an unreachable backend fails fast instead of hanging. - // Operator-set values are preserved. -======= - // Same precedence as maxIdle: keep a maxWaitMillis supplied through the DBCP bypass unless the - // canonical setting is explicitly configured. + // Keep a maxWaitMillis supplied through the DBCP bypass unless the canonical setting is + // explicitly configured. if (jdbcConfig.getAllConfig().containsKey(JdbcConfig.POOL_MAX_WAIT_MS.getKey()) || !jdbcConfig.getAllConfig().containsKey("maxWaitMillis")) { basicDataSource.setMaxWait(Duration.ofMillis(jdbcConfig.getMaxWaitMs())); } - // Apply the driver-aware connect/socket timeout as DBCP connection properties (not pool keys, - // so no collision with UNSAFE_POOL_PROPERTIES and the pool stays lazy). These bound a single - // connection and take effect on the first real connection — i.e. create-time verification — so - // an unreachable backend fails fast instead of hanging. Operator-set values are preserved. ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) + // Apply the driver-aware connect timeout as a DBCP connection property (not a pool key, so the + // pool stays lazy). It bounds a single connection and takes effect on the first real connection + // — i.e. create-time verification — so an unreachable backend fails fast instead of hanging. + // Operator-set values are preserved. JdbcConnectionTimeouts.connectionProperties(jdbcConfig, jdbcUrl) .forEach(basicDataSource::addConnectionProperty); return basicDataSource; 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 index 66ee661937..a77a6be771 100644 --- 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 @@ -30,28 +30,21 @@ 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.SqliteExceptionConverter; 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; -<<<<<<< HEAD -======= -import org.apache.gravitino.catalog.jdbc.utils.TestDataSourceValidation.UnsupportedValidationDriver; import org.apache.gravitino.connector.CatalogInfo; -import org.apache.gravitino.exceptions.ConnectionFailedException; import org.apache.gravitino.exceptions.GravitinoRuntimeException; ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) import org.apache.gravitino.meta.AuditInfo; import org.apache.gravitino.meta.CatalogEntity; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -<<<<<<< HEAD -======= import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) public class TestJdbcCatalogPropertiesMetadata { @@ -107,6 +100,7 @@ public class TestJdbcCatalogPropertiesMetadata { operations.initialize(properties, poolWaitCatalogInfo(properties), new TestJdbcCatalog()); BasicDataSource pool = (BasicDataSource) FieldUtils.readField(operations, "dataSource", true); Assertions.assertEquals(expected, pool.getMaxWaitDuration().toMillis()); + Assertions.assertEquals("SELECT 1", pool.getValidationQuery()); } } diff --git a/catalogs/catalog-jdbc-mysql/src/main/java/org/apache/gravitino/catalog/mysql/MysqlTablePropertiesMetadata.java b/catalogs/catalog-jdbc-mysql/src/main/java/org/apache/gravitino/catalog/mysql/MysqlTablePropertiesMetadata.java index 1b73a3f704..472a10c6f7 100644 --- a/catalogs/catalog-jdbc-mysql/src/main/java/org/apache/gravitino/catalog/mysql/MysqlTablePropertiesMetadata.java +++ b/catalogs/catalog-jdbc-mysql/src/main/java/org/apache/gravitino/catalog/mysql/MysqlTablePropertiesMetadata.java @@ -119,7 +119,7 @@ public class MysqlTablePropertiesMetadata extends JdbcTablePropertiesMetadata { String.join(", ", GRAVITINO_CONFIG_TO_MYSQL.keySet())); if (GRAVITINO_CONFIG_TO_MYSQL.containsKey(key)) { // A null value represents RemoveProperty in JdbcCatalogOperations. Non-SQL metadata, - // such as the internal identifier and credential settings, must not become options. + // such as the internal identifier, must not become options. result.put( GRAVITINO_CONFIG_TO_MYSQL.get(key), value == null ? null : validateAndEncode(getPropertyEntry(key), value)); diff --git a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/TestMysqlTablePropertiesMetadata.java b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/TestMysqlTablePropertiesMetadata.java index 16893e6b6b..228358a3f8 100644 --- a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/TestMysqlTablePropertiesMetadata.java +++ b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/TestMysqlTablePropertiesMetadata.java @@ -101,15 +101,7 @@ class TestMysqlTablePropertiesMetadata { RecordingTableOperations table = new RecordingTableOperations(); try (JdbcCatalogOperations operations = operations(table)) { Table created = - create( - operations, - Map.of( - "engine", - "InNoDB", - "auto-increment-offset", - "+0042", - "credential-providers", - "test-provider")); + create(operations, Map.of("engine", "InNoDB", "auto-increment-offset", "+0042")); Assertions.assertEquals(Map.of("ENGINE", "InnoDB", "AUTO_INCREMENT", "42"), table.properties); Assertions.assertEquals( Map.of("engine", "InnoDB", "auto-increment-offset", "42"), created.properties()); diff --git a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperations.java b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperations.java index e4282bdebe..191d32beb1 100644 --- a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperations.java +++ b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperations.java @@ -37,12 +37,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.gravitino.catalog.jdbc.JdbcColumn; import org.apache.gravitino.catalog.jdbc.JdbcTable; import org.apache.gravitino.catalog.jdbc.utils.DataSourceUtils; -<<<<<<< HEAD -import org.apache.gravitino.exceptions.GravitinoRuntimeException; -======= -import org.apache.gravitino.catalog.mysql.converter.MysqlColumnDefaultValueConverter; -import org.apache.gravitino.catalog.mysql.converter.MysqlTypeConverter; ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) import org.apache.gravitino.rel.Column; import org.apache.gravitino.rel.TableChange; import org.apache.gravitino.rel.expressions.distributions.Distributions; diff --git a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperationsSqlGeneration.java b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperationsSqlGeneration.java index 7cd914c449..0b9f51a1a0 100644 --- a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperationsSqlGeneration.java +++ b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperationsSqlGeneration.java @@ -98,12 +98,16 @@ public class TestMysqlTableOperationsSqlGeneration { Transforms.EMPTY_TRANSFORM, Distributions.NONE, Indexes.EMPTY_INDEXES)); + Assertions.assertEquals(0, connections.totalBorrows()); Assertions.assertThrows( IllegalArgumentException.class, () -> ops.alterTable("database", "test_table", TableChange.setProperty(key, value))); Assertions.assertTrue(connections.executedSql().isEmpty()); Assertions.assertEquals(0, connections.borrowed()); - Assertions.assertEquals(0, connections.peakBorrowed()); + // branch-1.3 generates ALTER SQL inside the execution connection; validation still prevents + // DDL. + Assertions.assertEquals(1, connections.peakBorrowed()); + Assertions.assertEquals(1, connections.totalBorrows()); } @Test diff --git a/docs/jdbc-clickhouse-catalog.md b/docs/jdbc-clickhouse-catalog.md index ba27f6c56b..fdc7be7a56 100644 --- a/docs/jdbc-clickhouse-catalog.md +++ b/docs/jdbc-clickhouse-catalog.md @@ -48,7 +48,6 @@ Pass any JDBC pool property that Gravitino does not define by adding the `gravit When using the JDBC catalog you must provide `jdbc-url`, `jdbc-driver`, `jdbc-user`, and `jdbc-password`. Common catalog properties are listed [here](./gravitino-server-config.md#catalog-properties-configuration); ClickHouse adds no extra catalog-scoped keys. -<<<<<<< HEAD | Configuration item | Description | Default value | Required | |-------------------------|-----------------------------------------------------------------------|---------------|----------| | `jdbc-url` | JDBC URL, for example `jdbc:clickhouse://localhost:8123` | (none) | Yes | @@ -57,19 +56,7 @@ When using the JDBC catalog you must provide `jdbc-url`, `jdbc-driver`, `jdbc-us | `jdbc-password` | JDBC password | (none) | Yes | | `jdbc.pool.min-size` | Minimum pool size | `2` | No | | `jdbc.pool.max-size` | Maximum pool size | `10` | No | -| `jdbc.pool.max-wait-ms` | Max wait time for a connection | `30000` | No | -======= -| Configuration item | Description | Default value | Required | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| -| `jdbc-url` | JDBC URL, for example `jdbc:clickhouse://localhost:8123` | (none) | Yes | -| `jdbc-driver` | JDBC driver class, for example `com.clickhouse.jdbc.ClickHouseDriver` | (none) | Yes | -| `jdbc-user` | JDBC user name | (none) | Yes | -| `jdbc-password` | JDBC password | (none) | Yes | -| `jdbc.pool.min-size` | Minimum pool size | `2` | No | -| `jdbc.pool.max-size` | Maximum pool size | `10` | No | -| `jdbc.pool.max-idle` | Maximum idle connections retained per catalog per server; capped by `jdbc.pool.max-size`; takes precedence over `gravitino.bypass.maxIdle`. Idle connections are not evicted by default. | `8` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) +| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ### Create a ClickHouse Catalog diff --git a/docs/jdbc-doris-catalog.md b/docs/jdbc-doris-catalog.md index 2ebcc5fa53..49e576aceb 100644 --- a/docs/jdbc-doris-catalog.md +++ b/docs/jdbc-doris-catalog.md @@ -41,7 +41,6 @@ more details. Besides the [common catalog properties](./gravitino-server-config.md#catalog-properties-configuration), the Doris catalog has the following properties: -<<<<<<< HEAD | Configuration item | Description | Default value | Required | |-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| | `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:9030` | (none) | Yes | @@ -51,19 +50,7 @@ Besides the [common catalog properties](./gravitino-server-config.md#catalog-pro | `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | | `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | | `replication_num` | The number of replications for the table. If not specified and the number of backend servers less than 3, then the default value is 1; If not specified and the number of backend servers greater or equals to 3, the default value (3) in Doris server will be used. For more, see the [doc](https://doris.apache.org/docs/1.2/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE/) | `1` or `3` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned. `30000` by default. | `30000` | No | -======= -| Configuration item | Description | Default value | Required | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| -| `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:9030` | (none) | Yes | -| `jdbc-driver` | The driver of the JDBC connection. For example, `com.mysql.jdbc.Driver`. | (none) | Yes | -| `jdbc-user` | The JDBC user name. | (none) | Yes | -| `jdbc-password` | The JDBC password. | (none) | Yes | -| `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | -| `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-idle` | Maximum idle connections retained per catalog per server; capped by `jdbc.pool.max-size`; takes precedence over `gravitino.bypass.maxIdle`. Idle connections are not evicted by default. | `8` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) +| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | Before using the Doris Catalog, you must download the corresponding JDBC driver to the `catalogs/jdbc-doris/libs` directory. Gravitino doesn't package the JDBC driver for Doris due to licensing issues. diff --git a/docs/jdbc-hologres-catalog.md b/docs/jdbc-hologres-catalog.md index 60223cacf5..a4412dbd47 100644 --- a/docs/jdbc-hologres-catalog.md +++ b/docs/jdbc-hologres-catalog.md @@ -43,7 +43,6 @@ Check the relevant data source configuration in [data source properties](https:/ If you use a JDBC catalog, you must provide `jdbc-url`, `jdbc-driver`, `jdbc-database`, `jdbc-user` and `jdbc-password` to catalog properties. Besides the [common catalog properties](./gravitino-server-config.md#catalog-properties-configuration), the Hologres catalog has the following properties: -<<<<<<< HEAD | Configuration item | Description | Default value | Required | |----------------------|-------------------------------------------------------------------------------------------------------------------------------|---------------|----------| | `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:postgresql://hgprecn-cn-xxx.hologres.aliyuncs.com:80/my_database` | (none) | Yes | @@ -53,19 +52,6 @@ Besides the [common catalog properties](./gravitino-server-config.md#catalog-pro | `jdbc-password` | The JDBC password (AccessKey Secret or database password). | (none) | Yes | | `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | | `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -======= -| Configuration item | Description | Default value | Required | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| -| `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:postgresql://hgprecn-cn-xxx.hologres.aliyuncs.com:80/my_database` | (none) | Yes | -| `jdbc-driver` | The driver of the JDBC connection. Must be `org.postgresql.Driver`. | (none) | Yes | -| `jdbc-database` | The database name. This is mandatory for Hologres. | (none) | Yes | -| `jdbc-user` | The JDBC user name (AccessKey ID or database username). | (none) | Yes | -| `jdbc-password` | The JDBC password (AccessKey Secret or database password). | (none) | Yes | -| `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | -| `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-idle` | Maximum idle connections retained per catalog per server; capped by `jdbc.pool.max-size`; takes precedence over `gravitino.bypass.maxIdle`. Idle connections are not evicted by default. | `8` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) :::caution Hologres uses the PostgreSQL JDBC Driver (version 42.3.2 or later recommended). You need to download the PostgreSQL JDBC Driver and place it in the `catalogs/jdbc-hologres/libs` directory under the Gravitino distribution (e.g., `distribution/package/catalogs/jdbc-hologres/libs` or `distribution/package-all/catalogs/jdbc-hologres/libs`). diff --git a/docs/jdbc-mysql-catalog.md b/docs/jdbc-mysql-catalog.md index 0c8846e8b2..4d5e691ba2 100644 --- a/docs/jdbc-mysql-catalog.md +++ b/docs/jdbc-mysql-catalog.md @@ -41,7 +41,6 @@ When using Gravitino with Trino, pass the Trino MySQL connector configuration us If you use a JDBC catalog, you must provide `jdbc-url`, `jdbc-driver`, `jdbc-user` and `jdbc-password` to catalog properties. Besides the [common catalog properties](./gravitino-server-config.md#catalog-properties-configuration), the MySQL catalog has the following properties: -<<<<<<< HEAD | Configuration item | Description | Default value | Required | |-------------------------|--------------------------------------------------------------------------------------------------------|---------------|----------| | `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:3306` | (none) | Yes | @@ -50,19 +49,7 @@ Besides the [common catalog properties](./gravitino-server-config.md#catalog-pro | `jdbc-password` | The JDBC password. | (none) | Yes | | `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | | `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned. `30000` by default. | `30000` | No | -======= -| Configuration item | Description | Default value | Required | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| -| `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:3306` | (none) | Yes | -| `jdbc-driver` | The driver of the JDBC connection. For example, `com.mysql.jdbc.Driver` or `com.mysql.cj.jdbc.Driver`. | (none) | Yes | -| `jdbc-user` | The JDBC user name. | (none) | Yes | -| `jdbc-password` | The JDBC password. | (none) | Yes | -| `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | -| `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-idle` | Maximum idle connections retained per catalog per server; capped by `jdbc.pool.max-size`; takes precedence over `gravitino.bypass.maxIdle`. Idle connections are not evicted by default. | `8` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) +| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | :::caution Gravitino does not package the MySQL JDBC driver, because MySQL Connector/J is diff --git a/docs/jdbc-oceanbase-catalog.md b/docs/jdbc-oceanbase-catalog.md index 0b502dcdcf..40c99f58a8 100644 --- a/docs/jdbc-oceanbase-catalog.md +++ b/docs/jdbc-oceanbase-catalog.md @@ -39,7 +39,6 @@ Check the relevant data source configuration in [data source properties](https:/ If you use a JDBC catalog, you must provide `jdbc-url`, `jdbc-driver`, `jdbc-user` and `jdbc-password` to catalog properties. Besides the [common catalog properties](./gravitino-server-config.md#catalog-properties-configuration), the OceanBase catalog has the following properties: -<<<<<<< HEAD | Configuration item | Description | Default value | Required | |-------------------------|---------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| | `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:2881` or `jdbc:oceanbase://localhost:2881` | (none) | Yes | @@ -48,19 +47,7 @@ Besides the [common catalog properties](./gravitino-server-config.md#catalog-pro | `jdbc-password` | The JDBC password. | (none) | Yes | | `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | | `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned. `30000` by default. | `30000` | No | -======= -| Configuration item | Description | Default value | Required | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| -| `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:2881` or `jdbc:oceanbase://localhost:2881` | (none) | Yes | -| `jdbc-driver` | The driver of the JDBC connection. For example, `com.mysql.jdbc.Driver` or `com.mysql.cj.jdbc.Driver` or `com.oceanbase.jdbc.Driver`. | (none) | Yes | -| `jdbc-user` | The JDBC user name. | (none) | Yes | -| `jdbc-password` | The JDBC password. | (none) | Yes | -| `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | -| `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-idle` | Maximum idle connections retained per catalog per server; capped by `jdbc.pool.max-size`; takes precedence over `gravitino.bypass.maxIdle`. Idle connections are not evicted by default. | `8` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) +| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | :::caution Gravitino does not package the OceanBase JDBC driver due to licensing, so you diff --git a/docs/jdbc-postgresql-catalog.md b/docs/jdbc-postgresql-catalog.md index c94002d1eb..b5def139a8 100644 --- a/docs/jdbc-postgresql-catalog.md +++ b/docs/jdbc-postgresql-catalog.md @@ -39,7 +39,6 @@ When using Gravitino with Trino, pass the Trino PostgreSQL connector configurati If you use JDBC catalog, you must provide `jdbc-url`, `jdbc-driver`, `jdbc-user` and `jdbc-password` to catalog properties. Besides the [common catalog properties](./gravitino-server-config.md#catalog-properties-configuration), the PostgreSQL catalog has the following properties: -<<<<<<< HEAD | Configuration item | Description | Default value | Required | |-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| | `jdbc-url` | A valid PostgreSQL JDBC URL, for example `jdbc:postgresql://localhost:5432/pg_database?sslmode=require`. If the URL omits the database, set `jdbc-database`. | (none) | Yes | @@ -49,20 +48,7 @@ Besides the [common catalog properties](./gravitino-server-config.md#catalog-pro | `jdbc-password` | The JDBC password. | (none) | Yes | | `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | | `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned. `30000` by default. | `30000` | No | -======= -| Configuration item | Description | Default value | Required | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|--------------------------------| -| `jdbc-url` | A valid PostgreSQL JDBC URL, for example `jdbc:postgresql://localhost:5432/pg_database?sslmode=require`. If the URL omits the database, set `jdbc-database`. | (none) | Yes | -| `jdbc-driver` | The driver of the JDBC connection. For example `org.postgresql.Driver`. | (none) | Yes | -| `jdbc-database` | The database of the JDBC connection. Derived from `jdbc-url` when omitted. An explicit value must be nonblank and match the URL database when both are provided. | (none) | Only if absent from `jdbc-url` | -| `jdbc-user` | The JDBC user name. | (none) | Yes | -| `jdbc-password` | The JDBC password. | (none) | Yes | -| `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | -| `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-idle` | Maximum idle connections retained per catalog per server; capped by `jdbc.pool.max-size`; takes precedence over `gravitino.bypass.maxIdle`. Idle connections are not evicted by default. | `8` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) +| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | :::caution Download the corresponding JDBC driver to the `catalogs/jdbc-postgresql/libs` directory. diff --git a/docs/jdbc-starrocks-catalog.md b/docs/jdbc-starrocks-catalog.md index ac0ffa3b4d..ad2d9850ce 100644 --- a/docs/jdbc-starrocks-catalog.md +++ b/docs/jdbc-starrocks-catalog.md @@ -40,7 +40,6 @@ more details. Besides the [common catalog properties](./gravitino-server-config.md#catalog-properties-configuration), the StarRocks catalog has the following properties: -<<<<<<< HEAD | Configuration item | Description | Default value | Required | |-------------------------|---------------------------------------------------------------------------------------------------|---------------|----------| | `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:9030` | (none) | Yes | @@ -49,19 +48,7 @@ Besides the [common catalog properties](./gravitino-server-config.md#catalog-pro | `jdbc-password` | The JDBC password. | (none) | Yes | | `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | | `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned. `30000` by default. | `30000` | No | -======= -| Configuration item | Description | Default value | Required | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| -| `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:9030` | (none) | Yes | -| `jdbc-driver` | The driver of the JDBC connection. For example, `com.mysql.jdbc.Driver`. | (none) | Yes | -| `jdbc-user` | The JDBC user name. | (none) | Yes | -| `jdbc-password` | The JDBC password. | (none) | Yes | -| `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | -| `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | -| `jdbc.pool.max-idle` | Maximum idle connections retained per catalog per server; capped by `jdbc.pool.max-size`; takes precedence over `gravitino.bypass.maxIdle`. Idle connections are not evicted by default. | `8` | No | -| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) +| `jdbc.pool.max-wait-ms` | The maximum Duration that the pool will wait for a connection to be returned; takes precedence over `gravitino.bypass.maxWaitMillis`. | `30000` | No | Before using the StarRocks Catalog, you must download the corresponding JDBC driver to the `catalogs/jdbc-starrocks/libs` directory. Gravitino doesn't package the JDBC driver for StarRocks due to licensing issues. diff --git a/spark-connector/spark-common/src/test/java/org/apache/gravitino/spark/connector/jdbc/TestJdbcPropertiesConverter.java b/spark-connector/spark-common/src/test/java/org/apache/gravitino/spark/connector/jdbc/TestJdbcPropertiesConverter.java index a0b91b456c..1703e355d0 100644 --- a/spark-connector/spark-common/src/test/java/org/apache/gravitino/spark/connector/jdbc/TestJdbcPropertiesConverter.java +++ b/spark-connector/spark-common/src/test/java/org/apache/gravitino/spark/connector/jdbc/TestJdbcPropertiesConverter.java @@ -31,12 +31,10 @@ public class TestJdbcPropertiesConverter { JdbcPropertiesConverter.getInstance(); @Test -<<<<<<< HEAD -======= - void testGetNoTablePropertiesInstance() { - JdbcPropertiesConverter instance = JdbcPropertiesConverter.getNoTablePropertiesInstance(); + void testGetPGInstance() { + JdbcPropertiesConverter instance = JdbcPropertiesConverter.getPGInstance(); Assertions.assertNotNull(instance); - Assertions.assertSame(instance, JdbcPropertiesConverter.getNoTablePropertiesInstance()); + Assertions.assertSame(instance, JdbcPropertiesConverter.getPGInstance()); Assertions.assertNotSame(instance, JdbcPropertiesConverter.getInstance()); Map<String, String> emptyProps = instance.toGravitinoTableProperties(ImmutableMap.of()); @@ -73,7 +71,6 @@ public class TestJdbcPropertiesConverter { } @Test ->>>>>>> 3ce91977a ([#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946)) void testCatalogProperties() { String url = "jdbc-url"; String user = "user1";
