Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azsmy-0008Jq-Oe for pgsql-admin@arkaria.postgresql.org; Mon, 09 May 2016 21:32:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1azsmy-0005BO-34 for pgsql-admin@arkaria.postgresql.org; Mon, 09 May 2016 21:32:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1azslI-0003HV-BW for pgsql-admin@postgresql.org; Mon, 09 May 2016 21:30:44 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1azsl9-0003jv-Ck for pgsql-admin@postgresql.org; Mon, 09 May 2016 21:30:43 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [216.155.90.98]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 38227400D49; Mon, 9 May 2016 14:30:32 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 4EF5F3A0; Mon, 9 May 2016 18:30:30 -0300 (CLST) Date: Mon, 9 May 2016 18:30:30 -0300 From: Alvaro Herrera To: Tom Lane Cc: =?utf-8?B?T25kxZllaiBTdsSbdGzDrWs=?= , pgsql-admin@postgresql.org Subject: Re: Autovacuum of pg_database Message-ID: <20160509213030.GA496423@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <13485.1462544224@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Tom Lane wrote: > Alvaro Herrera writes: > > These are all shared catalogs. There are others, so you may still see > > more. We got another report for pg_database > > https://www.postgresql.org/message-id/A9D40BB7-CFD6-46AF-A0A1-249F04878A2A%40amazon.com > > so I suppose there really is a bug. I don't know what's going on there. > > I think it's pretty obvious: autovacuum.c's rule for detecting whether > some other worker is already processing table X is wrong when X is a > shared table. I propose the attached patch. Now that I actually tried this, it turned out that this problem is not so simple. vacuum.c already has logic to use conditional acquire of the table-level lock, and if not available it skips the table: LOG: skipping vacuum of "pg_shdepend" --- lock not available so an autovacuum worker is never "stuck" behind another worker trying to vacuum the table. This code is already in 9.2. I suppose the only way for multiple workers to get stuck is the relatively new logic in lazy_truncate_heap that retries multiple times when AEL is not available. I haven't tried to replicate this yet. In other words, the patches proposed here would not fix the actual problem. Back to the drawing board, it seems. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin