*** pgsql/src/backend/access/transam/xlog.c 2009/06/26 20:29:04 1.345 --- pgsql/src/backend/access/transam/xlog.c 2009/08/07 19:29:49 1.346 *************** *** 7,13 **** * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * ! * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.344 2009/06/25 21:36:00 heikki Exp $ * *------------------------------------------------------------------------- */ --- 7,13 ---- * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * ! * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.345 2009/06/26 20:29:04 tgl Exp $ * *------------------------------------------------------------------------- */ *************** static void readRecoveryCommandFile(void *** 463,468 **** --- 463,469 ---- static void exitArchiveRecovery(TimeLineID endTLI, uint32 endLogId, uint32 endLogSeg); static bool recoveryStopsHere(XLogRecord *record, bool *includeThis); + static void LocalSetXLogInsertAllowed(void); static void CheckPointGuts(XLogRecPtr checkPointRedo, int flags); static bool XLogCheckBuffer(XLogRecData *rdata, bool doPageWrites, *************** StartupXLOG(void) *** 5759,5764 **** --- 5760,5772 ---- int rmid; /* + * Resource managers might need to write WAL records, eg, to record + * index cleanup actions. So temporarily enable XLogInsertAllowed in + * this process only. + */ + LocalSetXLogInsertAllowed(); + + /* * Allow resource managers to do any required cleanup. */ for (rmid = 0; rmid <= RM_MAX_ID; rmid++) *************** StartupXLOG(void) *** 5767,5772 **** --- 5775,5783 ---- RmgrTable[rmid].rm_cleanup(); } + /* Disallow XLogInsert again */ + LocalXLogInsertAllowed = -1; + /* * Check to see if the XLOG sequence contained any unresolved * references to uninitialized pages.