Re: Improve behavior of concurrent ANALYZE/VACUUM

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>, "horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp" <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Subject: Re: Improve behavior of concurrent ANALYZE/VACUUM
Date: 2018-08-23 05:08:13
Message-ID: 20180823050813.GB1158@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 22, 2018 at 03:49:16PM +0000, Bossart, Nathan wrote:
> I think so, since this is the only ownership checks we do on
> individual partitions. Another simple way to test this would be to
> create a partitioned table with a different owner than the partitions
> and to run VACUUM as the partitioned table owner. In this case, we
> would still rely on the checks in vacuum_rel() and analyze_rel(). IMO
> this is a reason to avoid skipping gathering the individual partitions
> based upon the ownership of the partitioned table. It's true that
> this wouldn't fix the locking issue for partitions, but the
> aforementioned edge case is still present with 0002 anyway. Plus, it
> would add a bit more consistency to partition handling in VACUUM.

Normal regression tests are less costly than isolation tests, so let's
use them as possible. What you attached is covering only a portion of
all the scenarios though, as it is as well interesting to see what
happens if another user owns only the partitioned table, only one
partition, and the partitioned as well as at least one partition. I
have extended your patch as attached. It applies on top of HEAD. Once
applied with the other patch one can easily stop the difference in
behavior, and this stresses the ownership checks in vacuum_rel() and
analyze_rel() as well. Perhaps we could begin by that?

> We should probably return false here.

Oh, my compiler complained here as well. Fixed it on my branch.
--
Michael

Attachment Content-Type Size
vacuum_permission_checks_v2.patch text/x-diff 8.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-08-23 05:10:17 Re: plan_cache_mode and postgresql.conf.sample
Previous Message Michael Paquier 2018-08-23 04:14:20 Re: BUG #15346: Replica fails to start after the crash