jiangxt2 opened a new pull request, #12832:
URL: https://github.com/apache/gravitino/pull/12832

   ### What changes were proposed in this pull request?
   
   This PR manually backports #12763 to `branch-1.3` and supersedes the 
unresolved automated cherry-pick PR #12790.
   
   - Override the ClickHouse table rename path so tables with trusted Gravitino 
cluster metadata use `RENAME TABLE ... ON CLUSTER ...`, while unmarked external 
tables keep local rename behavior.
   - Read the existing table metadata from `system.tables` with an exact 
current-database and table-name predicate, and reject a present but blank 
cluster marker before executing DDL.
   - Preserve the existing ClickHouse exception mapping and identifier quoting 
contract without changing the common JDBC rename path.
   - Expand the ClickHouse cluster fixture to three independently addressable 
nodes and add lifecycle coverage for rename propagation, query text, all-node 
state, comment metadata, and cleanup.
   - Resolve the branch-1.3 unit-test conflict by retaining the target branch 
tests and only the rename-related tests from #12763; source-branch-only index 
parameter tests are not included.
   
   ### Why are the changes needed?
   
   The common JDBC rename path generates a local `RENAME TABLE old_name TO 
new_name` statement. For ClickHouse tables created through Gravitino with `ON 
CLUSTER`, that statement renames only the JDBC connection node and leaves the 
old name on the other nodes, silently splitting cluster metadata and making 
later DDL inconsistent.
   
   ClickHouse does not include `ON CLUSTER` in `SHOW CREATE TABLE`, so the 
connector must use the trusted cluster marker embedded in the stored comment 
when generating the rename statement.
   
   The automated backport PR #12790 contains unresolved conflict markers in the 
ClickHouse unit test. This PR resolves that conflict against the current 
`branch-1.3` baseline without carrying unrelated source-branch changes.
   
   The source-branch-only `StringIdentifier.ID_KEY` property assertions are not 
carried into this `branch-1.3` backport because the existing branch-1.3 
ClickHouse flow does not expose that derived property for this test path. The 
cluster integration test still verifies that the raw StringIdentifier and 
cluster marker remain in `system.tables.comment` on every node.
   
   Fix: #12761
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Renaming a Gravitino-created ClickHouse table with trusted cluster 
metadata now propagates the rename to every configured cluster node. Local 
tables and unmarked external tables retain local rename behavior. This PR does 
not add, remove, or change catalog-facing APIs or property keys.
   
   ### How was this patch tested?
   
   - `./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:spotlessCheck` — 
passed.
   - `./gradlew rat` — passed.
   - `./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test -PskipITs 
-PskipDockerTests=true` — passed.
   - `./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test --tests 
'org.apache.gravitino.catalog.clickhouse.integration.test.CatalogClickHouseIT' 
-PskipDockerTests=false` — passed.
   - `./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test --tests 
'org.apache.gravitino.catalog.clickhouse.integration.test.CatalogClickHouseClusterIT'
 -PskipDockerTests=false` — passed with 18 tests, 0 skipped, 0 failures, and 0 
errors.
   - `./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:build -x test` — 
passed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to