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

Commit312747c

Browse files
committed
Fix DetermineSafeOldestOffset for the case where there are no mxacts.
Commitb69bf30 failed to take intoaccount the possibility that there might be no multixacts in existenceat all.Report by Thomas Munro; patch by me.
1 parent1a8a4e5 commit312747c

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,13 +2492,24 @@ DetermineSafeOldestOffset(MultiXactId oldestMXact)
24922492
return;
24932493

24942494
/*
2495-
*We determinethesafe upper bound for offsets of new xacts by reading
2496-
* the offsetof theoldestmultixact, and going back one segment. This
2497-
*way, the sequence of multixact member segments will always have a
2498-
*one-segment hole at a minimum.We start spewing warnings a few
2499-
*complete segments before that.
2495+
*Determinetheoffset of the oldest multixact. Normally, we can read
2496+
* the offsetfrom the multixact itself, but there's an important special
2497+
*case: if there are no multixacts in existence at all, oldestMXact
2498+
*obviously can't point to one.It will instead point to the multixact
2499+
*ID that will be assigned the next time one is needed.
25002500
*/
2501-
oldestOffset=find_multixact_start(oldestMXact);
2501+
LWLockAcquire(MultiXactGenLock,LW_SHARED);
2502+
if (MultiXactState->nextMXact==oldestMXact)
2503+
{
2504+
oldestOffset=MultiXactState->nextOffset;
2505+
LWLockRelease(MultiXactGenLock);
2506+
}
2507+
else
2508+
{
2509+
LWLockRelease(MultiXactGenLock);
2510+
oldestOffset=find_multixact_start(oldestMXact);
2511+
}
2512+
25022513
/* move back to start of the corresponding segment */
25032514
oldestOffset-=oldestOffset %
25042515
(MULTIXACT_MEMBERS_PER_PAGE*SLRU_PAGES_PER_SEGMENT);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp