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.89) (envelope-from ) id 1hjQrB-0006sY-Mc for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jul 2019 16:14:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hjQrA-0006YQ-5w for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jul 2019 16:14:40 +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 1hjQr9-0006V9-PZ for pgsql-bugs@lists.postgresql.org; Fri, 05 Jul 2019 16:14:39 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hjQr6-0006nC-J8 for pgsql-bugs@lists.postgresql.org; Fri, 05 Jul 2019 16:14:38 +0000 Received: by mail-qt1-x844.google.com with SMTP id 44so7781779qtg.11 for ; Fri, 05 Jul 2019 09:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=nYSOmqE5S562xiU6vtypdWdXKI9ZIni4OLcXdJXCFOo=; b=p/6BZEKg8tnA/UBrGTh3aU4ogicCpHxr/vHW9/XMGE7kX0/DUU/l/SiN87X3LH97wz /Pgc4iRFPkeg5px3DrUYROyZJpA0/c9pM8zR73OUeahH8yx66SfhRXBheGkl/66pb9WR /miiNizr6mR/S8fEyMhmYenLcH65g6G1EK2QGXBjg0ZS97J0t4EC4SlWcDrjVp2VHDsT isJfJMhySP2xOMNKuSYg3jsISKy4gKqVmqtEZxRrpUUPSpBDeqcScTdJ3iSXIsB8+aE9 Y0AukSzH3+fz5E+c+TgpxFshC4HiTnc8WpClstGrSX2eVc0XCLCbTH8u8zbuby6GOMPu IYog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nYSOmqE5S562xiU6vtypdWdXKI9ZIni4OLcXdJXCFOo=; b=uTZIaiRGR1j6V3upO0ctNQ8yymdXnkxYn894vKzIY49CzJPxsK2hHCev7eWnesoks9 t3PsP5dJtD7r+i1ff4lA/lGEYFFQkpaHsjNQdzkD6xNW75IKTygxmNM4nxWSQsREBM3E gYZ57803yOp5nQPFCc/XN2l2eQthvNDMRJ2I3HiwCq7u5/3HE9yY40K9bTrrl3ijAL3/ m1A4q3CHXjYJsCAhyqjQTNxfXDE8GyvpNeFZoMgw+IJUDP68bII5pxVp+DjgzPUMwDaA 9PnNh2l5t1jewbOPebnc77wrQjNAGYddRj5dewUikpqzdV64ChZiulcz/g3/KsUtOEIx kYRA== X-Gm-Message-State: APjAAAVLEtcXNhGpn57nn2FWU/IAKhNA3Cs1HmZ/Pn8DGFkmHu9HK5I5 yc9Et9a4AbUflv/E1QPaB+8jaQ== X-Google-Smtp-Source: APXvYqz4UXd0ib935Z0VJFgJOvT9Yc7VQKKniQ7kpTHq23edn75cpMcG+DwMtKLnEz0Ngg6jtd8dXQ== X-Received: by 2002:ac8:7404:: with SMTP id p4mr3414939qtq.181.1562343275906; Fri, 05 Jul 2019 09:14:35 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([179.56.30.174]) by smtp.gmail.com with ESMTPSA id h4sm3952782qkk.39.2019.07.05.09.14.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 05 Jul 2019 09:14:35 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id C9E401206C8; Fri, 5 Jul 2019 12:14:33 -0400 (-04) Date: Fri, 5 Jul 2019 12:14:33 -0400 From: Alvaro Herrera To: Robert Haas Cc: Manuel Rigger , PostgreSQL mailing lists Subject: Re: VACUUM FULL results in deadlock Message-ID: <20190705161433.GA29023@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jul-05, Robert Haas wrote: > On Thu, Jul 4, 2019 at 9:12 AM Manuel Rigger wrote: > > Did anyone try to verify this? I found a number of other race > > conditions where VACUUM causes errors such as "ERROR: found unexpected > > null value in index "i0", "invalid input syntax for type boolean", or > > "missing chunk number 0 for toast value 13171 in pg_toast_2619". > > Fixing this would help me to narrow down these issues. > > I don't know whether or not this is a bug, but my guess is that it > isn't. pg_database and several other system catalogs are shared > relations, which means that they are shared by all databases. So, it's > not too surprising that you could get some interaction between VACUUM > FULL command in different databases. Routine use of VACUUM FULL is > something that should be avoided, so it doesn't seem like a huge > problem to me that you can't run 32 of them at the same time. Actually, in my read of the code, VACUUM FULL is supposed to obtain a InvalidOid-database lock of the relation being vacuumed if it's a shared one, so it seems to me that it should work -- namely that when vacuuming a global table, any other vacuum of that table should be blocked regardless of what database it occurs in. On the other hand, not all the errors that Manuel reports are obviously related to global catalogs. For example, why is it complaining about a missing toast value in pg_statistic's toast table? Do global tables have statistics in specific databases' pg_statistic? How does analyze work sensibly in that case? Maybe that's okay, but still the whole thing should be blocked by the InvalidOid-database-level lock. I agree that you should not be running 32 full vacuums at once, much less in a loop, but if you do, they shouldn't result in weird corruption such as the ones reported. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services