fix(schema): forgive the race's SQLSTATE, not just the tidy one
CI caught a bug in c72eb70be's own fix. The handler I added to
`110_roles_and_privileges.sql` caught `duplicate_object`, and the race raises
`unique_violation`. The comment above it even quoted 23505 while the code
caught 42710.
Two orderings, two SQLSTATEs, and only one of them is the concurrent case:
42710 duplicate_object — the loser arrived after the winner COMMITTED, so
PostgreSQL's own "role already exists" check fired. Sequential. Tidy.
23505 unique_violation — the loser arrived while the winner was still IN
FLIGHT. Both passed that check, and the loser died on
`pg_authid_rolname_index` instead.
The second is the race. Catching only the first left the thing the block was
written to prevent uncaught, which CI demonstrated within the hour.
Proven rather than reasoned about. Ten concurrent sessions running the same DO
block against one cluster, roles dropped between rounds, three rounds each:
round 1 old handler 0/10 failed new handler 0/10
round 2 old handler 0/10 failed new handler 0/10
round 3 old handler 2/10 FAILED new handler 0/10
ERROR: duplicate key value violates unique constraint
"pg_authid_rolname_index"
Rounds 1 and 2 are the point as much as round 3: the race does not fire every
time, which is why local runs passed and a faster, more parallel CI runner did
not. A fix verified once against a race is a fix verified against nothing.
Also here: `RUSTD_INTEGRATION_IGNORE_ARGS` was deleted in c72eb70be but left a
comment explaining its own absence. A note whose subject no longer exists is
archaeology for the next reader to decode, so it goes too. `make/test-
integration-rustd.mk` now defines no variables at all; the three the suites read
— TEST_DATABASE_URL, TEST_REDIS_URL, TEST_REDIS_CA_CERT — are declared once in
`test-infra.mk` with `?=` and exported.
Verified: `make lint-rustd`, `make harness-verify`, `make test-integration-rustd`
(57 tests), and `make test-coverage-rustd` at 617 tests / 100.00% lines
(4377/4377).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> K
Kishore Kumar committed
11a3bcf107348c18ce359e3b09877a1664ecc0de
Parent: c72eb70