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

From Amul Sul
Subject CheckpointLock needed in CreateCheckPoint()?
Date
Msg-id CAAJ_b97XnBBfYeSREDJorFsyoD1sHgqnNuCi=02mNQBUMnA=FA@mail.gmail.com
Whole thread Raw
Responses Re: CheckpointLock needed in CreateCheckPoint()?  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Re: CheckpointLock needed in CreateCheckPoint()?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi ALL,

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.

This CheckpointLock is acquired almost at the start of CreateCheckPoint() and
released at the end. The in-between code can take a while to be complete. All
that time interrupt will be on hold which doesn't seem to be a great idea but
that wasn't problematic until now.  I am having trouble due to this interrupt
hold for a long since I was trying to add code changes where the checkpointer
process is suppose to respond to the system read-write state change request as
soon as possible[1]. That cannot be done if the interrupt is disabled
since read-write state change uses the global barrier mechanism to convey system
state changes to other running processes.

So my question is, can we completely get rid of the CheckpointLock need in
CreateCheckPoint()?

Thoughts/Comments/Suggestions?

Thank you!

Regards,
Amul

1]http://postgr.es/m/CA+TgmoYexwDQjdd1=15KMz+7VfHVx8VHNL2qjRRK92P=CSZDxg@mail.gmail.com



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [PATCH] Runtime control of CLOBBER_CACHE_ALWAYS
Next
From: Craig Ringer
Date:
Subject: Re: [PATCH] Identify LWLocks in tracepoints