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 @@ -2511,13 +2511,24 @@ DetermineSafeOldestOffset(MultiXactId oldestMXact)
2511
2511
return ;
2512
2512
2513
2513
/*
2514
- * We determine the safe upper bound for offsets of new xacts by reading
2515
- * the offset of the oldest multixact, 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
+ * Determine the offset of the oldest multixact. Normally, we can read
2515
+ * the offset from 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 .
2519
2519
*/
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
+
2521
2532
/* move back to start of the corresponding segment */
2522
2533
oldestOffset -= oldestOffset %
2523
2534
(MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT );
You can’t perform that action at this time.
0 commit comments