From: Michael Paquier <michael@paquier.xyz>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: sawada.mshk@gmail.com
Cc: tgl@sss.pgh.pa.us
Cc: alvherre@2ndquadrant.com
Cc: sk@zsrv.org
Cc: nasbyj@amazon.com
Cc: andres@anarazel.de
Cc: robertmhaas@gmail.com
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: pgsql: Improve autovacuum logging for aggressive and anti-wraparound ru
Date: Fri, 29 Mar 2019 20:51:38 +0900
Message-ID: <20190329115138.GD1954@paquier.xyz> (raw)
In-Reply-To: <20190309011537.GD9266@paquier.xyz>
References: <CAD21AoBR+y31ps+=G6_fxxVd_o1itTnaK19sDAEhAP_RyVT2AA@mail.gmail.com>
<20181005031603.GF1629@paquier.xyz>
<20181005063504.GB14664@paquier.xyz>
<20181009.181536.142257785.horiguchi.kyotaro@lab.ntt.co.jp>
<920b7f84-407c-005c-4b7d-e8266a17d22b@2ndQuadrant.com>
<20190309011537.GD9266@paquier.xyz>
On Sat, Mar 09, 2019 at 10:15:37AM +0900, Michael Paquier wrote:
> I am adding an open item about that. I think I could commit the
> patch, but I need to study it a bit more first.
So, coming back to this thread, and studying the problem again, it
looks that the diagnostic that a non-aggressive, anti-wraparound
vacuum could be triggered because the worker sees trouble in the
force because of some activity happening in parallel. Hence, if we
face this case, it looks right to skip the vacuum for this relation.
Attached is an updated patch with a better error message, more
comments, and the removal of the anti-wraparound non-aggressive log
which was added in 28a8fa9. The error message could be better I
guess. Suggestions are welcome.
Thoughts?
--
Michael
Attachments:
[text/x-diff] autovac-antiwrap-skip.patch (1.9K, ../20190329115138.GD1954@paquier.xyz/2-autovac-antiwrap-skip.patch)
download | inline diff:diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.cindex 5c554f9465..82be8c81f3 100644--- a/src/backend/access/heap/vacuumlazy.c+++ b/src/backend/access/heap/vacuumlazy.c@@ -248,6 +248,25 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
if (params->options & VACOPT_DISABLE_PAGE_SKIPPING)
aggressive = true;
+ /*+ * When running an anti-wraparound vacuum, we expect relfrozenxid to be+ * old enough so as aggressive is always set. If this is not the case,+ * it could be possible that another concurrent vacuum process has done+ * the work for this relation so that relfrozenxid in relcache has+ * already been moved forward enough, causing this vacuum run to be+ * non-aggressive. If that happens, note that this relation no longer+ * needs to be vacuumed, so just skip it.+ */+ if (params->is_wraparound && !aggressive)+ {+ ereport(LOG,+ (errmsg_internal("found vacuum to prevent wraparound of table \"%s.%s.%s\" to be not aggressive, so skipping",+ get_database_name(MyDatabaseId),+ get_namespace_name(RelationGetNamespace(onerel)),+ RelationGetRelationName(onerel))));+ return;+ }+
vacrelstats = (LVRelStats *) palloc0(sizeof(LVRelStats));
vacrelstats->old_rel_pages = onerel->rd_rel->relpages;
@@ -375,10 +394,9 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
initStringInfo(&buf);
if (params->is_wraparound)
{
- if (aggressive)- msgfmt = _("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");- else- msgfmt = _("automatic vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");+ /* an anti-wraparound vacuum has to be aggressive */+ Assert(aggressive);+ msgfmt = _("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
}
else
{
[application/pgp-signature] signature.asc (832B, ../20190329115138.GD1954@paquier.xyz/3-signature.asc)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, andrew.dunstan@2ndquadrant.com, horiguchi.kyotaro@lab.ntt.co.jp, sawada.mshk@gmail.com, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, sk@zsrv.org, nasbyj@amazon.com, andres@anarazel.de, robertmhaas@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: pgsql: Improve autovacuum logging for aggressive and anti-wraparound ru
In-Reply-To: <20190329115138.GD1954@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox