Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql duplicate key #158

Open
cmonkey opened this issue Mar 23, 2018 · 2 comments
Open

mysql duplicate key #158

cmonkey opened this issue Mar 23, 2018 · 2 comments

Comments

@cmonkey
Copy link
Contributor

cmonkey commented Mar 23, 2018

使用0d04161b9ea1ea1793fb1a0c9c64a08103488867编译的版本,使用mysql 数据库作为tx event 存储,日志中发现下列错误

[EL Warning]: 2018-03-23 03:32:59.887--UnitOfWork(159067768)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.1.v20171221-bd47e8f): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1613' for key 'eventId'
Error Code: 1062
Call: INSERT INTO Command (COMPENSATIONMETHOD, EVENTID, GLOBALTXID, INSTANCEID, LASTMODIFIED, LOCALTXID, PARENTTXID, PAYLOADS, SERVICENAME, STATUS, VERSION) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [11 parameters bound]

@eric-lee-ltk
Copy link
Contributor

When multiple scanners detect the failed event and compensate at the same time, it needs to store the compensate command only once. This is why we introduce the eventId as a unique key. With this constraint, no duplicate compensate commands will be stored in db.

@WillemJiang
Copy link
Member

@eric-lee-ltk I think we need to avoid the multiple scanner handle the same compensation to resolve this kind of issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants