Re: pgsql: Improve performance of subsystems on top of SLRU

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: pgsql: Improve performance of subsystems on top of SLRU
Date: 2024-03-03 21:14:49
Message-ID: 3396247.1709500489@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> And I think it's correct that this is somewhat bogus, or at least
> confusing: the only way to have control back here on line 1371 after
> having executed once is via the "goto retry" line below; and there we
> release "prevlock" and set it to NULL beforehand, so it's impossible for
> prevlock to be NULL. Looking closer I think this code is all confused,
> so I suggest to rework it as shown in the attached patch.

This is certainly simpler, but I notice that it holds the current
LWLock across the line

ptr = (MultiXactMember *) palloc(length * sizeof(MultiXactMember));

where the old code did not. Could the palloc take long enough that
holding the lock is bad?

Also, with this coding the "lock = NULL;" assignment just before
"goto retry" is a dead store. Not sure if Coverity or other static
analyzers would whine about that.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-03-04 00:21:15 pgsql: injection_points: Add wait and wakeup of processes
Previous Message Heikki Linnakangas 2024-03-03 17:39:48 pgsql: Replace BackendIds with 0-based ProcNumbers

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-03-03 21:44:34 Re: Introduce XID age and inactive timeout based replication slot invalidation
Previous Message Tomas Vondra 2024-03-03 20:41:18 Re: Shared detoast Datum proposal