pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Sergei Kornilov <sk@zsrv.org>
Cc: nasbyj@amazon.com, Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: pgsql: Improve autovacuum logging for aggressive and anti-wraparound ru
Date: Wed, 3 Oct 2018 16:37:29 +0900
Message-ID: <CAD21AoBR+y31ps+=G6_fxxVd_o1itTnaK19sDAEhAP_RyVT2AA@mail.gmail.com> (raw)
In-Reply-To: <338.1538489728@sss.pgh.pa.us>
References: <23209391537822541@iva4-6d7004ac8463.qloud-c.yandex.net>
	<20180924211117.tpwxemzd3372nagj@alvherre.pgsql>
	<CAD21AoAV17jQH6__E8_VQePms4NptX0X50U=98qJ5RNV7au1iw@mail.gmail.com>
	<20181002001151.GP11712@paquier.xyz>
	<CAD21AoB-nhVxo=6__BeukNniHnt6UGMKRs3v=Zkn-WJq9kx+4A@mail.gmail.com>
	<20181002065508.GC17642@paquier.xyz>
	<338.1538489728@sss.pgh.pa.us>

On Tue, Oct 2, 2018 at 11:15 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Michael Paquier <michael@paquier.xyz> writes:
> > My brain is rather fried for the rest of the day...  But we could just
> > be looking at using USE_ASSERT_CHECKING.  Thoughts from other are
> > welcome.
>
> I'd go with folding the condition into a plain Assert.  Then it's
> obvious that no code is added in a non-assert build.  I can see that
> some cases might be so complicated that that isn't nice, but this
> case doesn't seem to qualify.
>

Thank you for the comment. Attached the updated patch.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachments:

  [application/octet-stream] fix_autovacuum_log_v2.patch (1.2K, ../CAD21AoBR+y31ps+=G6_fxxVd_o1itTnaK19sDAEhAP_RyVT2AA@mail.gmail.com/2-fix_autovacuum_log_v2.patch)
  download | inline diff:
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 8996d36..769fd0e 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -249,6 +249,10 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
 	if (options & VACOPT_DISABLE_PAGE_SKIPPING)
 		aggressive = true;
 
+	/* Sanity check: an anti-wraparound vacuum must be an aggressive vacuum */
+	if (params->is_wraparound)
+		Assert(aggressive);
+
 	vacrelstats = (LVRelStats *) palloc0(sizeof(LVRelStats));
 
 	vacrelstats->old_rel_pages = onerel->rd_rel->relpages;
@@ -376,10 +380,8 @@ lazy_vacuum_rel(Relation onerel, int options, 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");
+				/* autovacuum cannot be anti-wraparound and not aggressive vacuum */
+				msgfmt = _("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
 			}
 			else
 			{


view thread (34+ messages)  latest in thread

Message-ID: <CAD21AoBR+y31ps+=G6_fxxVd_o1itTnaK19sDAEhAP_RyVT2AA@mail.gmail.com>
Permalink:  ../CAD21AoBR+y31ps+=G6_fxxVd_o1itTnaK19sDAEhAP_RyVT2AA@mail.gmail.com/
Also on:    postgresql.org/message-id/CAD21AoBR+y31ps+=G6_fxxVd_o1itTnaK19sDAEhAP_RyVT2AA@mail.gmail.com

 ·  · 

reply

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: sawada.mshk@gmail.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, alvherre@2ndquadrant.com, sk@zsrv.org, 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: <CAD21AoBR+y31ps+=G6_fxxVd_o1itTnaK19sDAEhAP_RyVT2AA@mail.gmail.com>

* 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