Hi,

If a listener fails while taking its snapshot in
asyncQueueReadAllNotifications(), its isAdvancing flag stays set. After
that no NOTIFY wakes or advances it, so the queue stops shrinking and
fills up. This is new in 19, from 282b1cde9de.

A cancel while the listener waits for a safe snapshot is enough:

L listens, W holds a serializable transaction, N sends notifications

  set default_transaction_isolation = serializable;      -- L
  set default_transaction_read_only = on;                -- L
  set default_transaction_deferrable = on;               -- L
  listen cfg;                                            -- L
  begin isolation level serializable; select 1;          -- W
  begin isolation level read committed read write not deferrable;  -- L
  notify cfg;                                            -- N
  commit;     -- L, waits on SafeSnapshot, cancel it
  rollback;                                              -- W
  select pg_notify('other', repeat('x', 7000));          -- N, 16 times

The attached patch clears the flag on abort.

This is the third low item in my list [1].

[1]
https://postgr.es/m/cagrkxqsfdjqzp_kwrz7dv6lhx-csrkdnynnxgntrscenqtk...@mail.gmail.com

Thanks,
Shihao

Attachment: v1-0001-Clear-isAdvancing-when-a-notify-read-is-aborted.patch
Description: Binary data

Reply via email to