Back-patch fix to ensure a checkpoint occurs before truncating CLOG,

even if no recent WAL activity has occurred.
REL7_2_STABLE
Tom Lane 24 years ago
parent a829ad1570
commit c80d09f123
  1. 6
      src/backend/access/transam/clog.c
  2. 10
      src/backend/access/transam/xlog.c
  3. 6
      src/backend/bootstrap/bootstrap.c
  4. 4
      src/backend/tcop/utility.c
  5. 4
      src/include/access/xlog.h

@ -13,7 +13,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/clog.c,v 1.7 2001/10/28 06:25:42 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.7.2.1 2002/09/30 19:55:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -810,8 +810,8 @@ TruncateCLOG(TransactionId oldestXact)
if (!ScanCLOGDirectory(cutoffPage, false))
return; /* nothing to remove */
/* Perform a CHECKPOINT */
CreateCheckPoint(false);
/* Perform a forced CHECKPOINT */
CreateCheckPoint(false, true);
/*
* Scan CLOG shared memory and remove any pages preceding the cutoff

@ -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.1 2002/03/15 19:20:43 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.86.2.2 2002/09/30 19:55:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -2737,7 +2737,7 @@ StartupXLOG(void)
* checkpoint to become prevCheckPoint...
*/
ControlFile->checkPoint = checkPointLoc;
CreateCheckPoint(true);
CreateCheckPoint(true, true);
XLogCloseRelationCache();
}
@ -2894,7 +2894,7 @@ ShutdownXLOG(void)
CritSectionCount++;
CreateDummyCaches();
CreateCheckPoint(true);
CreateCheckPoint(true, true);
ShutdownCLOG();
CritSectionCount--;
@ -2905,7 +2905,7 @@ ShutdownXLOG(void)
* Perform a checkpoint --- either during shutdown, or on-the-fly
*/
void
CreateCheckPoint(bool shutdown)
CreateCheckPoint(bool shutdown, bool force)
{
CheckPoint checkPoint;
XLogRecPtr recptr;
@ -2962,7 +2962,7 @@ CreateCheckPoint(bool shutdown)
* match the end of the last checkpoint record, and its redo pointer
* must point to itself.
*/
if (!shutdown)
if (!shutdown && !force)
{
XLogRecPtr curInsert;

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.120.2.1 2002/03/15 19:20:44 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.120.2.2 2002/09/30 19:55:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -379,7 +379,7 @@ BootstrapMain(int argc, char *argv[])
if (IsUnderPostmaster)
InitDummyProcess(); /* needed to get LWLocks */
CreateDummyCaches();
CreateCheckPoint(false);
CreateCheckPoint(false, false);
SetSavedRedoRecPtr(); /* pass redo ptr back to postmaster */
proc_exit(0); /* done */
@ -433,7 +433,7 @@ BootstrapMain(int argc, char *argv[])
Int_yyparse();
SetProcessingMode(NormalProcessing);
CreateCheckPoint(true);
CreateCheckPoint(true, true);
SetProcessingMode(BootstrapProcessing);
/* clean up processing */

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.125.2.1 2002/02/26 23:48:46 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.125.2.2 2002/09/30 19:55:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -775,7 +775,7 @@ ProcessUtility(Node *parsetree,
{
if (!superuser())
elog(ERROR, "permission denied");
CreateCheckPoint(false);
CreateCheckPoint(false, false);
}
break;

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: xlog.h,v 1.28.2.1 2002/03/15 19:20:47 tgl Exp $
* $Id: xlog.h,v 1.28.2.2 2002/09/30 19:55:08 tgl Exp $
*/
#ifndef XLOG_H
#define XLOG_H
@ -204,7 +204,7 @@ extern void XLOGPathInit(void);
extern void BootStrapXLOG(void);
extern void StartupXLOG(void);
extern void ShutdownXLOG(void);
extern void CreateCheckPoint(bool shutdown);
extern void CreateCheckPoint(bool shutdown, bool force);
extern void SetThisStartUpID(void);
extern void XLogPutNextOid(Oid nextOid);
extern void SetSavedRedoRecPtr(void);

Loading…
Cancel
Save