Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jGYZu-0005WD-8i for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2020 01:42:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGYZq-0006xp-BR for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2020 01:41:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGYZp-0006vT-8F for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2020 01:41:58 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGYZl-0006zr-Tj for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2020 01:41:55 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id B6C0B5C01D2; Mon, 23 Mar 2020 21:41:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 23 Mar 2020 21:41:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=Rh17IBkfW5VuAFu33NsP+879r6k ybsyyrQ1VhsLvn6k=; b=CCemRdJj0ySVcxRXr8NSgscWMxPfP4MbV645ksVy1he TxNdmiTlYHdV1u3jHLhWNrvVSCeCtPgwSXCWwMmIC/2T0zANoGtmgulRYdBRNUBZ KuqQIxulBh7rKe/QQ0t9cW+uE58CFpQl3ipYRTx/mnRkw7Eqxkos7MaDfguLbdyY 2opCUSWg2vViQJBEaFFtKD4T94v9Z0vBNkdW0CliGE4EAMRTa4AzKQ1pj35e9Rsq bWe+MYNzPWsn8eM7jcewMnt7+EJrcWg6AKfbCZ8XnxSPgzWdbyIlbe/GPcweZ5YH UTN35zFfnmXMF6saDYG+pSZxMnSWDZN8PDS3FHOq3vg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Rh17IB kfW5VuAFu33NsP+879r6kybsyyrQ1VhsLvn6k=; b=dcDij7T8iTZCJtAXj9cIOJ 6P7IbgXtBfkPmzJIfZZ1ZCeBCWpfcf3e5oI7Hf67KyCZoyVSkLh3imADhbHqOjRf 1dl9NULh3qXsOlLp9t3GERB8WxKDntJdGb1DZDkkfeZMScdoBUkf234UuiwExbDA n/xs3ru1MsL0tsQIpt20h2y5Bm2s+dmOI/3QGckuH8rugQgLEEZ7y0v9NFCC4iXH zBZA3TjwDQgjdrAE9UXpfZHX2qDMSWJoEnF42iwzjgYEZGtbInCTjQ3YFjI3/W6Q MKVpW5QLhkPaNphDY3ws90yMUWqgtSmrowDQWLLTCOVQs1WRbIYCMNZEUWGa2xpA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudegledgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucfkphepie ejrdduiedtrddvudejrddvhedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id 577FA30624E4; Mon, 23 Mar 2020 21:41:51 -0400 (EDT) Date: Mon, 23 Mar 2020 18:41:50 -0700 From: Andres Freund To: Michael Paquier Cc: Andrew Dunstan , Kyotaro HORIGUCHI , sawada.mshk@gmail.com, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, sk@zsrv.org, nasbyj@amazon.com, robertmhaas@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Improve autovacuum logging for aggressive and anti-wraparound ru Message-ID: <20200324014150.2nyuygbbejzaybip@alap3.anarazel.de> References: <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> <20190329115138.GD1954@paquier.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190329115138.GD1954@paquier.xyz> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-03-29 20:51:38 +0900, Michael Paquier wrote: > 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. > diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c > index 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; > + } > + Which valid scenario can lead to this? Neither the comment, nor commit message explain it. Unless you're thinking of scenarios where autovacuum and manual vacuum are mixed, I don't really see valid reasons? Normally autovacuum's locking + the table_recheck_autovac() check should prevent problematic scenarios. I do see a few scenarios that can trigger this - but they all more or less are bugs. It doesn't strike me as a good idea to work around such bugs by silently neutering heap_vacuum_rel(). The likelihood of that temporarily covering up more severe problems seems significant - they're likely to then later bite you with a cluster shutdown. Greetings, Andres Freund