Re: Bug in asynchronous Append

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Gleb Kashkin <g(dot)kashkin(at)postgrespro(dot)ru>
Cc: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in asynchronous Append
Date: 2026-08-05 12:15:35
Message-ID: CAPmGK14CiBkgu=p3KnhQKT7OR2kPetpkpXaPM0KZaZADhrWVcg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Aug 4, 2026 at 9:20 PM Gleb Kashkin <g(dot)kashkin(at)postgrespro(dot)ru> wrote:
> > Hi. It seems there is the last small issue with the patch.
> >
> > The following scenario is possible:
> >
> > 1) During rescan, one child of the Append has already produced a tuple
> > and set as_needrequest
> > 2) Another child still has callback_pending, but its postgres_fdw
> > connection is occupied by an async request belonging to a different
> > Append
> > 3) While draining the second child, postgresForeignAsyncConfigureWait()
> > sees the different requestor and the stale nonempty as_needrequest, so
> > it returns without registering an event
> > 4) The reset loop then repeats without making progress
> >
> > See reproducer and fix in the patch. It should be applied to v2.
> Sorry, misclicked. Here is the patch.

Good catch! I think that the scenario is possible, and the fix is
correct. I couldn't reproduce it in my environment, though. I think
it probably depends on the environment. I don't want to further
increase the elapsed time for the postgres_fdw regression test, for
this rather-minor case, so sorry, I incorporated only the fix, then
added asserts and tweaked the comment a bit. Attached is a new
version of the patch.

Thanks for the feedback and patch!

Best regards,
Etsuro Fujita

Attachment Content-Type Size
Fix-bug-in-async-append-efujita-v3.patch application/octet-stream 10.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-08-05 12:18:58 Re: Asynchronous MergeAppend
Previous Message Aleksander Alekseev 2026-08-05 12:03:03 [PATCH] Remove unused scram_client_key_len and scram_server_key_len fields