Repository navigation
Conversation
Adds a pgmq service to compose.yaml (THESIS_PGMQ_DSN) and the first PgmqTransport tests: a backlog must drain without waiting for the poll interval, a consumer start must not wait for open producer transactions, and createQueue() must set up insert notifications.
This was referenced Oct 7, 2026
pgmq.notify_insert_throttle is UNLOGGED: crash recovery (or a promoted replica) empties it, and the insert trigger then never notifies. The test removes the queue's row and expects a consumer (re)start to bring notifications back.
Recent PHPStan 2.2.x infers the nested property assignment correctly, so the ignore is unmatched and phpstan fails on every cell of the CI matrix (8.4/8.5 x lowest/highest). (cherry picked from commit ec45573)
- 4 consumers (separate pools, like worker processes) starting at once on a queue without notifications create the trigger exactly once (counted with an event trigger); - a consumer start restores a disabled trigger.
Contributor
Author
|
Updated the tests:
On |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2, #3.
The PGMQ transport had no tests. This PR adds:
pgmqservice tocompose.yaml(ghcr.io/pgmq/pg18-pgmq:v1.11.1, the same imagethesis/pgmquses) andTHESIS_PGMQ_DSNfor thephpservice.make testalready runsup, so the CI needs no changes;PgmqTransportTest::consumerDrainsBacklogWithoutWaitingForPollInterval;PgmqNotifyTriggerTest:consumerStartDoesNotWaitForProducerTransactions: notifications set up, a producer keeps an insert open, the start must not wait;concurrentConsumerStartsCreateTheTriggerOnce: 4 workers (separate pools, like worker processes) start at once on a queue without notifications, while an open producer transaction forces the starts to overlap;CREATE TRIGGERis counted with an event trigger and must be exactly 1, with no failed starts;consumerStartRestoresNotificationsLostInCrashRecovery: the queue's row in the UNLOGGEDpgmq.notify_insert_throttleis removed (what crash recovery does), and a start must bring notifications back;consumerStartRestoresDisabledTrigger;createdQueueWakesConsumerOnInsert:createQueue()sets notifications up.Whether the package's dev environment should include Postgres is your call. That is why the fixes (#6, #7) are separate PRs that do not depend on this one.
Expected CI result
0.5.x): exactly 3 tests fail, on purpose, one per defect:consumerDrainsBacklogWithoutWaitingForPollInterval(PgmqTransport: consumer reads one batch per poll signal, a backlog waitspollIntervalbetween batches #2), andconsumerStartDoesNotWaitForProducerTransactionsandconcurrentConsumerStartsCreateTheTriggerOnce(PgmqTransport: every consumer start recreates the notify trigger (table lock, blocked producers, deadlocks) #3). The concurrent test collects start failures instead of leaking them into other tests.thesis/pgmqcontaining Do not recreate the notify trigger on consumer start; ensure notifications under the queue lock pgmq#22: 14/14 green (verified locally against that pgmq branch).The event-trigger test needs a superuser connection, which the compose service provides.