summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2009-08-07 19:29:49 +0000
committerTom Lane2009-08-07 19:29:49 +0000
commit22fef1891e5db147d5691140f719a2fafd71ca35 (patch)
tree8bfa8140bf5fad9175611dbc4f78e33cbd53e78c
parentc0be0ec213ae428b953ea4e8fa580181887e9ea3 (diff)
rm_cleanup functions need to be allowed to write WAL entries. This oversight
appears to explain the recent reports of "PANIC: cannot make new WAL entries during recovery".
-rw-r--r--src/backend/access/transam/xlog.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index d6a9f202e5..3f5331758a 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -463,6 +463,7 @@ static void readRecoveryCommandFile(void);
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,
@@ -5759,6 +5760,13 @@ StartupXLOG(void)
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++)
@@ -5767,6 +5775,9 @@ StartupXLOG(void)
RmgrTable[rmid].rm_cleanup();
}
+ /* Disallow XLogInsert again */
+ LocalXLogInsertAllowed = -1;
+
/*
* Check to see if the XLOG sequence contained any unresolved
* references to uninitialized pages.