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

Commit24aa77e

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 parent3de791e commit24aa77e

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
@@ -2511,13 +2511,24 @@ DetermineSafeOldestOffset(MultiXactId oldestMXact)
25112511
return;
25122512

25132513
/*
2514-
*We determinethesafe upper bound for offsets of new xacts by reading
2515-
* the offsetof theoldestmultixact, and going back one segment. This
2516-
*way, the sequence of multixact member segments will always have a
2517-
*one-segment hole at a minimum.We start spewing warnings a few
2518-
*complete segments before that.
2514+
*Determinetheoffset of the oldest multixact. Normally, we can read
2515+
* the offsetfrom the multixact itself, but there's an important special
2516+
*case: if there are no multixacts in existence at all, oldestMXact
2517+
*obviously can't point to one.It will instead point to the multixact
2518+
*ID that will be assigned the next time one is needed.
25192519
*/
2520-
oldestOffset=find_multixact_start(oldestMXact);
2520+
LWLockAcquire(MultiXactGenLock,LW_SHARED);
2521+
if (MultiXactState->nextMXact==oldestMXact)
2522+
{
2523+
oldestOffset=MultiXactState->nextOffset;
2524+
LWLockRelease(MultiXactGenLock);
2525+
}
2526+
else
2527+
{
2528+
LWLockRelease(MultiXactGenLock);
2529+
oldestOffset=find_multixact_start(oldestMXact);
2530+
}
2531+
25212532
/* move back to start of the corresponding segment */
25222533
oldestOffset-=oldestOffset %
25232534
(MULTIXACT_MEMBERS_PER_PAGE*SLRU_PAGES_PER_SEGMENT);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp