Re: CheckpointLock needed in CreateCheckPoint()? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: CheckpointLock needed in CreateCheckPoint()?
Date
Msg-id CA+Tgmoa6FC017FML3vJW7cR__03Ay3zcO=kSwXykxFaWYkbf1A@mail.gmail.com
Whole thread Raw
In response to CheckpointLock needed in CreateCheckPoint()?  (Amul Sul <sulamul@gmail.com>)
Responses Re: CheckpointLock needed in CreateCheckPoint()?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Thu, Jan 7, 2021 at 1:02 AM Amul Sul <sulamul@gmail.com> wrote:
> As per this comment, it seems to be that we don't really need this LW lock. We
> could have something else instead if we are afraid of having multiple
> checkpoints at any given time which isn't possible, btw.

Yeah, I think this lock is useless. In fact, I think it's harmful,
because it makes large sections of the checkpointer code, basically
all of it really, run with interrupts held off for no reason.

It's not impossible that removing the lock could reveal bugs
elsewhere: suppose we have segments of code that actually aren't safe
to interrupt, but because of this LWLock, it never happens. But, if
that happens to be true, I think we should just view those cases as
bugs to be fixed.

One thing that blunts the impact of this quite a bit is that the
checkpointer doesn't use rely much on CHECK_FOR_INTERRUPTS() in the
first place. It has its own machinery: HandleCheckpointerInterrupts().
Possibly that's something we should be looking to refactor somehow as
well.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: outdated references to replication timeout
Next
From: Tom Lane
Date:
Subject: Re: pg_preadv() and pg_pwritev()