@ -7,7 +7,7 @@
* Portions Copyright ( c ) 1996 - 2001 , PostgreSQL Global Development Group
* Portions Copyright ( c ) 1994 , Regents of the University of California
*
* $ Header : / cvsroot / pgsql / src / backend / access / transam / xlog . c , v 1.86 .2 .3 2003 / 01 / 21 19 : 51 : 4 2 tgl Exp $
* $ Header : / cvsroot / pgsql / src / backend / access / transam / xlog . c , v 1.86 .2 .4 2004 / 08 / 11 04 : 09 : 1 2 tgl Exp $
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
@ -2945,6 +2945,15 @@ CreateCheckPoint(bool shutdown, bool force)
checkPoint . ThisStartUpID = ThisStartUpID ;
checkPoint . time = time ( NULL ) ;
/*
* We must hold CheckpointStartLock while determining the checkpoint
* REDO pointer . This ensures that any concurrent transaction commits
* will be either not yet logged , or logged and recorded in pg_clog .
* See notes in RecordTransactionCommit ( ) .
*/
LWLockAcquire ( CheckpointStartLock , LW_EXCLUSIVE ) ;
/* And we need WALInsertLock too */
LWLockAcquire ( WALInsertLock , LW_EXCLUSIVE ) ;
/*
@ -2976,6 +2985,7 @@ CreateCheckPoint(bool shutdown, bool force)
ControlFile - > checkPointCopy . redo . xrecoff )
{
LWLockRelease ( WALInsertLock ) ;
LWLockRelease ( CheckpointStartLock ) ;
LWLockRelease ( CheckpointLock ) ;
END_CRIT_SECTION ( ) ;
return ;
@ -3035,11 +3045,13 @@ CreateCheckPoint(bool shutdown, bool force)
# endif
/*
* Now we can release insert lock , allowing other xacts to proceed
* even while we are flushing disk buffers .
* Now we can release insert lock and checkpoint start lock , allowing
* other xacts to proceed even while we are flushing disk buffers .
*/
LWLockRelease ( WALInsertLock ) ;
LWLockRelease ( CheckpointStartLock ) ;
LWLockAcquire ( XidGenLock , LW_SHARED ) ;
checkPoint . nextXid = ShmemVariableCache - > nextXid ;
LWLockRelease ( XidGenLock ) ;