Skip to content

Commit 715f44b

Browse files
committed
Fix incomplete backpatch of pg_multixact truncation changes to <= 9.2
The backpatch of a95335b 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, which is 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. Andres Freund
1 parent ff61dd2 commit 715f44b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/backend/access/transam/xlog.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6530,6 +6530,12 @@ StartupXLOG(void)
65306530
XLogCtl->ckptXidEpoch = checkPoint.nextXidEpoch;
65316531
XLogCtl->ckptXid = checkPoint.nextXid;
65326532

6533+
/*
6534+
* Startup MultiXact. We need to do this early because we need its state
6535+
* initialized because we attempt truncation during restartpoints.
6536+
*/
6537+
StartupMultiXact();
6538+
65336539
/*
65346540
* We must replay WAL entries using the same TimeLineID they were created
65356541
* under, so temporarily adopt the TLI indicated by the checkpoint (see
@@ -6696,8 +6702,9 @@ StartupXLOG(void)
66966702
ProcArrayInitRecovery(ShmemVariableCache->nextXid);
66976703

66986704
/*
6699-
* Startup commit log and subtrans only. Other SLRUs are not
6700-
* maintained during recovery and need not be started yet.
6705+
* Startup commit log and subtrans only. MultiXact has already
6706+
* been started up and other SLRUs are not maintained during
6707+
* recovery and need not be started yet.
67016708
*/
67026709
StartupCLOG();
67036710
StartupSUBTRANS(oldestActiveXID);
@@ -7238,7 +7245,7 @@ StartupXLOG(void)
72387245
/*
72397246
* Perform end of recovery actions for any SLRUs that need it.
72407247
*/
7241-
StartupMultiXact();
7248+
TrimMultiXact();
72427249
TrimCLOG();
72437250

72447251
/* Reload shared-memory state for prepared transactions */

src/include/access/multixact.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ extern Size MultiXactShmemSize(void);
5959
extern void MultiXactShmemInit(void);
6060
extern void BootStrapMultiXact(void);
6161
extern void StartupMultiXact(void);
62+
extern void TrimMultiXact(void);
6263
extern void ShutdownMultiXact(void);
6364
extern void MultiXactGetCheckptMulti(bool is_shutdown,
6465
MultiXactId *nextMulti,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy