[Bug]: duplicate key value in a unique or primary key constraint or unique index identified by 'TABLE_RUNTIME_PK' defined on 'TABLE_RUNTIME'
What happened?
In CI there was an duplicate key error
16:41:04.578 INFO org.apache.amoro.server.table.DefaultTableService: Syncing external catalogs took 39 ms.
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.196 s - in org.apache.amoro.server.persistence.TestPersistentBase
[INFO]
[INFO] Results:
[INFO]
Error: Failures:
Error: TestInternalMixedCatalogService$TestDatabaseOperation.test:168 expected:
Error updating database. Cause: org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'TABLE_RUNTIME_PK' defined on 'TABLE_RUNTIME'.
The error may exist in org/apache/amoro/server/persistence/mapper/TableMetaMapper.java (best guess)
The error may involve org.apache.amoro.server.persistence.mapper.TableMetaMapper.insertTableRuntime-Inline
The error occurred while setting parameters
SQL: INSERT INTO table_runtime (table_id, catalog_name, db_name, table_name, current_snapshot_id, current_change_snapshotId, last_optimized_snapshotId, last_optimized_change_snapshotId, last_major_optimizing_time, last_minor_optimizing_time, last_full_optimizing_time, optimizing_status_code, optimizing_status_start_time, optimizing_process_id, optimizer_group, table_config, pending_input, table_summary) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Cause: org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'TABLE_RUNTIME_PK' defined on 'TABLE_RUNTIME'.
Error: TestInternalMixedCatalogService$TestTableOperation.before:186 » AlreadyExists Database: test_ns already exists. Error: TestInternalMixedCatalogService$TestTableOperation.before:186 » AlreadyExists Database: test_ns already exists. [INFO]
https://github.com/apache/amoro/actions/runs/14957630498/job/42015437155?pr=3555
Affects Versions
master
What table formats are you seeing the problem on?
No response
What engines are you seeing the problem on?
No response
How to reproduce
No response
Relevant log output
Anything else
No response
Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
another case https://github.com/apache/amoro/actions/runs/15481818593/job/43588911234?pr=3600
another case https://github.com/apache/amoro/actions/runs/15465788441/job/43537430320?pr=3557