Simplify if/else logic of walsender CreateReplicationSlot

Поиск
Список
Период
Сортировка
От Peter Smith
Тема Simplify if/else logic of walsender CreateReplicationSlot
Дата
Msg-id CAHut+PtnJzqKT41Zt8pChRzba=QgCqjtfYvcf84NMj3VFJoKfw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Simplify if/else logic of walsender CreateReplicationSlot  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
Hi,

While reviewing another patch I was looking at the walsender's static
function CreateReplicationSlot

I found that the current logic seemed to have some unnecessary if/else
checking which can be simplified.

~~

To summarise:

CURRENT
if (cmd->kind == REPLICATION_KIND_PHYSICAL)
{
  ...
}
else
{
  ...
}
if (cmd->kind == REPLICATION_KIND_LOGICAL)
{
  ...
}
else if (cmd->kind == REPLICATION_KIND_PHYSICAL && reserve_wal)
{
  ...
}


SUGGESTION
if (cmd->kind == REPLICATION_KIND_PHYSICAL)
{
  ...
  if (reserve_wal)
  {
    ...
  }
}
else /* REPLICATION_KIND_LOGICAL */
{
  ...
}

~~~

PSA a small patch for making this change.

(I ran make check-world after this change and it was successful)

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Вложения

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Remove MSVC scripts from the tree
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: meson documentation build open issues