8000 Fix incomplete backpatch of pg_multixact truncation changes to <= 9.2 · mpercy/postgres@3d974e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d974e3

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 8269e40 commit 3d974e3

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
@@ -5991,6 +5991,12 @@ StartupXLOG(void)
59915991
XLogCtl->ckptXidEpoch = checkPoint.nextXidEpoch;
59925992
XLogCtl->ckptXid = checkPoint.nextXid;
59935993

5994+
/*
5995+
* Startup MultiXact. We need to do this early because we need its state
5996+
* initialized because we attempt truncation during restartpoints.
5997+
*/
5998+
StartupMultiXact();
5999+
59946000
/*
59956001
* We must replay WAL entries using the same TimeLineID they were created
59966002
* under, so temporarily adopt the TLI indicated by the checkpoint (see
@@ -6121,8 +6127,9 @@ StartupXLOG(void)
61216127
ProcArrayInitRecovery(ShmemVariableCache->nextXid);
61226128

61236129
/*
6124-
* Startup commit log and subtrans only. Other SLRUs are not
6125-
* maintained during recovery and need not be started yet.
6130+
* Startup commit log and subtrans only. MultiXact has already
6131+
* been started up and other SLRUs are not maintained during
6132+
* recovery and need not be started yet.
61266133
*/
61276134
StartupCLOG();
61286135
StartupSUBTRANS(oldestActiveXID);
@@ -6593,7 +6600,7 @@ StartupXLOG(void)
65936600
/*
65946601
* Perform end of recovery actions for any SLRUs that need it.
65956602
*/
6596-
StartupMultiXact();
6603+
TrimMultiXact();
65976604
TrimCLOG();
65986605

65996606
/* 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)
0