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

Fix regions key violation on createOrUpdateRegion #1601

Open
f1sh1918 opened this issue Aug 27, 2024 · 2 comments
Open

Fix regions key violation on createOrUpdateRegion #1601

f1sh1918 opened this issue Aug 27, 2024 · 2 comments
Assignees
Labels
Bug Something isn't working prio: high Issue must be solved within the next weeks. Task

Comments

@f1sh1918
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When starting the backend service on current main we are facing some constraint violation issue for the nuernberg region

Aug 27 13:38:42 entitlementcard-test.tuerantuer.org backend[819143]: [main] INFO Exposed - Preparing alter table statements took 632ms
Aug 27 13:38:42 entitlementcard-test.tuerantuer.org backend[819143]: [main] INFO Exposed - Checking mapping consistence took 223ms
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]: [main] WARN Exposed - Transaction attempt #0 failed: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO regions ("activatedForApplicatio>
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]: RETURNING * was aborted: ERROR: duplicate key value violates unique constraint "regions_pkey"
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:   Detail: Key (id)=(94) already exists.  Call getNextException to see other errors in the batch.. Statement(s): INSERT INTO regions ("activate>
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]: org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO regions ("activatedForApplicati>
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]: RETURNING * was aborted: ERROR: duplicate key value violates unique constraint "regions_pkey"
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:   Detail: Key (id)=(94) already exists.  Call getNextException to see other errors in the batch.
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]: SQL: [INSERT INTO regions ("activatedForApplication", "activatedForCardConfirmationMail", "name", prefix, "projectId", "regionIdentifier", web>
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:65)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:158)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:144)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.statements.Statement.execute(Statement.kt:28)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.QueriesKt.executeBatch(Queries.kt:207)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.QueriesKt.batchInsert(Queries.kt:106)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.QueriesKt.batchInsert(Queries.kt:92)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.sql.QueriesKt.batchInsert$default(Queries.kt:87)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.dao.EntityCache$flushInserts$ids$1.invoke(EntityCache.kt:183)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.dao.EntityCache$flushInserts$ids$1.invoke(EntityCache.kt:182)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.dao.EntityLifecycleInterceptorKt.executeAsPartOfEntityLifecycle(EntityLifecycleInterceptor.kt:18)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.dao.EntityCache.flushInserts$exposed_dao(EntityCache.kt:182)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.dao.EntityCache.flush(EntityCache.kt:137)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.dao.EntityCache.flush(EntityCache.kt:106)
Aug 27 13:38:43 entitlementcard-test.tuerantuer.org backend[819143]:         at org.jetbrains.exposed.dao.EntityCacheKt.flushCache(EntityCache.kt:242)

Describe the solution you'd like

  • fix that issue which may require an additional migration
@f1sh1918 f1sh1918 added Bug Something isn't working Task prio: high Issue must be solved within the next weeks. labels Aug 27, 2024
@f1sh1918
Copy link
Contributor Author

After some restarting it was gone. Maybe related to #1602

@ztefanie
Copy link
Member

ztefanie commented Sep 4, 2024

Cannot reproduce

@ztefanie ztefanie self-assigned this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working prio: high Issue must be solved within the next weeks. Task
Projects
Status: No status
Development

No branches or pull requests

2 participants