Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5ed6fff

Browse files
committed
Make logging about multixact wraparound protection less chatty.
The original messaging design, introduced in commit 068cfad, seems too chatty now that some time has elapsed since the bug fix; most installations will be in good shape and don't really need a reminder about this on every postmaster start. Hence, arrange to suppress the "wraparound protections are now enabled" message during startup (specifically, during the TrimMultiXact() call). The message will still appear if protection becomes effective at some later point. Discussion: https://postgr.es/m/17211.1489189214@sss.pgh.pa.us
1 parent c6c099d commit 5ed6fff

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/backend/access/transam/multixact.c

+13-8
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static void ExtendMultiXactOffset(MultiXactId multi);
363363
static void ExtendMultiXactMember(MultiXactOffset offset, int nmembers);
364364
static bool MultiXactOffsetWouldWrap(MultiXactOffset boundary,
365365
MultiXactOffset start, uint32 distance);
366-
static bool SetOffsetVacuumLimit(void);
366+
static bool SetOffsetVacuumLimit(bool is_startup);
367367
static bool find_multixact_start(MultiXactId multi, MultiXactOffset *result);
368368
static void WriteMZeroPageXlogRec(int pageno, uint8 info);
369369
static void WriteMTruncateXlogRec(Oid oldestMultiDB,
@@ -2095,7 +2095,7 @@ TrimMultiXact(void)
20952095
LWLockRelease(MultiXactGenLock);
20962096

20972097
/* Now compute how far away the next members wraparound is. */
2098-
SetMultiXactIdLimit(oldestMXact, oldestMXactDB);
2098+
SetMultiXactIdLimit(oldestMXact, oldestMXactDB, true);
20992099
}
21002100

21012101
/*
@@ -2186,9 +2186,13 @@ MultiXactSetNextMXact(MultiXactId nextMulti,
21862186
* Determine the last safe MultiXactId to allocate given the currently oldest
21872187
* datminmxid (ie, the oldest MultiXactId that might exist in any database
21882188
* of our cluster), and the OID of the (or a) database with that value.
2189+
*
2190+
* is_startup is true when we are just starting the cluster, false when we
2191+
* are updating state in a running cluster. This only affects log messages.
21892192
*/
21902193
void
2191-
SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
2194+
SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid,
2195+
bool is_startup)
21922196
{
21932197
MultiXactId multiVacLimit;
21942198
MultiXactId multiWarnLimit;
@@ -2277,7 +2281,7 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
22772281
Assert(!InRecovery);
22782282

22792283
/* Set limits for offset vacuum. */
2280-
needs_offset_vacuum = SetOffsetVacuumLimit();
2284+
needs_offset_vacuum = SetOffsetVacuumLimit(is_startup);
22812285

22822286
/*
22832287
* If past the autovacuum force point, immediately signal an autovac
@@ -2370,7 +2374,7 @@ MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB)
23702374
Assert(InRecovery);
23712375

23722376
if (MultiXactIdPrecedes(MultiXactState->oldestMultiXactId, oldestMulti))
2373-
SetMultiXactIdLimit(oldestMulti, oldestMultiDB);
2377+
SetMultiXactIdLimit(oldestMulti, oldestMultiDB, false);
23742378
}
23752379

23762380
/*
@@ -2537,7 +2541,7 @@ GetOldestMultiXactId(void)
25372541
* otherwise.
25382542
*/
25392543
static bool
2540-
SetOffsetVacuumLimit(void)
2544+
SetOffsetVacuumLimit(bool is_startup)
25412545
{
25422546
MultiXactId oldestMultiXactId;
25432547
MultiXactId nextMXact;
@@ -2619,9 +2623,10 @@ SetOffsetVacuumLimit(void)
26192623
/* always leave one segment before the wraparound point */
26202624
offsetStopLimit -= (MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT);
26212625

2622-
if (!prevOldestOffsetKnown && IsUnderPostmaster)
2626+
if (!prevOldestOffsetKnown && !is_startup)
26232627
ereport(LOG,
26242628
(errmsg("MultiXact member wraparound protections are now enabled")));
2629+
26252630
ereport(DEBUG1,
26262631
(errmsg("MultiXact member stop limit is now %u based on MultiXact %u",
26272632
offsetStopLimit, oldestMultiXactId)));
@@ -3312,7 +3317,7 @@ multixact_redo(XLogReaderState *record)
33123317
* Advance the horizon values, so they're current at the end of
33133318
* recovery.
33143319
*/
3315-
SetMultiXactIdLimit(xlrec.endTruncOff, xlrec.oldestMultiDB);
3320+
SetMultiXactIdLimit(xlrec.endTruncOff, xlrec.oldestMultiDB, false);
33163321

33173322
PerformMembersTruncation(xlrec.startTruncMemb, xlrec.endTruncMemb);
33183323

src/backend/access/transam/xlog.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4995,7 +4995,7 @@ BootStrapXLOG(void)
49954995
ShmemVariableCache->oidCount = 0;
49964996
MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset);
49974997
SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB);
4998-
SetMultiXactIdLimit(checkPoint.oldestMulti, checkPoint.oldestMultiDB);
4998+
SetMultiXactIdLimit(checkPoint.oldestMulti, checkPoint.oldestMultiDB, true);
49994999
SetCommitTsLimit(InvalidTransactionId, InvalidTransactionId);
50005000

50015001
/* Set up the XLOG page header */
@@ -6597,7 +6597,7 @@ StartupXLOG(void)
65976597
ShmemVariableCache->oidCount = 0;
65986598
MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset);
65996599
SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB);
6600-
SetMultiXactIdLimit(checkPoint.oldestMulti, checkPoint.oldestMultiDB);
6600+
SetMultiXactIdLimit(checkPoint.oldestMulti, checkPoint.oldestMultiDB, true);
66016601
SetCommitTsLimit(checkPoint.oldestCommitTsXid,
66026602
checkPoint.newestCommitTsXid);
66036603
XLogCtl->ckptXidEpoch = checkPoint.nextXidEpoch;

src/backend/commands/vacuum.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ vac_truncate_clog(TransactionId frozenXID,
12051205
* signalling twice?
12061206
*/
12071207
SetTransactionIdLimit(frozenXID, oldestxid_datoid);
1208-
SetMultiXactIdLimit(minMulti, minmulti_datoid);
1208+
SetMultiXactIdLimit(minMulti, minmulti_datoid, false);
12091209
}
12101210

12111211

src/include/access/multixact.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ extern void StartupMultiXact(void);
127127
extern void TrimMultiXact(void);
128128
extern void ShutdownMultiXact(void);
129129
extern void SetMultiXactIdLimit(MultiXactId oldest_datminmxid,
130-
Oid oldest_datoid);
130+
Oid oldest_datoid,
131+
bool is_startup);
131132
extern void MultiXactGetCheckptMulti(bool is_shutdown,
132133
MultiXactId *nextMulti,
133134
MultiXactOffset *nextMultiOffset,

0 commit comments

Comments
 (0)