Skip to content

[Cherry-pick to branch-1.3] [#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946) - #14035

Merged
yuqi1129 merged 3 commits into
branch-1.3from
cherry-pick-3ce91977-to-branch-1.3
Oct 21, 2026
Merged

yuqi1129 merged 3 commits into
branch-1.3from
cherry-pick-3ce91977-to-branch-1.3

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

What changes were proposed in this pull request?

Backport commit 3ce91977a2d137af39321716a9fb5813922afceb (#13946) to branch-1.3: honor JDBC pool wait settings and validate MySQL table properties.

Resolve the committed conflict markers while retaining the 1.3 validation query, connection timeout handling and Spark getPGInstance() API. Adapt tests to the existing 1.3 ALTER connection lifecycle. Pool max-idle and table credential-vending settings are not introduced by this backport.

Why are the changes needed?

Configured pool wait values could be lost or overwritten, and unsupported MySQL table options could reach generated SQL. This backport brings the fixes to 1.3.

Does this PR introduce any user-facing change?

Yes. JDBC pool wait settings are honored, and unsupported or invalid MySQL table options are rejected before DDL is executed.

How was this patch tested?

  • 70 targeted non-Docker tests passed across JDBC common, MySQL, Flink common and Spark common.
  • Formatting and conflict-marker checks passed.
  • Six mutation cases fail if the retained SELECT 1 pool validation query is removed, then pass after restoration.
  • Docker tests were not run locally because the Docker daemon is unavailable; CI validation is pending.

… properties (#13946)

### What changes were proposed in this pull request?

- Register and forward `jdbc.pool.max-wait-ms` so it reaches the JDBC
connection pool. As with `jdbc.pool.max-idle`, an explicit canonical
value takes precedence over `gravitino.bypass.maxWaitMillis`; the
canonical default no longer overrides a bypassed `maxWaitMillis`.
- Reject undeclared MySQL table properties instead of silently dropping
them, while retaining internal identifier and credential metadata
handling.
- Decode supported MySQL options using their declared enum/integer types
and render canonical SQL values. Apply the same validation to
create/alter SQL generation.
- Remove Spark's implicit `owner` metadata in the JDBC connector before
forwarding table options, preserving normal Spark table creation under
strict MySQL validation.
- Strip the JDBC scan options the Flink connector injects (`url`,
`table-name`, `username`, `password`) before forwarding table options,
so `CREATE TABLE ... LIKE` keeps working and the catalog password is no
longer sent as a table property. Same-named options written explicitly
in `WITH` are dropped too; they never took effect, because scan options
are always regenerated from the catalog connection.
- Make the shared Flink catalog ITs send arbitrary `WITH` options only
to catalogs that accept custom table properties; the MySQL Flink IT opts
out.
- Clarify the MySQL property names and immutable-property policy in the
catalog documentation, and list the supported keys in the rejection
message.
- Document `jdbc.pool.max-wait-ms` and its bypass precedence in every
JDBC catalog page (adds the missing Hologres row).

### Why are the changes needed?

The canonical pool-wait setting currently falls back to `30000` ms.
Unknown MySQL table properties are accepted and then discarded by
mapping on both create and alter. This patch corrects these two
property-handling paths; it does not claim that unknown properties
bypass immutability through the public API.

Fix: #13945

### Does this PR introduce _any_ user-facing change?

Configured pool wait times take effect, whether set through
`jdbc.pool.max-wait-ms` or `gravitino.bypass.maxWaitMillis`. Values that
were previously ignored now apply after upgrade: a stored non-positive
`jdbc.pool.max-wait-ms` fails catalog initialization, and a bypassed
`maxWaitMillis=-1` means an unbounded wait. MySQL create/alter requests
with unknown table properties now fail with an error naming the key.
Supported values are validated before DDL. Shared metadata keys that
every entity accepts (the internal identifier and credential-vending
keys) are still accepted and not turned into MySQL options, since they
are not table options. `engine` and `auto-increment-offset` remain
immutable, and strict unknown-key validation is scoped to MySQL. Spark
JDBC no longer forwards its reserved `owner` metadata as a table option;
other user-supplied keys continue to reach the server for
catalog-specific handling.

### How was this patch tested?

- Full JDBC common and MySQL non-Docker unit suites: 106 and 29 tests
passed.
- Regressions exercise catalog initialization through the actual pool,
catalog create/alter property mapping, internal metadata handling, and
create/alter SQL generation before any connection is borrowed.
- Separate mutation checks revert the pool registration, MySQL metadata
validation, and SQL validation; the corresponding regression cases fail
as expected.
- MySQL catalog module with Docker enabled: 51 tests passed, including
real create/alter property round trips.
- Full Spark 3.5 and 4.0 non-Docker suites: 233 and 229 tests passed,
including implicit-owner removal and preservation of unknown user keys
for server-side validation.
- Reverting Spark owner removal makes both owner regression cases fail;
restoring the fix passes all four converter tests.
- Pool wait precedence covers canonical, prefixed canonical and DBCP
`maxWaitMillis` bypass combinations (6 cases); reverting the precedence
guard fails the bypass-only case.
- Flink converter suites (MySQL, PostgreSQL) cover stripping injected
scan options; removing the stripping fails both. A new `CREATE TABLE ...
LIKE` case in `FlinkJdbcMysqlCatalogIT119` fails without the fix
(`Unsupported MySQL table property: password`) and passes with it.
- `FlinkJdbcMysqlCatalogIT119` with Docker MySQL: 30 tests, 0 failures,
including the LIKE case and the four create-table cases that previously
sent unsupported options.
- JDBC common, MySQL, and Spark common, and Flink common Spotless
checks.
# Conflicts:
#	catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java
#	catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/utils/DataSourceUtils.java
#	catalogs/catalog-jdbc-common/src/test/java/org/apache/gravitino/catalog/jdbc/TestJdbcCatalogPropertiesMetadata.java
#	catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/operation/TestMysqlTableOperations.java
#	docs/jdbc-clickhouse-catalog.md
#	docs/jdbc-doris-catalog.md
#	docs/jdbc-hologres-catalog.md
#	docs/jdbc-mysql-catalog.md
#	docs/jdbc-oceanbase-catalog.md
#	docs/jdbc-postgresql-catalog.md
#	docs/jdbc-starrocks-catalog.md
#	spark-connector/spark-common/src/test/java/org/apache/gravitino/spark/connector/jdbc/TestJdbcPropertiesConverter.java
@github-actions github-actions Bot added cherry-pick Automatically opened cherry-pick PR cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge labels Oct 20, 2026
@github-actions
github-actions Bot requested a review from jerryshao October 20, 2026 21:08
@yuqi1129 yuqi1129 removed the cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge label Oct 21, 2026
@yuqi1129 yuqi1129 changed the title [DO NOT MERGE] [Cherry-pick to branch-1.3] [#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946) [Cherry-pick to branch-1.3] [#13945] fix(jdbc): Honor pool wait settings and validate MySQL table properties (#13946) Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Author

Code Coverage Report

Overall Project 69.68% +0.29% 🟢
Files changed 87.58% 🟢

Module Coverage
aliyun 19.74% 🔴
api 47.41% 🟢
authorization-common 85.96% 🟢
authorization-ranger 10.17% 🔴
aws 60.78% 🟢
aws-bundle 0.0% 🔴
azure 68.04% 🟢
azure-bundle 0.0% 🔴
catalog-common 19.13% 🔴
catalog-fileset 80.73% 🟢
catalog-glue 71.33% 🟢
catalog-hive 80.55% 🟢
catalog-jdbc-clickhouse 84.7% 🟢
catalog-jdbc-common 53.51% +5.27% 🟢
catalog-jdbc-doris 85.55% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 84.98% +15.69% 🟢
catalog-jdbc-oceanbase 78.93% +14.59% 🟢
catalog-jdbc-postgresql 83.62% 🟢
catalog-jdbc-starrocks 79.72% +2.09% 🟢
catalog-kafka 75.49% 🟢
catalog-lakehouse-generic 76.11% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.9% 🟢
catalog-lakehouse-paimon 82.17% 🟢
catalog-model 77.99% 🟢
cli 44.51% 🟢
client-java 78.45% 🟢
client-java-runtime 0.0% 🔴
common 51.51% 🟢
core 83.9% 🟢
filesystem-hadoop3 77.68% 🟢
flink 18.07% 🔴
flink-common 50.97% +1.27% 🟢
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-common 15.43% 🔴
hive-metastore-common 62.61% 🟢
hive-metastore3-libs 58.8% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 60.96% 🟢
iceberg-rest-server 76.5% 🟢
idp-basic 86.94% +0.54% 🟢
integration-test-common 0.0% 🔴
jobs 60.37% 🟢
lance-common 35.51% 🔴
lance-rest-server 79.88% 🟢
lineage 59.39% 🟢
optimizer 82.92% 🟢
optimizer-api 42.56% 🟢
server 89.66% 🟢
server-common 79.25% 🟢
spark 28.57% 🔴
spark-common 51.29% +0.6% 🟢
trino-connector 62.84% 🟢
Files
Module File Coverage
catalog-jdbc-common JdbcCatalogPropertiesMetadata.java 100.0% 🟢
DataSourceUtils.java 89.71% 🟢
catalog-jdbc-mysql MysqlTablePropertiesMetadata.java 100.0% 🟢
MysqlTableOperations.java 88.06% 🟢
catalog-jdbc-oceanbase OceanBaseTableOperations.java 83.96% 🟢
catalog-jdbc-starrocks StarRocksTableOperations.java 82.72% 🟢
flink-common JdbcPropertiesConverter.java 97.78% 🟢
idp-basic IdpUserGroupManager.java 92.94% 🟢
spark-common JdbcPropertiesConverter.java 93.1% 🟢

@yuqi1129
yuqi1129 merged commit 7a58dd7 into branch-1.3 Oct 21, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick Automatically opened cherry-pick PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant