Re: Improve behavior of concurrent ANALYZE/VACUUM - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Improve behavior of concurrent ANALYZE/VACUUM
Date
Msg-id CA+TgmoYVH2ZH1TQgw9-u5FRF-X7nTbX_6Yj_U696Zb=C234M+w@mail.gmail.com
Whole thread Raw
In response to Re: Improve behavior of concurrent ANALYZE/VACUUM  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Improve behavior of concurrent ANALYZE/VACUUM
List pgsql-hackers
On Tue, Aug 14, 2018 at 11:59 AM, Michael Paquier <michael@paquier.xyz> wrote:
> On HEAD, we check the ownership of the relation vacuumed or analyzed
> after taking a lock on it in respectively vacuum_rel() and
> analyze_rel(), where we already know the OID of the relation and there
> may be no RangeVar which we could use with RangeVarGetRelidExtended
> (like partitions).  I don't think that we want to use again
> RangeVarGetRelidExtended once the relation OID is known anyway.

We definitely don't want to use RangeVarGetRelidExtended more than
necessary.  It is important that we use that function only when
necessary - that is, to look up names supplied by users - and it is
also important that we look up each user-supplied name only once, lest
we get different answers on different occasions, possibly introducing
either outright security problems or at the least ludicrous behavior.

In the case where we have an OID already, I think we could just
perform a permissions test before locking the OID.  It's true that
permissions might be revoked after we test them and before the lock is
acquired, but that doesn't seem terrible.  The real point of all of
this stuff is to keep users from locking objects which they never had
any right to access, not to worry about what happens if permissions
are concurrently revoked while we're getting the lock.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Index Skip Scan
Next
From: Robert Haas
Date:
Subject: Re: Add a semicolon to query related to search_path