agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
To: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Matheus Alcantara <matheusssilv97@gmail.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Asynchronous MergeAppend
Date: Tue, 04 Aug 2026 16:32:22 +0300
Message-ID: <f207ff5cb0d48e0cc58da679095c5e04@postgrespro.ru> (raw)
In-Reply-To: <CAPmGK14i=ss35hmf5bVM1BAS=prc8QM_nwg5rzjrjUvYE1R4Zw@mail.gmail.com>
References: <59be194c5a409fb9fc9f2031581b8a44@postgrespro.ru>
	<2fb1d9923b6995492e7b163e6cb95402@postgrespro.ru>
	<DE662JHGRO2O.3KJBBG2R3IT17@gmail.com>
	<efbfbcf00b6b790e8f80c13a83417a23@postgrespro.ru>
	<CAFY6G8d3Yvxa_kRQA24BsJhwqfmSCv1ujiv_7b6g5isf-ZTs_Q@mail.gmail.com>
	<b546d8bd5e2218f4f917fda4c93ead21@postgrespro.ru>
	<DED05POJZS2W.2EZ60AOBMDDAE@gmail.com>
	<bcdefce7e3db9566d0619ad2eed2a299@postgrespro.ru>
	<DF0RCOYB19RC.35BW2FHPO4N4S@gmail.com>
	<a16423ca928cde3650bbc219982a5ffc@postgrespro.ru>
	<DF28LV8UTUOO.71JUZDH1N8F9@gmail.com>
	<d5c0bfca6ee15d62df1ba72e540b4ddf@postgrespro.ru>
	<DFAQTF8P9AU0.2ZELZFXOCD0XL@gmail.com>
	<c264abe661f72d6627f987fc9aa4e456@postgrespro.ru>
	<DFBN6K9K9IUG.23WZ7OBL8DRAQ@gmail.com>
	<c0d55d3f68bfd5650fe3143d3a31c84c@postgrespro.ru>
	<782a968c8e01ec6db3b2da2120adf73b@postgrespro.ru>
	<554a73f7ffea8b22b3f81a4804b5fc34@postgrespro.ru>
	<e13717179328abed3e189f4ca1e63087@postgrespro.ru>
	<CAPpHfdu+3Eud0CBpdFT+osWiT=e=zOQUtBsx8Z5okKrqhgVAJg@mail.gmail.com>
	<42a9a941-e768-4fd8-8067-12958c5a1d70@gmail.com>
	<CAPpHfdsO8zYpDW==D6T5N0cJ+AzK7a_OyXJoYU1kFi=xZFTLuQ@mail.gmail.com>
	<DHMH23M7UOFS.12W6PUDI1I3NH@gmail.com>
	<CAPpHfdssDymMVohXw5XwdPoJ9UvSv1iN2zRcmsEhhfXXks01Zg@mail.gmail.com>
	<10c97af0ce34ebdb81708b1c49ed6038@postgrespro.ru>
	<fa7ae004ec282fde84c29f36e0c85979@postgrespro.ru>
	<CAPpHfdtNOvgKfUFLY84dLtT=m17d=976duxUvvhYGHkLhN8GAw@mail.gmail.com>
	<af6f5a17e291169f5929744acc8ddd3d@postgrespro.ru>
	<CAPpHfdsAL9oXrSP25c1XYS-ew0doUST=FU3LWj6aEG0iDw2rSA@mail.gmail.com>
	<e8d502937d94eb6bd18e38ff1f240a05@postgrespro.ru>
	<CAPmGK14i=ss35hmf5bVM1BAS=prc8QM_nwg5rzjrjUvYE1R4Zw@mail.gmail.com>

Etsuro Fujita писал(а) 2026-08-03 17:13:
> On Mon, Aug 3, 2026 at 3:41 PM Alexander Pyhalov
> <a.pyhalov@postgrespro.ru> wrote:
>> Alexander Korotkov писал(а) 2026-08-01 00:03:
>> > On Mon, Jul 6, 2026 at 4:42 PM Alexander Pyhalov
>> > <a.pyhalov@postgrespro.ru> wrote:
>> >> Alexander Korotkov писал(а) 2026-07-04 02:05:
>> >>
>> >> > While discovering a correctness of callback_pending flag reset in
>> >> > async MergeAppend, I found bug in async plain Append [1].  I've
>> >> > included the fix as 0001 in the current patchset.
>> >>
>> >> I expect that this issue can affect both MergeAppend and Append, but
>> >> current test cases don't confirm this.
>> >> If we revert to the old behavior  (setting areq->callback_pending to
>> >> false), the tests results of Merge Append tests
>> >> are not changed.
>> >
>> > Did you try the test case showed by Gleb [1].  Yet I think it's safe
>> > to follow the fix by Etsuro.  In the revised patchset I put this into
>> > ExecAppendBaseAsyncProcessPending() and use for both async append and
>> > async merge append.
>> 
>> Yes, he found this case when we tested your original fix for
>> ExecReScanAppend() behavior.
>> I'm fine with following  Etsuro's fix.
> 
> Sorry, I renamed that function.
> 
> I haven't looked at the patches yet, sorry, so I'm missing something,
> but do we really need the same treatment here?  IMU: what async should
> be made for in MergeAppend would be only the initialization step that
> that node fetches one tuple from every child to seed the heap; other
> steps should be processed rather synchronously, to reduce the overhead
> by async.  So no pending async requests in ExecReScanMergeAppend.  No?
> 

Hi. This seems to be true. On the first call to ExecMergeAppend, 
ExecMergeAppendAsyncGetNext() would get tuples from all valid 
asyncplans,
and so there would be no requests with callback_pending set to true. 
Subsequent ExecMergeAppendGetNextSlot() also waits for results, so 
callback_pending should be also false.

-- 
Best regards,
Alexander Pyhalov,
Postgres Professional






view thread (46+ messages)  latest in thread

Message-ID: <f207ff5cb0d48e0cc58da679095c5e04@postgrespro.ru>
Permalink:  ../f207ff5cb0d48e0cc58da679095c5e04@postgrespro.ru/
Also on:    postgresql.org/message-id/f207ff5cb0d48e0cc58da679095c5e04@postgrespro.ru

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: a.pyhalov@postgrespro.ru, etsuro.fujita@gmail.com, aekorotkov@gmail.com, matheusssilv97@gmail.com
  Subject: Re: Asynchronous MergeAppend
  In-Reply-To: <f207ff5cb0d48e0cc58da679095c5e04@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox