Starting two Archie instances against the same fresh PostgreSQL database can make one exit during migration with tuple concurrently updated while granting runtime privileges.
Reproduce
Start both instances concurrently against the same fresh database. One can fail during the runtime privilege grants.
Done when
Concurrent startup serialises or retries the migration and privilege grants safely. Both instances remain running and become ready once the database is available.
## Problem
Starting two Archie instances against the same fresh PostgreSQL database can make one exit during migration with `tuple concurrently updated` while granting runtime privileges.
## Reproduce
Start both instances concurrently against the same fresh database. One can fail during the runtime privilege grants.
## Done when
Concurrent startup serialises or retries the migration and privilege grants safely. Both instances remain running and become ready once the database is available.
sam
added the mediumbug labels 2026-11-21 00:46:09 +00:00
Fixed in 2e48acfc9. pg.Migrate now holds one session-level advisory lock (pg_advisory_lock(hashtextextended('archie.migrate.owner', 0)), on a dedicated connection) across both the goose migrations and the runtime role grants. A second instance waits, then finds the migrations applied and the grants already in place. Goose's own session locker covered only the migrations, so it was removed in favour of the one lock. A migration or grant failure now goes through the existing startup retry with backoff instead of exiting.
Verified: vet, tests and lint, and task check on the merged tree. Not verified: two instances racing against a real fresh database. No test, per the repo rules for races.
Fixed in 2e48acfc9. `pg.Migrate` now holds one session-level advisory lock (`pg_advisory_lock(hashtextextended('archie.migrate.owner', 0))`, on a dedicated connection) across both the goose migrations and the runtime role grants. A second instance waits, then finds the migrations applied and the grants already in place. Goose's own session locker covered only the migrations, so it was removed in favour of the one lock. A migration or grant failure now goes through the existing startup retry with backoff instead of exiting.
Verified: vet, tests and lint, and `task check` on the merged tree. Not verified: two instances racing against a real fresh database. No test, per the repo rules for races.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Starting two Archie instances against the same fresh PostgreSQL database can make one exit during migration with
tuple concurrently updatedwhile granting runtime privileges.Reproduce
Start both instances concurrently against the same fresh database. One can fail during the runtime privilege grants.
Done when
Concurrent startup serialises or retries the migration and privilege grants safely. Both instances remain running and become ready once the database is available.
Fixed in
2e48acfc9.pg.Migratenow holds one session-level advisory lock (pg_advisory_lock(hashtextextended('archie.migrate.owner', 0)), on a dedicated connection) across both the goose migrations and the runtime role grants. A second instance waits, then finds the migrations applied and the grants already in place. Goose's own session locker covered only the migrations, so it was removed in favour of the one lock. A migration or grant failure now goes through the existing startup retry with backoff instead of exiting.Verified: vet, tests and lint, and
task checkon the merged tree. Not verified: two instances racing against a real fresh database. No test, per the repo rules for races.