From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
Cc: | bossartn(at)amazon(dot)com, michael(at)paquier(dot)xyz, andres(at)anarazel(dot)de, sulamul(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: inefficient loop in StandbyReleaseLockList() |
Date: | 2021-11-02 14:21:48 |
Message-ID: | 1376384.1635862908@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> writes:
> At Mon, 01 Nov 2021 18:01:18 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2021-11-02 14:32:35 | Re: refactoring basebackup.c |
Previous Message | Fujii Masao | 2021-11-02 14:11:39 | Re: pgbench bug candidate: negative "initial connection time" |