pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Manuel Rigger <rigger.manuel@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: VACUUM FULL results in deadlock
Date: Fri, 5 Jul 2019 12:14:33 -0400
Message-ID: <20190705161433.GA29023@alvherre.pgsql> (raw)
In-Reply-To: <CA+TgmoY9dLt1t5s0UmbxcHCS5cXTb4UChNocdBtsBRWDTGbP-w@mail.gmail.com>

On 2019-Jul-05, Robert Haas wrote:

> On Thu, Jul 4, 2019 at 9:12 AM Manuel Rigger <rigger.manuel@gmail.com> 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





view thread (10+ messages)  latest in thread

Message-ID: <20190705161433.GA29023@alvherre.pgsql>
Permalink:  ../20190705161433.GA29023@alvherre.pgsql/
Also on:    postgresql.org/message-id/20190705161433.GA29023@alvherre.pgsql

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, robertmhaas@gmail.com, rigger.manuel@gmail.com
  Subject: Re: VACUUM FULL results in deadlock
  In-Reply-To: <20190705161433.GA29023@alvherre.pgsql>
  References: <CA+TgmoY9dLt1t5s0UmbxcHCS5cXTb4UChNocdBtsBRWDTGbP-w@mail.gmail.com> <20190705161433.GA29023@alvherre.pgsql>

* 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