File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
src/backend/access/transam Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -2492,13 +2492,24 @@ DetermineSafeOldestOffset(MultiXactId oldestMXact)
24922492 return ;
24932493
24942494 /*
2495- * We determine the safe upper bound for offsets of new xacts by reading
2496- * the offset of the oldest multixact, 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+ * Determine the offset of the oldest multixact. Normally, we can read
2496+ * the offset from 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 );
You can’t perform that action at this time.
0 commit comments