On Thu, Oct 15, 2026 at 8:34 PM Etsuro Fujita <[email protected]> wrote:
> I've already started reworking on Alexander
> Pyhalov's original patch for that.  I will post a reworked version as
> soon as possible.

Here is an updated version of the patch, which I created with AI
assistance.  In the patch I removed the changes made to both the
MergeAppendState struct and nodeMergeAppend.c so that async execution
of MergeAppend works (almost) the same as that of Append, and then
modified them in a more optimized way, which makes the patch pretty
small/simple.

Some notes about the patch:

* As for the struct, I removed from it ms_asyncresults,
ms_has_asyncresults, ms_asyncremian, ms_needrequest,
ms_valid_subplans_identified and ms_valid_asyncplans; and instead
added to it new member ms_asyncpending, which doesn't exist in
AppendState.  As for the source file, I modified it based on the new
data struct, reusing some of the code in the original version.
* I adjusted the change made to create_merge_append_plan(), which
makes the original 0001 patch useless, so I removed it from the patch.
* I deduplicated the code in ExecAppendAsyncEventWait() and
ExecMergeAppendAsyncEventWait() as mentioned upthread.  I didn't do so
for other functions/parts, though, because I don't strongly feel the
need for that.  (I didn't include any of the proposed refactoring,
either, for the reason I mentioned upthread.)
* I modified postgresForeignAsyncConfigureWait() a bit further to work
better with async MergeAppend, and rewrote comments there.
* I did some editorialization as well, including renaming/relocating
functions like GetAppendEventSet() in the original version to match
other functions.
* I used the regression tests in the v22 patch as-proposed.  I think
some comments should be updated, but I haven't done that yet.

What do you think about that?  Maybe I'm missing something, though.

Best regards,
Etsuro Fujita

Attachment: v23-MergeAppend-should-support-Async-Foreign-Scan-efujita.patch
Description: Binary data

Reply via email to