Skip to content

[hotfix] fix primary key conflict issue caused by multiple insertions in single-node persistence.#4177

Closed
czy006 wants to merge 1 commit intoapache:masterfrom
czy006:issues/hot-fix-tableruntime
Closed

[hotfix] fix primary key conflict issue caused by multiple insertions in single-node persistence.#4177
czy006 wants to merge 1 commit intoapache:masterfrom
czy006:issues/hot-fix-tableruntime

Conversation

@czy006
Copy link
Copy Markdown
Contributor

@czy006 czy006 commented Apr 13, 2026

Why are the changes needed?

### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1000' for key 'PRIMARY'
### The error may exist in org/apache/amoro/server/persistence/mapper/TableRuntimeMapper.java (best guess)
### The error may involve org.apache.amoro.server.persistence.mapper.TableRuntimeMapper.insertRuntime-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO table_runtime (table_id, group_name, status_code, table_config, table_summary, bucket_id) VALUES (?, ?, ?, ?, ?, ?)
### Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1000' for key 'PRIMARY'
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.5.15.jar:3.5.15]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199) ~[mybatis-3.5.15.jar:3.5.15]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184) ~[mybatis-3.5.15.jar:3.5.15]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) ~[mybatis-3.5.15.jar:3.5.15]
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:141) ~[mybatis-3.5.15.jar:3.5.15]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[mybatis-3.5.15.jar:3.5.15]
at com.sun.proxy.$Proxy59.insertRuntime(Unknown Source) ~[?:?]
at org.apache.amoro.server.table.DefaultTableService.lambda$triggerTableAdded$36(DefaultTableService.java:912) ~[classes/:?]
at org.apache.amoro.server.persistence.PersistentBase.doAs(PersistentBase.java:67) ~[classes/:?]
... 12 more

Brief change log

  • fix primary key conflict issue caused by multiple insertions in single-node persistence. ConradJam A minute ago

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not documented)

@github-actions github-actions bot added the module:ams-server Ams server module label Apr 13, 2026
@czy006
Copy link
Copy Markdown
Contributor Author

czy006 commented Apr 13, 2026

cc @wardlican

@wardlican
Copy link
Copy Markdown
Contributor

cc @wardlican
This PR addresses this issue.
#4174

@czy006 czy006 closed this Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ams-server Ams server module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants