Re: Add lookup table for replication slot invalidation causes

Поиск
Список
Период
Сортировка
От Peter Smith
Тема Re: Add lookup table for replication slot invalidation causes
Дата
Msg-id CAHut+PtsrSWxczpGkSaSVtJo+BXrvJ3Hwp5gES14bbL-G+HL7A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add lookup table for replication slot invalidation causes  (Peter Smith <smithpb2250@gmail.com>)
Ответы Re: Add lookup table for replication slot invalidation causes  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Thu, Feb 22, 2024 at 5:19 PM Peter Smith <smithpb2250@gmail.com> wrote:
>
> Hi, Sorry for the late comment but isn't the pushed logic now
> different to what it was there before?
>
> IIUC previously (in a non-debug build) if the specified
> conflict_reason was not found, it returned RS_INVAL_NONE -- now it
> seems to return whatever enum happens to be last.
>
> How about something more like below:
>
> ----------
> ReplicationSlotInvalidationCause
> GetSlotInvalidationCause(const char *conflict_reason)
> {
>   ReplicationSlotInvalidationCause cause;
>   bool        found  = false;
>
>   for (cause = 0; !found && cause <= RS_INVAL_MAX_CAUSES; cause++)
>     found = strcmp(SlotInvalidationCauses[cause], conflict_reason) == 0;
>
>   Assert(found);
>   return found ? cause : RS_INVAL_NONE;
> }
> ----------
>

Oops. Perhaps I meant more like below -- in any case, the point was
the same -- to ensure RS_INVAL_NONE is what returns if something
unexpected happens.

ReplicationSlotInvalidationCause
GetSlotInvalidationCause(const char *conflict_reason)
{
    ReplicationSlotInvalidationCause cause;

    for (cause = 0; cause <= RS_INVAL_MAX_CAUSES; cause++)
    {
        if (strcmp(SlotInvalidationCauses[cause], conflict_reason) == 0)
            return cause;
    }

    Assert(0);
    return RS_INVAL_NONE;
}

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



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

Предыдущее
От: Peter Smith
Дата:
Сообщение: Re: Add lookup table for replication slot invalidation causes
Следующее
От: Richard Guo
Дата:
Сообщение: Re: POC: GROUP BY optimization