Re: Assertion failure in pg_copy_logical_replication_slot()

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Assertion failure in pg_copy_logical_replication_slot()
Дата
Msg-id 20200624003841.GA7808@alvherre.pgsql
обсуждение исходный текст
Ответ на Assertion failure in pg_copy_logical_replication_slot()  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Ответы Re: Assertion failure in pg_copy_logical_replication_slot()  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Список pgsql-hackers
On 2020-Jun-23, Fujii Masao wrote:

> If restart_lsn of logical replication slot gets behind more than
> max_slot_wal_keep_size from the current LSN, the logical replication
> slot would be invalidated and its restart_lsn is reset to an invalid LSN.
> If this logical replication slot with an invalid restart_lsn is specified
> as the source slot in pg_copy_logical_replication_slot(), the function
> causes the following assertion failure.
> 
>     TRAP: FailedAssertion("!logical_slot", File: "slotfuncs.c", Line: 727)

Oops.

> This assertion failure is caused by
> 
>     /* Copying non-reserved slot doesn't make sense */
>     if (XLogRecPtrIsInvalid(src_restart_lsn))
>         ereport(ERROR,
>                 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
>                  errmsg("cannot copy a replication slot that doesn't reserve WAL")));

Heh, you pasted the code after your patch rather than the original.

I think the errcode is a bit bogus considering the new case.
IMO ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE is more appropriate.

One could argue that the error message could also be different for the
case of a logical slot (or even a physical slot that has the upcoming
"invalidated_at" LSN set), maybe "cannot copy a replication slot that
has been invalidated" but maybe that's a pointless distinction.
I don't object to the patch as presented.


-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: min_safe_lsn column in pg_replication_slots view
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Threading in BGWorkers (!)