@@ -220,14 +220,6 @@ typedef struct MultiXactStateData
220
220
MultiXactOffset oldestOffset ;
221
221
bool oldestOffsetKnown ;
222
222
223
- /*
224
- * True if a multixact truncation WAL record was replayed since the last
225
- * checkpoint. This is used to trigger 'legacy truncations', i.e. truncate
226
- * by looking at the data directory during WAL replay, when the primary is
227
- * too old to generate truncation records.
228
- */
229
- bool sawTruncationInCkptCycle ;
230
-
231
223
/* support for anti-wraparound measures */
232
224
MultiXactId multiVacLimit ;
233
225
MultiXactId multiWarnLimit ;
@@ -2381,28 +2373,7 @@ MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB)
2381
2373
Assert (InRecovery );
2382
2374
2383
2375
if (MultiXactIdPrecedes (MultiXactState -> oldestMultiXactId , oldestMulti ))
2384
- {
2385
- /*
2386
- * If there has been a truncation on the master, detected by seeing a
2387
- * moving oldestMulti, without a corresponding truncation record, we
2388
- * know that the primary is still running an older version of postgres
2389
- * that doesn't yet log multixact truncations. So perform the
2390
- * truncation ourselves.
2391
- */
2392
- if (!MultiXactState -> sawTruncationInCkptCycle )
2393
- {
2394
- ereport (LOG ,
2395
- (errmsg ("performing legacy multixact truncation" ),
2396
- errdetail ("Legacy truncations are sometimes performed when replaying WAL from an older primary." ),
2397
- errhint ("Upgrade the primary, it is susceptible to data corruption." )));
2398
- TruncateMultiXact (oldestMulti , oldestMultiDB , true);
2399
- }
2400
-
2401
2376
SetMultiXactIdLimit (oldestMulti , oldestMultiDB );
2402
- }
2403
-
2404
- /* only looked at in the startup process, no lock necessary */
2405
- MultiXactState -> sawTruncationInCkptCycle = false;
2406
2377
}
2407
2378
2408
2379
/*
@@ -2747,8 +2718,7 @@ find_multixact_start(MultiXactId multi, MultiXactOffset *result)
2747
2718
int slotno ;
2748
2719
MultiXactOffset * offptr ;
2749
2720
2750
- /* XXX: Remove || AmStartupProcess() after WAL page magic bump */
2751
- Assert (MultiXactState -> finishedStartup || AmStartupProcess ());
2721
+ Assert (MultiXactState -> finishedStartup );
2752
2722
2753
2723
pageno = MultiXactIdToOffsetPage (multi );
2754
2724
entryno = MultiXactIdToOffsetEntry (multi );
@@ -2946,18 +2916,15 @@ PerformOffsetsTruncation(MultiXactId oldestMulti, MultiXactId newOldestMulti)
2946
2916
* Remove all MultiXactOffset and MultiXactMember segments before the oldest
2947
2917
* ones still of interest.
2948
2918
*
2949
- * On a primary this is called as part of vacuum (via
2950
- * vac_truncate_clog()). During recovery truncation is normally done by
2951
- * replaying truncation WAL records instead of this routine; the exception is
2952
- * when replaying records from an older primary that doesn't yet generate
2953
- * truncation WAL records. In that case truncation is triggered by
2954
- * MultiXactAdvanceOldest().
2919
+ * This is only called on a primary as part of vacuum (via
2920
+ * vac_truncate_clog()). During recovery truncation is done by replaying
2921
+ * truncation WAL records logged here.
2955
2922
*
2956
2923
* newOldestMulti is the oldest currently required multixact, newOldestMultiDB
2957
2924
* is one of the databases preventing newOldestMulti from increasing.
2958
2925
*/
2959
2926
void
2960
- TruncateMultiXact (MultiXactId newOldestMulti , Oid newOldestMultiDB , bool in_recovery )
2927
+ TruncateMultiXact (MultiXactId newOldestMulti , Oid newOldestMultiDB )
2961
2928
{
2962
2929
MultiXactId oldestMulti ;
2963
2930
MultiXactId nextMulti ;
@@ -2967,13 +2934,8 @@ TruncateMultiXact(MultiXactId newOldestMulti, Oid newOldestMultiDB, bool in_reco
2967
2934
mxtruncinfo trunc ;
2968
2935
MultiXactId earliest ;
2969
2936
2970
- /*
2971
- * Need to allow being called in recovery for backwards compatibility,
2972
- * when an updated standby replays WAL generated by a non-updated primary.
2973
- */
2974
- Assert (in_recovery || !RecoveryInProgress ());
2975
- Assert (!in_recovery || AmStartupProcess ());
2976
- Assert (in_recovery || MultiXactState -> finishedStartup );
2937
+ Assert (!RecoveryInProgress ());
2938
+ Assert (MultiXactState -> finishedStartup );
2977
2939
2978
2940
/*
2979
2941
* We can only allow one truncation to happen at once. Otherwise parts of
@@ -3086,22 +3048,15 @@ TruncateMultiXact(MultiXactId newOldestMulti, Oid newOldestMultiDB, bool in_reco
3086
3048
* Prevent checkpoints from being scheduled concurrently. This is critical
3087
3049
* because otherwise a truncation record might not be replayed after a
3088
3050
* crash/basebackup, even though the state of the data directory would
3089
- * require it. It's not possible (startup process doesn't have a PGXACT
3090
- * entry), and not needed, to do this during recovery, when performing an
3091
- * old-style truncation, though. There the entire scheduling depends on
3092
- * the replayed WAL records which be the same after a possible crash.
3051
+ * require it.
3093
3052
*/
3094
- if (!in_recovery )
3095
- {
3096
- Assert (!MyPgXact -> delayChkpt );
3097
- MyPgXact -> delayChkpt = true;
3098
- }
3053
+ Assert (!MyPgXact -> delayChkpt );
3054
+ MyPgXact -> delayChkpt = true;
3099
3055
3100
3056
/* WAL log truncation */
3101
- if (!in_recovery )
3102
- WriteMTruncateXlogRec (newOldestMultiDB ,
3103
- oldestMulti , newOldestMulti ,
3104
- oldestOffset , newOldestOffset );
3057
+ WriteMTruncateXlogRec (newOldestMultiDB ,
3058
+ oldestMulti , newOldestMulti ,
3059
+ oldestOffset , newOldestOffset );
3105
3060
3106
3061
/*
3107
3062
* Update in-memory limits before performing the truncation, while inside
@@ -3122,8 +3077,7 @@ TruncateMultiXact(MultiXactId newOldestMulti, Oid newOldestMultiDB, bool in_reco
3122
3077
/* Then offsets */
3123
3078
PerformOffsetsTruncation (oldestMulti , newOldestMulti );
3124
3079
3125
- if (!in_recovery )
3126
- MyPgXact -> delayChkpt = false;
3080
+ MyPgXact -> delayChkpt = false;
3127
3081
3128
3082
END_CRIT_SECTION ();
3129
3083
LWLockRelease (MultiXactTruncationLock );
@@ -3371,9 +3325,6 @@ multixact_redo(XLogReaderState *record)
3371
3325
PerformOffsetsTruncation (xlrec .startTruncOff , xlrec .endTruncOff );
3372
3326
3373
3327
LWLockRelease (MultiXactTruncationLock );
3374
-
3375
- /* only looked at in the startup process, no lock necessary */
3376
- MultiXactState -> sawTruncationInCkptCycle = true;
3377
3328
}
3378
3329
else
3379
3330
elog (PANIC , "multixact_redo: unknown op code %u" , info );
0 commit comments