77 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
10- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.345 2009/06/26 20 :29:04 tgl Exp $
10+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.346 2009/08/07 19 :29:49 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -463,6 +463,7 @@ static void readRecoveryCommandFile(void);
463463static void exitArchiveRecovery (TimeLineID endTLI ,
464464uint32 endLogId ,uint32 endLogSeg );
465465static bool recoveryStopsHere (XLogRecord * record ,bool * includeThis );
466+ static void LocalSetXLogInsertAllowed (void );
466467static void CheckPointGuts (XLogRecPtr checkPointRedo ,int flags );
467468
468469static bool XLogCheckBuffer (XLogRecData * rdata ,bool doPageWrites ,
@@ -5758,6 +5759,13 @@ StartupXLOG(void)
57585759{
57595760int rmid ;
57605761
5762+ /*
5763+ * Resource managers might need to write WAL records, eg, to record
5764+ * index cleanup actions. So temporarily enable XLogInsertAllowed in
5765+ * this process only.
5766+ */
5767+ LocalSetXLogInsertAllowed ();
5768+
57615769/*
57625770 * Allow resource managers to do any required cleanup.
57635771 */
@@ -5767,6 +5775,9 @@ StartupXLOG(void)
57675775RmgrTable [rmid ].rm_cleanup ();
57685776}
57695777
5778+ /* Disallow XLogInsert again */
5779+ LocalXLogInsertAllowed = -1 ;
5780+
57705781/*
57715782 * Check to see if the XLOG sequence contained any unresolved
57725783 * references to uninitialized pages.