@@ -145,14 +145,6 @@ typedef struct MultiXactStateData
145145 MultiXactId oldestMultiXactId ;
146146 Oid oldestMultiXactDB ;
147147
148- /*
149- * Oldest multixact offset that is potentially referenced by a multixact
150- * referenced by a relation. We don't always know this value, so there's
151- * a flag here to indicate whether or not we currently do.
152- */
153- MultiXactOffset oldestOffset ;
154- bool oldestOffsetKnown ;
155-
156148 /* support for anti-wraparound measures */
157149 MultiXactId multiVacLimit ;
158150 MultiXactId multiWarnLimit ;
@@ -2376,10 +2368,7 @@ SetOffsetVacuumLimit(bool is_startup)
23762368 MultiXactId oldestMultiXactId ;
23772369 MultiXactId nextMXact ;
23782370 MultiXactOffset oldestOffset = 0 ; /* placate compiler */
2379- MultiXactOffset prevOldestOffset ;
23802371 MultiXactOffset nextOffset ;
2381- bool oldestOffsetKnown = false;
2382- bool prevOldestOffsetKnown ;
23832372
23842373 /*
23852374 * NB: Have to prevent concurrent truncation, we might otherwise try to
@@ -2392,8 +2381,6 @@ SetOffsetVacuumLimit(bool is_startup)
23922381 oldestMultiXactId = MultiXactState -> oldestMultiXactId ;
23932382 nextMXact = MultiXactState -> nextMXact ;
23942383 nextOffset = MultiXactState -> nextOffset ;
2395- prevOldestOffsetKnown = MultiXactState -> oldestOffsetKnown ;
2396- prevOldestOffset = MultiXactState -> oldestOffset ;
23972384 Assert (MultiXactState -> finishedStartup );
23982385 LWLockRelease (MultiXactGenLock );
23992386
@@ -2411,57 +2398,20 @@ SetOffsetVacuumLimit(bool is_startup)
24112398 * offset.
24122399 */
24132400 oldestOffset = nextOffset ;
2414- oldestOffsetKnown = true;
24152401 }
2416- else
2402+ else if (! find_multixact_start ( oldestMultiXactId , & oldestOffset ))
24172403 {
2418- /*
2419- * Figure out where the oldest existing multixact's offsets are
2420- * stored. Due to bugs in early release of PostgreSQL 9.3.X and 9.4.X,
2421- * the supposedly-earliest multixact might not really exist. We are
2422- * careful not to fail in that case.
2423- */
2424- oldestOffsetKnown =
2425- find_multixact_start (oldestMultiXactId , & oldestOffset );
2426-
2427- if (!oldestOffsetKnown )
2428- ereport (LOG ,
2429- (errmsg ("oldest checkpointed MultiXact %u does not exist on disk" ,
2430- oldestMultiXactId )));
2404+ ereport (LOG ,
2405+ (errmsg ("oldest checkpointed MultiXact %u does not exist on disk" ,
2406+ oldestMultiXactId )));
24312407 }
24322408
24332409 LWLockRelease (MultiXactTruncationLock );
24342410
2435- /*
2436- * If we can, compute limits (and install them MultiXactState) to prevent
2437- * overrun of old data in the members SLRU area. We can only do so if the
2438- * oldest offset is known though.
2439- *
2440- * FIXME: Is !oldestOffsetKnown possible anymore? At least update the comment:
2441- * we won't overrun members anymore.
2442- */
2443- if (prevOldestOffsetKnown )
2444- {
2445- /*
2446- * If we failed to get the oldest offset this time, but we have a
2447- * value from a previous pass through this function, use the old
2448- * values rather than automatically forcing an autovacuum cycle again.
2449- */
2450- oldestOffset = prevOldestOffset ;
2451- oldestOffsetKnown = true;
2452- }
2453-
2454- /* Install the computed values */
2455- LWLockAcquire (MultiXactGenLock , LW_EXCLUSIVE );
2456- MultiXactState -> oldestOffset = oldestOffset ;
2457- MultiXactState -> oldestOffsetKnown = oldestOffsetKnown ;
2458- LWLockRelease (MultiXactGenLock );
2459-
24602411 /*
24612412 * Do we need autovacuum? If we're not sure, assume yes.
24622413 */
2463- return !oldestOffsetKnown ||
2464- (nextOffset - oldestOffset > MULTIXACT_MEMBER_AUTOVAC_THRESHOLD );
2414+ return nextOffset - oldestOffset > MULTIXACT_MEMBER_AUTOVAC_THRESHOLD ;
24652415}
24662416
24672417/*
@@ -2508,47 +2458,6 @@ find_multixact_start(MultiXactId multi, MultiXactOffset *result)
25082458 return true;
25092459}
25102460
2511- /*
2512- * GetMultiXactInfo
2513- *
2514- * Returns information about the current MultiXact state, as of:
2515- * multixacts: Number of MultiXacts (nextMultiXactId - oldestMultiXactId)
2516- * members: Number of member entries (nextOffset - oldestOffset)
2517- * oldestMultiXactId: Oldest MultiXact ID still in use
2518- * oldestOffset: Oldest offset still in use
2519- *
2520- * Returns false if unable to determine, the oldest offset being unknown.
2521- */
2522- bool
2523- GetMultiXactInfo (uint32 * multixacts , MultiXactOffset * members ,
2524- MultiXactId * oldestMultiXactId , MultiXactOffset * oldestOffset )
2525- {
2526- MultiXactOffset nextOffset ;
2527- MultiXactId nextMultiXactId ;
2528- bool oldestOffsetKnown ;
2529-
2530- LWLockAcquire (MultiXactGenLock , LW_SHARED );
2531- nextOffset = MultiXactState -> nextOffset ;
2532- * oldestMultiXactId = MultiXactState -> oldestMultiXactId ;
2533- nextMultiXactId = MultiXactState -> nextMXact ;
2534- * oldestOffset = MultiXactState -> oldestOffset ;
2535- oldestOffsetKnown = MultiXactState -> oldestOffsetKnown ;
2536- LWLockRelease (MultiXactGenLock );
2537-
2538- if (!oldestOffsetKnown )
2539- {
2540- * members = 0 ;
2541- * multixacts = 0 ;
2542- * oldestMultiXactId = InvalidMultiXactId ;
2543- * oldestOffset = 0 ;
2544- return false;
2545- }
2546-
2547- * members = nextOffset - * oldestOffset ;
2548- * multixacts = nextMultiXactId - * oldestMultiXactId ;
2549- return true;
2550- }
2551-
25522461typedef struct mxtruncinfo
25532462{
25542463 int64 earliestExistingPage ;
0 commit comments