Re: Optimize LISTEN/NOTIFY
| От | Joel Jacobson | 
|---|---|
| Тема | Re: Optimize LISTEN/NOTIFY | 
| Дата | |
| Msg-id | 17b2225a-90d6-4b6f-af45-f6ec243893e5@app.fastmail.com обсуждение исходный текст  | 
		
| Ответ на | Re: Optimize LISTEN/NOTIFY ("Joel Jacobson" <joel@compiler.org>) | 
| Список | pgsql-hackers | 
On Sun, Oct 26, 2025, at 07:33, Joel Jacobson wrote:
> Trying to apply them on top of current master 
> (39dcfda2d23ac39f14ecf4b83e01eae85d07d9e5):
>
> ```
> % git apply 0001-optimize_listen_notify-v20.patch
> % git apply 0002-optimize_listen_notify-v20.patch
> % git apply 0002-optimize_listen_notify-v20-alt3.txt
> % git apply 0001-TAP-test-with-listener-pos-race.patch.nocfbot
> % git apply fix-race.patch
> fix-race.patch:100: indent with spaces.
>                          (QUEUE_POS_PRECEDES(queueHeadBeforeWrite, pos) && 
> QUEUE_POS_PRECEDES(pos, queueHeadAfterWrite))) &&
> error: patch failed: src/backend/commands/async.c:250
> error: src/backend/commands/async.c: patch does not apply
> error: patch failed: src/test/authentication/t/008_listen-pos-race.pl:8
> error: src/test/authentication/t/008_listen-pos-race.pl: patch does not 
> apply
> ```
>
> I'll try to resolve it manually, but in case you're quicker to reply, 
> I'm sending this now.
I see the problem; seems like you based fix-race.patch on top of
0002-optimize_listen_notify-v19-alt3.txt because fix-race.patch contains
this diff block which is only present in that version:
```
@@ -2441,21 +2485,29 @@ asyncQueueReadAllNotifications(void)
                                                    page_buffer.buf,
                                                    snapshot);
 
-        /*
-         * Update our position in shared memory.  The 'pos' variable now
-         * holds our new position (advanced past all messages we just
-         * processed).  This ensures that if we fail while processing
```
I've compared 0002-optimize_listen_notify-v19-alt3.txt with
0002-optimize_listen_notify-v20-alt3.txt and it's only the addition of
QUEUE_POS_PRECEDES which fix-race.patch also adds, and some locking and
pos handling differences.
/Joel
		
	В списке pgsql-hackers по дате отправления: