@@ -401,8 +401,6 @@ static void mXactCachePut(MultiXactId multi, int nmembers,
401401static char * mxstatus_to_string (MultiXactStatus status );
402402
403403/* management of SLRU infrastructure */
404- static int ZeroMultiXactOffsetPage (int64 pageno , bool writeXlog );
405- static int ZeroMultiXactMemberPage (int64 pageno , bool writeXlog );
406404static bool MultiXactOffsetPagePrecedes (int64 page1 , int64 page2 );
407405static bool MultiXactMemberPagePrecedes (int64 page1 , int64 page2 );
408406static bool MultiXactOffsetPrecedes (MultiXactOffset offset1 ,
@@ -413,7 +411,6 @@ static bool MultiXactOffsetWouldWrap(MultiXactOffset boundary,
413411 MultiXactOffset start , uint32 distance );
414412static bool SetOffsetVacuumLimit (bool is_startup );
415413static bool find_multixact_start (MultiXactId multi , MultiXactOffset * result );
416- static void WriteMZeroPageXlogRec (int64 pageno , uint8 info );
417414static void WriteMTruncateXlogRec (Oid oldestMultiDB ,
418415 MultiXactId startTruncOff ,
419416 MultiXactId endTruncOff ,
@@ -2033,70 +2030,11 @@ check_multixact_member_buffers(int *newval, void **extra, GucSource source)
20332030void
20342031BootStrapMultiXact (void )
20352032{
2036- int slotno ;
2037- LWLock * lock ;
2038-
2039- lock = SimpleLruGetBankLock (MultiXactOffsetCtl , 0 );
2040- LWLockAcquire (lock , LW_EXCLUSIVE );
2041-
2042- /* Create and zero the first page of the offsets log */
2043- slotno = ZeroMultiXactOffsetPage (0 , false);
2044-
2045- /* Make sure it's written out */
2046- SimpleLruWritePage (MultiXactOffsetCtl , slotno );
2047- Assert (!MultiXactOffsetCtl -> shared -> page_dirty [slotno ]);
2048-
2049- LWLockRelease (lock );
2050-
2051- lock = SimpleLruGetBankLock (MultiXactMemberCtl , 0 );
2052- LWLockAcquire (lock , LW_EXCLUSIVE );
2053-
2054- /* Create and zero the first page of the members log */
2055- slotno = ZeroMultiXactMemberPage (0 , false);
2056-
2057- /* Make sure it's written out */
2058- SimpleLruWritePage (MultiXactMemberCtl , slotno );
2059- Assert (!MultiXactMemberCtl -> shared -> page_dirty [slotno ]);
2060-
2061- LWLockRelease (lock );
2062- }
2063-
2064- /*
2065- * Initialize (or reinitialize) a page of MultiXactOffset to zeroes.
2066- * If writeXlog is true, also emit an XLOG record saying we did this.
2067- *
2068- * The page is not actually written, just set up in shared memory.
2069- * The slot number of the new page is returned.
2070- *
2071- * Control lock must be held at entry, and will be held at exit.
2072- */
2073- static int
2074- ZeroMultiXactOffsetPage (int64 pageno , bool writeXlog )
2075- {
2076- int slotno ;
2077-
2078- slotno = SimpleLruZeroPage (MultiXactOffsetCtl , pageno );
2079-
2080- if (writeXlog )
2081- WriteMZeroPageXlogRec (pageno , XLOG_MULTIXACT_ZERO_OFF_PAGE );
2082-
2083- return slotno ;
2084- }
2085-
2086- /*
2087- * Ditto, for MultiXactMember
2088- */
2089- static int
2090- ZeroMultiXactMemberPage (int64 pageno , bool writeXlog )
2091- {
2092- int slotno ;
2093-
2094- slotno = SimpleLruZeroPage (MultiXactMemberCtl , pageno );
2095-
2096- if (writeXlog )
2097- WriteMZeroPageXlogRec (pageno , XLOG_MULTIXACT_ZERO_MEM_PAGE );
2098-
2099- return slotno ;
2033+ /*
2034+ * Nullify the page (pageno = 0), save the page on a disk
2035+ */
2036+ SimpleLruZeroPageExt (MultiXactOffsetCtl , 0 );
2037+ SimpleLruZeroPageExt (MultiXactMemberCtl , 0 );
21002038}
21012039
21022040/*
@@ -2134,7 +2072,7 @@ MaybeExtendOffsetSlru(void)
21342072 * with creating a new segment file even if the page we're writing is
21352073 * not the first in it, so this is enough.
21362074 */
2137- slotno = ZeroMultiXactOffsetPage ( pageno , false );
2075+ slotno = SimpleLruZeroPage ( MultiXactOffsetCtl , pageno );
21382076 SimpleLruWritePage (MultiXactOffsetCtl , slotno );
21392077 }
21402078
@@ -2569,7 +2507,8 @@ ExtendMultiXactOffset(MultiXactId multi)
25692507 LWLockAcquire (lock , LW_EXCLUSIVE );
25702508
25712509 /* Zero the page and make an XLOG entry about it */
2572- ZeroMultiXactOffsetPage (pageno , true);
2510+ SimpleLruZeroPage (MultiXactOffsetCtl , pageno );
2511+ XLogSimpleInsert (RM_MULTIXACT_ID , XLOG_MULTIXACT_ZERO_OFF_PAGE , pageno );
25732512
25742513 LWLockRelease (lock );
25752514}
@@ -2612,7 +2551,8 @@ ExtendMultiXactMember(MultiXactOffset offset, int nmembers)
26122551 LWLockAcquire (lock , LW_EXCLUSIVE );
26132552
26142553 /* Zero the page and make an XLOG entry about it */
2615- ZeroMultiXactMemberPage (pageno , true);
2554+ SimpleLruZeroPage (MultiXactMemberCtl , pageno );
2555+ XLogSimpleInsert (RM_MULTIXACT_ID , XLOG_MULTIXACT_ZERO_MEM_PAGE , pageno );
26162556
26172557 LWLockRelease (lock );
26182558 }
@@ -3347,18 +3287,6 @@ MultiXactOffsetPrecedes(MultiXactOffset offset1, MultiXactOffset offset2)
33473287 return (diff < 0 );
33483288}
33493289
3350- /*
3351- * Write an xlog record reflecting the zeroing of either a MEMBERs or
3352- * OFFSETs page (info shows which)
3353- */
3354- static void
3355- WriteMZeroPageXlogRec (int64 pageno , uint8 info )
3356- {
3357- XLogBeginInsert ();
3358- XLogRegisterData (& pageno , sizeof (pageno ));
3359- (void ) XLogInsert (RM_MULTIXACT_ID , info );
3360- }
3361-
33623290/*
33633291 * Write a TRUNCATE xlog record
33643292 *
@@ -3401,36 +3329,16 @@ multixact_redo(XLogReaderState *record)
34013329 if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE )
34023330 {
34033331 int64 pageno ;
3404- int slotno ;
3405- LWLock * lock ;
3406-
34073332 memcpy (& pageno , XLogRecGetData (record ), sizeof (pageno ));
3408-
3409- lock = SimpleLruGetBankLock (MultiXactOffsetCtl , pageno );
3410- LWLockAcquire (lock , LW_EXCLUSIVE );
3411-
3412- slotno = ZeroMultiXactOffsetPage (pageno , false);
3413- SimpleLruWritePage (MultiXactOffsetCtl , slotno );
3414- Assert (!MultiXactOffsetCtl -> shared -> page_dirty [slotno ]);
3415-
3416- LWLockRelease (lock );
3333+ /* Zero the page, write the page on a disk */
3334+ SimpleLruZeroPageExt (MultiXactOffsetCtl , pageno );
34173335 }
34183336 else if (info == XLOG_MULTIXACT_ZERO_MEM_PAGE )
34193337 {
34203338 int64 pageno ;
3421- int slotno ;
3422- LWLock * lock ;
3423-
34243339 memcpy (& pageno , XLogRecGetData (record ), sizeof (pageno ));
3425-
3426- lock = SimpleLruGetBankLock (MultiXactMemberCtl , pageno );
3427- LWLockAcquire (lock , LW_EXCLUSIVE );
3428-
3429- slotno = ZeroMultiXactMemberPage (pageno , false);
3430- SimpleLruWritePage (MultiXactMemberCtl , slotno );
3431- Assert (!MultiXactMemberCtl -> shared -> page_dirty [slotno ]);
3432-
3433- LWLockRelease (lock );
3340+ /* Zero the page, write the page on a disk */
3341+ SimpleLruZeroPageExt (MultiXactMemberCtl , pageno );
34343342 }
34353343 else if (info == XLOG_MULTIXACT_CREATE_ID )
34363344 {
0 commit comments