Skip to content

Test that senders do not serialize or deadlock on insert notifications - #10

Open
iGrog wants to merge 12 commits into
thesis-php:0.5.xfrom
iGrog:test/pgmq-notify-without-throttle-row-lock
Open

iGrog wants to merge 12 commits into
thesis-php:0.5.xfrom
iGrog:test/pgmq-notify-without-throttle-row-lock

Conversation

@iGrog

@iGrog iGrog commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Integration tests for #9, on top of the pgmq test setup from #8.

The branch is stacked: it carries #8 (test setup), #6 (backlog drain) and #9 (the fix) so that every test here can pass on its own. The only new commit is "Test that senders do not serialize or deadlock on insert notifications"; once #6, #8 and #9 are in, the diff shrinks to that commit.

  • two producers on one queue don't wait for each other;
  • crosswise sends to two queues don't deadlock;
  • publish wakes the subscribed consumer, and only after commit;
  • createQueue() removes the insert trigger of an earlier setup;
  • createQueue() doesn't stall a busy queue while doing so.

On the current 0.5.x the first two fail with a lock wait and deadlock detected, and the trigger tests fail because the trigger is still there. concurrentConsumerStartsCreateTheTriggerOnce from #8 is removed: with #9 consumers no longer create the trigger.

iGrog added 9 commits October 7, 2026 12:38
…next signal

A backlog that is already in the queue produces no further insert notifications,
so after reading one batch the consumer slept until the poll interval elapsed:
a queue of N messages took ~N/batch * pollInterval (5 s by default) to drain.
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.
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)
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.
iGrog added 3 commits November 9, 2026 15:00
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).
…' into test/pgmq-notify-without-throttle-row-lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant