Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite60581f

Browse files
committed
Fix pg_upgrade's multixact handling (again)
We need to create the pg_multixact/offsets file deleted by pg_upgrademuch earlier than we originally were: it was in TrimMultiXact(), whichruns after we exit recovery, but it actually needs to run earlier thanthe first call to SetMultiXactIdLimit (before recovery), because thatroutine already wants to read the first offset segment.Per pg_upgrade trouble report from Jeff Janes.While at it, silence a compiler warning about a pointless assert that anunsigned variable was being tested non-negative. This was a signedconstant in Thomas Munro's patch which I changed to unsigned beforecommit. Pointed out by Andres Freund.
1 parentcf0d888 commite60581f

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

‎src/backend/access/transam/multixact.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,14 +1989,6 @@ TrimMultiXact(void)
19891989
intentryno;
19901990
intflagsoff;
19911991

1992-
/*
1993-
* During a binary upgrade, make sure that the offsets SLRU is large
1994-
* enough to contain the next value that would be created. It's fine to do
1995-
* this here and not in StartupMultiXact() since binary upgrades should
1996-
* never need crash recovery.
1997-
*/
1998-
if (IsBinaryUpgrade)
1999-
MaybeExtendOffsetSlru();
20001992

20011993
/* Clean up offsets state */
20021994
LWLockAcquire(MultiXactOffsetControlLock,LW_EXCLUSIVE);
@@ -2137,6 +2129,20 @@ MultiXactSetNextMXact(MultiXactId nextMulti,
21372129
MultiXactState->nextMXact=nextMulti;
21382130
MultiXactState->nextOffset=nextMultiOffset;
21392131
LWLockRelease(MultiXactGenLock);
2132+
2133+
/*
2134+
* During a binary upgrade, make sure that the offsets SLRU is large
2135+
* enough to contain the next value that would be created.
2136+
*
2137+
* We need to do this pretty early during the first startup in binary
2138+
* upgrade mode: before StartupMultiXact() in fact, because this routine is
2139+
* called even before that by StartupXLOG(). And we can't do it earlier
2140+
* than at this point, because during that first call of this routine we
2141+
* determine the MultiXactState->nextMXact value that MaybeExtendOffsetSlru
2142+
* needs.
2143+
*/
2144+
if (IsBinaryUpgrade)
2145+
MaybeExtendOffsetSlru();
21402146
}
21412147

21422148
/*
@@ -2532,8 +2538,6 @@ MultiXactOffsetWouldWrap(MultiXactOffset boundary, MultiXactOffset start,
25322538
{
25332539
MultiXactOffsetfinish;
25342540

2535-
Assert(distance >=0);
2536-
25372541
/*
25382542
* Note that offset number 0 is not used (see GetMultiXactIdMembers), so
25392543
* if the addition wraps around the UINT_MAX boundary, skip that value.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp