Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog
Дата
Msg-id CALj2ACU_AvhYG=RK_CF7c3vnBOVyoozd8wzwOQ+KBuxrQa8yhQ@mail.gmail.com
обсуждение исходный текст
Ответ на [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog  (Xiaoran Wang <wxiaoran@vmware.com>)
Ответы Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog  (tender wang <tndrwang@gmail.com>)
Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, Mar 18, 2023 at 12:34 PM Xiaoran Wang <wxiaoran@vmware.com> wrote:
>
> Hi hackers,
>
>  In heap_create_with_catalog, the Relation new_rel_desc is created
> by RelationBuildLocalRelation, not table_open. So it's better to
> call RelationClose to release it.
>
> What's more, the comment for it seems useless, just delete it.

Essentially, all the close functions are the same with NoLock, IOW,
table_close(relation, NoLock) = relation_closerelation, NoLock) =
RelationClose(relation). Therefore, table_close(new_rel_desc, NoLock);
looks fine to me.

And, the /* do not unlock till end of xact */, it looks like it's been
there from day 1. It may be indicating that the ref count fo the new
relation created in heap_create_with_catalog() will be decremented at
the end of xact, but I'm not sure what it means.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: Xiaoran Wang
Дата:
Сообщение: Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog
Следующее
От: tender wang
Дата:
Сообщение: Re: [PATCH] Use RelationClose rather than table_close in heap_create_with_catalog