Hello!

On 31.08.2022 21:38, Peter Geoghegan wrote:
On Tue, Aug 30, 2022 at 8:56 PM Nathan Bossart <nathandboss...@gmail.com> wrote:
LGTM

Pushed, thanks.


In this commit 
https://github.com/postgres/postgres/commit/c3ffa731a5f99c4361203015ce2219d209fea94c
there are checks if oldestXmin and oldestMxact havn't become too far in the 
past.
But the corresponding error messages say also some different things about 
'cutoff for freezing tuples',
ie about checks for another variables: freezeLimit and multiXactCutoff.
See: 
https://github.com/postgres/postgres/commit/c3ffa731a5f99c4361203015ce2219d209fea94c?diff=split#diff-795a3938e3bed9884d426bd010670fe505580732df7d7012fad9edeb9df54badR1075
and
https://github.com/postgres/postgres/commit/c3ffa731a5f99c4361203015ce2219d209fea94c?diff=split#diff-795a3938e3bed9884d426bd010670fe505580732df7d7012fad9edeb9df54badR1080

It's interesting that prior to this commit, checks were made for freeze limits, 
but the error messages were talking about oldestXmin and oldestMxact.

Could you clarify this moment please? Would be very grateful.

As variant may be split these checks for the freeze cuttoffs and the oldest 
xmins for clarity?
The patch attached tries to do this.


--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
commit f27ea4e61a7680452b56a7c11b1dcab1c0b81c6b
Author: Anton A. Melnikov <a.melni...@postgrespro.ru>
Date:   Fri Oct 14 11:57:22 2022 +0300

    Split 'too far in the past checks' in vacuum_set_xid_limits().

diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 7ccde07de9..0bbeafba49 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -1072,14 +1072,23 @@ vacuum_set_xid_limits(Relation rel,
 		safeOldestMxact = FirstMultiXactId;
 	if (TransactionIdPrecedes(*oldestXmin, safeOldestXmin))
 		ereport(WARNING,
-				(errmsg("cutoff for removing and freezing tuples is far in the past"),
+				(errmsg("oldest xmin is far in the past"),
 				 errhint("Close open transactions soon to avoid wraparound problems.\n"
 						 "You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
 	if (MultiXactIdPrecedes(*oldestMxact, safeOldestMxact))
 		ereport(WARNING,
-				(errmsg("cutoff for freezing multixacts is far in the past"),
+				(errmsg("oldest multixact is far in the past"),
+				 errhint("Close open transactions with multixacts soon to avoid wraparound problems.\n")));
+
+	if (TransactionIdPrecedes(*freezeLimit, safeOldestXmin))
+		ereport(WARNING,
+				(errmsg("cutoff for freezing tuples is far in the past"),
 				 errhint("Close open transactions soon to avoid wraparound problems.\n"
 						 "You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
+	if (MultiXactIdPrecedes(*multiXactCutoff, safeOldestMxact))
+		ereport(WARNING,
+				(errmsg("cutoff for freezing multixacts is far in the past"),
+				 errhint("Close open transactions with multixacts soon to avoid wraparound problems.\n")));
 
 	/*
 	 * Finally, figure out if caller needs to do an aggressive VACUUM or not.

Reply via email to