yuqi1129 opened a new issue, #13173: URL: https://github.com/apache/gravitino/issues/13173
### Describe the subtask `importTable` trusts the `StringIdentifier` found in the external table's properties and writes the row with `overwrite = true`. `table_id` is the primary key, so a copied id (`CREATE TABLE t2 LIKE t1`, a copy tool, a restored backup) makes `insertTableMetaOnDuplicateKeyUpdate` **rename the existing row** to the new name/parent and move its owner, tags, policies, role grants and statistics with it. The next load of the original table moves them back; the two tables keep swapping one identity. `ViewMetaService`, `FunctionMetaService` and `TagMetaService` already guard this with `OccWriteSupport.findAndLockForOverwrite`; `TableMetaService`, `SchemaMetaService` and `TopicMetaService` do not, and none of them covers a same-parent, different-name collision. Proposed change: - In the import path, lock the id and refuse it when it belongs to a live entity with another name or parent (any parent, same parent included). - On collision: log, mint a new id, count it in a metric; never move an existing row. - Also note the MySQL/PostgreSQL difference: on MySQL a natural-key conflict keeps the old `table_id`; on PostgreSQL it fails. Behaviour must be the same on both after this change. - Tests: two live external objects carrying one id, on H2/MySQL/PostgreSQL. Design: implementation design Part 1 (F3 / E3). Gate G1. ### Parent issue https://github.com/apache/gravitino/issues/10238 -- 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]
