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

Commit669c7d2

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 parentda11409 commit669c7d2

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
@@ -1970,14 +1970,6 @@ TrimMultiXact(void)
19701970
intentryno;
19711971
intflagsoff;
19721972

1973-
/*
1974-
* During a binary upgrade, make sure that the offsets SLRU is large
1975-
* enough to contain the next value that would be created. It's fine to do
1976-
* this here and not in StartupMultiXact() since binary upgrades should
1977-
* never need crash recovery.
1978-
*/
1979-
if (IsBinaryUpgrade)
1980-
MaybeExtendOffsetSlru();
19811973

19821974
/* Clean up offsets state */
19831975
LWLockAcquire(MultiXactOffsetControlLock,LW_EXCLUSIVE);
@@ -2118,6 +2110,20 @@ MultiXactSetNextMXact(MultiXactId nextMulti,
21182110
MultiXactState->nextMXact=nextMulti;
21192111
MultiXactState->nextOffset=nextMultiOffset;
21202112
LWLockRelease(MultiXactGenLock);
2113+
2114+
/*
2115+
* During a binary upgrade, make sure that the offsets SLRU is large
2116+
* enough to contain the next value that would be created.
2117+
*
2118+
* We need to do this pretty early during the first startup in binary
2119+
* upgrade mode: before StartupMultiXact() in fact, because this routine is
2120+
* called even before that by StartupXLOG(). And we can't do it earlier
2121+
* than at this point, because during that first call of this routine we
2122+
* determine the MultiXactState->nextMXact value that MaybeExtendOffsetSlru
2123+
* needs.
2124+
*/
2125+
if (IsBinaryUpgrade)
2126+
MaybeExtendOffsetSlru();
21212127
}
21222128

21232129
/*
@@ -2513,8 +2519,6 @@ MultiXactOffsetWouldWrap(MultiXactOffset boundary, MultiXactOffset start,
25132519
{
25142520
MultiXactOffsetfinish;
25152521

2516-
Assert(distance >=0);
2517-
25182522
/*
25192523
* Note that offset number 0 is not used (see GetMultiXactIdMembers), so
25202524
* if the addition wraps around the UINT_MAX boundary, skip that value.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp