Re: Locking for Rename To new_name works differently for different objects

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Locking for Rename To new_name works differently for different objects
Дата
Msg-id CAA4eK1+Rpx5B4Xbsys7bSmG6hf=gez8x_a0c+6yptKxW-5GjHA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Locking for Rename To new_name works differently for different objects  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Wed, Oct 15, 2014 at 9:34 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Wed, Oct 15, 2014 at 10:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Amit Kapila <amit.kapila16@gmail.com> writes:
> >> I have observed that for renaming some of the objects
> >> AccessExclusiveLock is taken on object whereas for
> >> other kind of objects no lock is taken on object before
> >> renaming the object.
> >
> > The usual theory for DDL updates of all types (not just rename)
> > is that an explicit lock is only needed for objects whose catalog
> > representation comprises more than one row.  Otherwise, the implicit
> > locking involved in updating that row is sufficient to serialize
> > different updates.

I am not sure if this rule is followed for all DDL's, as an example, I
tried to compare for FUNCTION and SCHEMA.

Function has entries in pg_proc, pg_depend (schema, language,
returntype, etc.), so by above theory any update should take explicit
lock which I think holds good whereas if we see for Schema, it has
entries in pg_namespace,  pg_depend (owner), but it doesn't take
explicit lock during Rename.

Yet another anomaly is for "Comment on <Object> .." there is only
one row in pg_description, however it still takes explicit lock to 
avoid concurrent activity which looks right to me.

> That's an interesting point that I hadn't considered, but I'm willing
> to believe that at least some of the differences might also be
> haphazard.

Yeah, I also think so, is it important enough that we spend energy to
find all such differences and fix them.


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: CREATE POLICY and RETURNING
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]