From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: bossartn@amazon.com
Cc: michael@paquier.xyz
Cc: andres@anarazel.de
Cc: sulamul@gmail.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: inefficient loop in StandbyReleaseLockList()
Date: Tue, 02 Nov 2021 10:21:48 -0400
Message-ID: <1376384.1635862908@sss.pgh.pa.us> (raw)
In-Reply-To: <20211102.114313.713245704579079227.horikyota.ntt@gmail.com>
References: <1138901.1635782315@sss.pgh.pa.us>
<C84534A6-2E66-47FF-B193-EBB566544D49@amazon.com>
<1311319.1635804078@sss.pgh.pa.us>
<20211102.114313.713245704579079227.horikyota.ntt@gmail.com>
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> At Mon, 01 Nov 2021 18:01:18 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote in
>> So what I did in the attached is add a "canceled" flag to
>> PendingUnlinkEntry, which lets us deal with canceled or finished
>> entries without having to delete them from the list right away.
>> Then we only need to physically clean up the list once per
>> SyncPostCheckpoint call.
> We don't loop over so many canceled elements usually so I think it
> works well. However, shouldn't we consider canceled before checking
> cycle_ctr?
Good point. I was thinking that it's best to break out of the loop
at the first opportunity. But if the first few entries with the next
cycle_ctr value are canceled, it's best to advance over them in the
current SyncPostCheckpoint call. It saves nothing to postpone that
work to later, and indeed adds a few cycles by leaving more data to
be copied by list_delete_first_n. Will change it.
> I feel that we might need to wipe_mem for the memmove case as well
> (together with list_delete_nth_cell) but that is another thing even if
> that's correct.
Hm. I made this function by copying-and-modifying list_delete_nth_cell,
so if there's something wrong there then this code inherited it. But
I don't think it's wrong. The wipe_mem business is only intended to
be used when enabling expensive debug options.
> Otherwise it looks good to me.
Thanks for looking!
regards, tom lane
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: tgl@sss.pgh.pa.us, horikyota.ntt@gmail.com, bossartn@amazon.com, michael@paquier.xyz, andres@anarazel.de, sulamul@gmail.com
Subject: Re: inefficient loop in StandbyReleaseLockList()
In-Reply-To: <1376384.1635862908@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox