separating use of SerialSLRULock - Mailing list pgsql-hackers

From Alvaro Herrera
Subject separating use of SerialSLRULock
Date
Msg-id 202401291313.qqxzgfnmex7t@alvherre.pgsql
Whole thread Raw
Responses Re: separating use of SerialSLRULock
List pgsql-hackers
Hello

In Dilip's patch to improve SLRU concurrency, there's a requirement to
prevent predicate.c's SLRU control lock from being used to control
access to another shared memory structure, SerialControlData.  This
struct is used to keep track of the areas of the SLRU that are valid.
Dilip just embedded that change into the patch he submitted, but I think
the patch is actually wrong in detail, because it's leaving the
SerialAdd() function unchanged to use SerialSLRULock, which is wrong
because that function depends heavily on the contents of
SerialControlData, and it also modifies it.  So if run concurrently with
the other functions that are using SerialControlLock, the result would
make no sense.

I came up with the attached.  If there are no objections, I'll be
pushing this shortly.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"The Gord often wonders why people threaten never to come back after they've
been told never to return" (www.actsofgord.com)

Attachment

pgsql-hackers by date:

Previous
From: torikoshia
Date:
Subject: Re: RFC: Logging plan of the running query
Next
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: Synchronizing slots from primary to standby