From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pgsql: autovacuum: handle analyze for partitioned tables |
Date: | 2021-04-08 18:35:51 |
Message-ID: | 20210408183551.GA16359@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
On 2021-Apr-08, Tom Lane wrote:
> Yeah. I hit this on another machine that isn't using EXEC_BACKEND,
> and I concur it looks more like a race condition. I think the problem
> is that autovacuum is calling find_all_inheritors() on a relation it
> has no lock on, contrary to that function's API spec. find_all_inheritors
> assumes the OID it's given is valid and locked, and adds it to the
> result list automatically. Then it looks for children, and won't find
> any in the race case where somebody else just dropped the table.
Hmm. Autovacuum tries hard to avoid grabbing locks on relations until
really needed (at vacuum/analyze time), which is why all these tests
only use data that can be found in the pg_class rows and pgstat entries.
So I tend to think that my initial instinct was the better direction: we
should not be doing any find_all_inheritors() here at all, but instead
rely on pg_class.reltuples to be set for the partitioned table.
I'll give that another look. Most places already assume that reltuples
isn't set for a partitioned table, so they shouldn't care. I wonder,
though, whether we should set relpages to some value other than 0 or -1.
(I'm inclined not to, since autovacuum does not use it.)
--
Álvaro Herrera Valdivia, Chile
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-04-08 18:47:01 | Re: pgsql: autovacuum: handle analyze for partitioned tables |
Previous Message | Tom Lane | 2021-04-08 17:57:45 | Re: pgsql: autovacuum: handle analyze for partitioned tables |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-04-08 18:47:01 | Re: pgsql: autovacuum: handle analyze for partitioned tables |
Previous Message | Bryn Llewellyn | 2021-04-08 18:17:18 | Re: Have I found an interval arithmetic bug? |