Re: Making WAL receiver startup rely on GUC context forprimary_conninfo and primary_slot_name

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Making WAL receiver startup rely on GUC context forprimary_conninfo and primary_slot_name
Дата
Msg-id 20190110004752.GC2157@paquier.xyz
обсуждение исходный текст
Ответ на Re: Making WAL receiver startup rely on GUC context forprimary_conninfo and primary_slot_name  (Donald Dong <xdong@csumb.edu>)
Ответы Re: Making WAL receiver startup rely on GUC context forprimary_conninfo and primary_slot_name  (Donald Dong <xdong@csumb.edu>)
Список pgsql-hackers
On Wed, Jan 09, 2019 at 06:00:23AM -0800, Donald Dong wrote:
> I wonder why do we need to have this addition?
>
> src/backend/replication/walreceiver.c
> +       memset(walrcv->slotname, 0, NAMEDATALEN);
> +       if (PrimarySlotName)
> +               strlcpy((char *) walrcv->slotname, PrimarySlotName, NAMEDATALEN);
>

That's much cleaner to me to clean up the field for safety before
starting the process.  When requesting a WAL receiver to start,
slotname and conninfo gets zeroed before doing anything, you are right
that we could do without it actually.

> I notice these patterns appear in different places. Maybe it will be
> better to have a common method such as pg_str_empty()?

That's a pattern used quite a lot for many GUCs, so that's quite
separate from this patch.  Perhaps it would make sense to have a macro
for that purpose for GUCs, I am not sure if that's worth it though.
--
Michael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: some minor comment fix in md.c
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Misleading panic message in backend/access/transam/xlog.c