| From: | Xuneng Zhou <xunengzhou(at)gmail(dot)com> |
|---|---|
| To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
| Cc: | Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Anthony Hsu <erwaman(at)gmail(dot)com>, João Rito <joaovictor(dot)rito(at)gmail(dot)com>, shihao zhong <zhong950419(at)gmail(dot)com>, Dmytro Astapov <dastapov(at)gmail(dot)com>, pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
| Subject: | Re: Set 1s WaitLatch timeout if standby limit has expired in ResolveRecoveryConflictWithBufferPin |
| Date: | 2026-11-28 14:15:13 |
| Message-ID: | CABPTF7WOhh4G_X4WGCRQunfQ8s1JxHR-EbmgEXLyTrqd79A1Vw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Andrey,
On Sat, Nov 28, 2026 at 1:26 PM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
>
>
> > On 27 Nov 2026, at 17:27, Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
> >
> > Is this patch sufficient? I suspect not ... If not, I'm
> > inclined to wrap the whole test in a SKIP block until a complete fix is
> > developed.
> >
> > (There's also a 50_000 us timeout which is likely insufficient in slow
> > machines ...)
>
> I think the main problem is relying on a sleep for synchronization.
> On tamandua [0], the COPY backend itself was canceled before the second
> cursor opened. What about using an injection point?
>
> The attached patch for master pauses the first reader when it receives
> the conflict signal, while it still holds the pin. Only then does the
> second reader connect. If it gets a buffer pin conflict, startup must
> have sent the signal again.
> With the old wait restored, the test fails at that check. With the fix
> it passes locally with forced parallelism and beetle's log prefix.
>
> PG15 and PG16 lack injection points. I'd be fine with leaving this
> test case disabled there...
I agree with your analysis. For these branches, I wonder if we could
use SIGSTOP to pause the first reader so it cannot handle the conflict
signal or release the pin. That being said, I'm not sure we need it
since the whole 031 is skipped on v15/16.
In my tests, v1 passed with the fix reverted: the startup progress
timer woke the startup and caused another conflict signal. Fujii-san
has a thread to disable this timeout during replay on HEAD. It hasn't
landed yet, so we may still need to set the timeout to zero for now
and stable branches.
Could we wait for "User was holding shared buffer pin for too long" in
the final check? It seems simpler. With the confl_bufferpin check, if
the second reader is canceled during FETCH, it leaves the transaction
aborted and does not update the shared stats, so it might times out
even though the cancellation worked. I reproduced this by adding
adding pg_sleep(3) to the second reader's cursor query;
Attached is the perltidied v2 with those changes.
--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Synchronize-the-standby-buffer-pin-conflict-test.patch | application/octet-stream | 8.6 KB |
| nocfbot-v2-0001-PG15-PG16-Synchronize-the-standby-buffer-pin-conflict-test.patch | application/octet-stream | 8.0 KB |
| nocfbot-v2-0001-PG18-Synchronize-the-standby-buffer-pin-conflict-test.patch | application/octet-stream | 8.7 KB |
| nocfbot-v2-0001-PG17-Synchronize-the-standby-buffer-pin-conflict-test.patch | application/octet-stream | 8.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2026-11-28 15:21:30 | Re: logical decoding: removing change_useless_for_repack() |
| Previous Message | Andrei Lepikhov | 2026-11-28 14:07:59 | Re: Use local buffer for packed numerics |