From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Parag Paul <parag(dot)paul(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Issue with the PRNG used by Postgres |
Date: | 2024-04-10 17:15:56 |
Message-ID: | 4085378.1712769356@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Andres Freund <andres(at)anarazel(dot)de> writes:
> Hi,
> On 2024-04-10 12:28:10 -0400, Tom Lane wrote:
>> I don't think it's correct to re-initialize the SpinDelayStatus each
>> time around the outer loop. That state should persist through the
>> entire acquire operation, as it does in a regular spinlock acquire.
>> As this stands, it resets the delay to minimum each time around the
>> outer loop, and I bet it is that behavior not the RNG that's to blame
>> for what he's seeing.
> Hm, yea, that's not right. Normally this shouldn't be heavily contended enough
> to matter. I don't think just pulling out the spin delay would be the right
> thing though, because that'd mean we'd initialize it even in the much much
> more common case of there not being any contention. I think we'll have to add
> a separate fetch_or before the outer loop.
Agreed, and I did that in my draft patch. AFAICS we can also avoid
the LWLOCK_STATS overhead if the initial attempt succeeds, not that
that is something you'd really be worried about.
>> (One should still wonder what is the LWLock usage pattern that is
>> causing this spot to become so heavily contended.)
> My suspicion is that it's a4adc31f690 which we only recently backpatched to
> < 16.
Seems like a plausible theory.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Koval | 2024-04-10 17:22:35 | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Previous Message | Jeff Davis | 2024-04-10 17:14:16 | Re: Improve eviction algorithm in ReorderBuffer |