Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.

Поиск
Список
Период
Сортировка
От vignesh C
Тема Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.
Дата
Msg-id CALDaNm2sQD-bwMKavLyiogMBBrg3fx5PTaV5RyV8UiczR9K_tw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.  (Peter Smith <smithpb2250@gmail.com>)
Ответы Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Mon, Jul 25, 2022 at 8:34 AM Peter Smith <smithpb2250@gmail.com> wrote:
>
> On Mon, Jul 25, 2022 at 11:08 AM Michael Paquier <michael@paquier.xyz> wrote:
> >
> > On Sun, Jul 24, 2022 at 09:52:16PM +0530, vignesh C wrote:
> > > Thanks for the comments,  i have modified it by changing it to a
> > > boolean parameter. The attached v4 patch has the changes for the same.
> >
> > Okay, thanks for the patch.  This looks good to me, so let's do as
> > Amit suggests.  I'll apply that if there are no objections.
> > --
>
> OK. I have no objections to just passing a boolean, but here are a
> couple of other small review comments for the v4-0001 patch:
>
> ======
>
> 1. src/backend/catalog/pg_subscription.c
>
> @@ -533,65 +533,14 @@ HasSubscriptionRelations(Oid subid)
>  }
>
>  /*
> - * Get all relations for subscription.
> + * Get the relations for subscription.
>   *
> - * Returned list is palloc'ed in current memory context.
> + * If only_not_ready is false, return all the relations for subscription. If
> + * true, return all the relations for subscription that are not in a ready
> + * state. Returned list is palloc'ed in current memory context.
>   */
>
> The function comment was describing the new boolean parameter in a
> kind of backwards way. It seems more natural to emphasise what true
> means.
>
>
> SUGGESTION
> Get the relations for the subscription.
>
> If only_not_ready is true, return only the relations that are not in a
> ready state, otherwise return all the subscription relations. The
> returned list is palloc'ed in the current memory context.

Modified

> ====
>
> 2. <General - calling code>
>
> Perhaps this suggestion is overkill, but given that the param is not
> going to be a bitmask or enum anymore, IMO it means the calls are no
> longer very self-explanatory.The calling code will be more readable if
> the patch introduced some descriptive wrapper functions. e.g.
>
>
> List *
> GetSubscriptionAllRelations(Oid subid)
> {
>     return GetSubscriptionRelations(subid, false);
> }
>
> List *
> GetSubscriptionNotReadyRelations(Oid subid)
> {
>     return GetSubscriptionRelations(subid, true);
> }

I feel this would be an overkill, I did not make any changes for this.

Thanks for the comments, the attached v5 patch has the changes for the same.

Regards,
Vignesh

Вложения

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

Предыдущее
От: Richard Guo
Дата:
Сообщение: Re: Add proper planner support for ORDER BY / DISTINCT aggregates
Следующее
От: vignesh C
Дата:
Сообщение: Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.