-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Describe the bug
Currently, when all three services (API, Delivery, Log) restart at the same time, there is a rare case where all of them attempt to run the migration concurrently. This leads to a migration lock acquisition error for the other services, causing them to fail to start.
migrate.New: failed to open database: try lock failed in line 0: SELECT pg_advisory_lock($1) (details: pq: unnamed prepared statement does not exist)
To Reproduce
Steps to reproduce the behavior:
- Redeploy all three services (API, Delivery, Log) simultaneously
- Observe the startup logs for each service
- Occasionally, only one service successfully acquires the migration lock and completes the migration; the other services fail to start due to a migration lock acquisition error
Expected behavior
If a service cannot acquire the migration lock, it should retry after a delay
Optionally, it should be possible to configure only one service to perform the migration, while others skip this step. Or enforce only API to perform this migration task.
Screenshots
N/A
Additional context
The migration lock is managed by the golang-migrate library here
Metadata
Metadata
Assignees
Labels
Type
Projects
Status