Re: CheckpointLock needed in CreateCheckPoint()?

Dilip Kumar <dilipbalaut@gmail.com>

From: Dilip Kumar <dilipbalaut@gmail.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Amul Sul <sulamul@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-01-07T07:49:32Z
Lists: pgsql-hackers
On Thu, Jan 7, 2021 at 12:45 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Thu, Jan 7, 2021 at 11:32 AM Amul Sul <sulamul@gmail.com> wrote:
> > Snip from CreateCheckPoint():
> > --
> > /*
> >  * Acquire CheckpointLock to ensure only one checkpoint happens at a time.
> >  * (This is just pro forma, since in the present system structure there is
> >  * only one process that is allowed to issue checkpoints at any given
> >  * time.)
> >  */
> > LWLockAcquire(CheckpointLock, LW_EXCLUSIVE);
> > --
> >
> > 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.
>
> Looks like CheckpointLock() can also be called in standalone backends
> (RequestCheckpoint->CreateCheckPoint) along with the checkpointer
> process. Having said that, I'm not quite sure whether it can get
> called at the same time from a backend(may be with checkpoint;
> command) and the checkpointer process.

If it is a standalone backend then there will be no postmaster and no
other process i.e. no checkpoint process also.


-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



Commits

  1. Remove CheckpointLock.

  2. Separate out bgwriter code into a logically separate module, rather