On 2013-11-30 17:06:31 +0100, Andres Freund wrote: > On 2013-11-30 10:57:43 -0500, Tom Lane wrote: > > Alvaro Herrera <alvhe...@2ndquadrant.com> writes: > > > Okay, I have pushed all these patches, including the fixes suggested > > > here and then some. > > > > Not sure exactly which patch caused it, but I'm getting a warning > > in 9.0 through 9.2: > > > > multixact.c:1553: warning: no previous prototype for 'TrimMultiXact' > > Hm. There's been a mistake during the back-patching of that > patch. Likely due to the difference in how multixacts work between 9.2 > and 9.3. > Let me provide a fixup patch.
Attached. I've tested that pg_multixact gets cleaned up on both primary and a HS standby, and that things continue work after failover. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
>From 180189f01e4c433c1ecc7c543673f6130f4d9570 Mon Sep 17 00:00:00 2001 From: Andres Freund <and...@anarazel.de> Date: Sat, 30 Nov 2013 17:19:26 +0100 Subject: [PATCH] Fix incomplete backpatch of the pg_multixact truncation changes to <= 9.2. The backpatch of a95335b544d9c8377e9dc7a399d8e9a155895f82 to 9.2, 9.1 and 9.0 was incomplete, missing changes to xlog.c, primarily the call to TrimMultiXact(). Testing presumably didn't show a problem without these changes because TrimMultiXact() performs defense-in-depth work, that's not strictly necessary. It also missed moving StartupMultiXact() which would have been problematic if a restartpoing happened in exactly the wrong moment, causing a transient error. --- src/backend/access/transam/xlog.c | 13 ++++++++++--- src/include/access/multixact.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8243ea6..190d86b 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6531,6 +6531,12 @@ StartupXLOG(void) XLogCtl->ckptXid = checkPoint.nextXid; /* + * Startup MultiXact. We need to do this early because we need its state + * initialized because we attempt truncation during restartpoints. + */ + StartupMultiXact(); + + /* * We must replay WAL entries using the same TimeLineID they were created * under, so temporarily adopt the TLI indicated by the checkpoint (see * also xlog_redo()). @@ -6696,8 +6702,9 @@ StartupXLOG(void) ProcArrayInitRecovery(ShmemVariableCache->nextXid); /* - * Startup commit log and subtrans only. Other SLRUs are not - * maintained during recovery and need not be started yet. + * Startup commit log and subtrans only. MultiXact has already + * been started up and other SLRUs are not maintained during + * recovery and need not be started yet. */ StartupCLOG(); StartupSUBTRANS(oldestActiveXID); @@ -7238,7 +7245,7 @@ StartupXLOG(void) /* * Perform end of recovery actions for any SLRUs that need it. */ - StartupMultiXact(); + TrimMultiXact(); TrimCLOG(); /* Reload shared-memory state for prepared transactions */ diff --git a/src/include/access/multixact.h b/src/include/access/multixact.h index e20573d..7f46c3e 100644 --- a/src/include/access/multixact.h +++ b/src/include/access/multixact.h @@ -59,6 +59,7 @@ extern Size MultiXactShmemSize(void); extern void MultiXactShmemInit(void); extern void BootStrapMultiXact(void); extern void StartupMultiXact(void); +extern void TrimMultiXact(void); extern void ShutdownMultiXact(void); extern void MultiXactGetCheckptMulti(bool is_shutdown, MultiXactId *nextMulti, -- 1.8.5.rc2.dirty
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers