Re: Server crash in pg_replication_slot_advance function

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Re: Server crash in pg_replication_slot_advance function
Дата
Msg-id d9c0faf8-c7e2-155b-ace2-2627dc4c46cd@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Server crash in pg_replication_slot_advance function  (amul sul <sulamul@gmail.com>)
Ответы Re: Server crash in pg_replication_slot_advance function
Список pgsql-hackers
On 16/02/18 10:55, amul sul wrote:
> On Fri, Feb 16, 2018 at 3:06 PM, amul sul <sulamul@gmail.com> wrote:
>> On Fri, Feb 16, 2018 at 1:44 PM, tushar <tushar.ahuja@enterprisedb.com> wrote:
>>> Hi,
>> [....]
>>> postgres=# SELECT end_lsn FROM
>>> pg_replication_slot_advance('regression_slot1', '0/2000071');
>>> server closed the connection unexpectedly
>>> This probably means the server terminated abnormally
>>>  before or while processing the request.
>>> !>
>>>
>>
>> I am able to reproduce this on the latest master head, the problem is in the
>> following hunk of pg_replication_slot_advance() where oldest LSN value
>> is accessed after releasing replication slot:
>>
>>
>> 476     if (moveto < startlsn)
>> 477     {
>> 478         ReplicationSlotRelease();
>> 479         ereport(ERROR,
>> 480                 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
>> 481                  errmsg("cannot move slot to %X/%X, minimum is %X/%X",
>> 482                         (uint32) (moveto >> 32), (uint32) moveto,
>> 483                         (uint32)
>> (MyReplicationSlot->data.confirmed_flush >> 32),
>> 484                         (uint32)
>> (MyReplicationSlot->data.confirmed_flush))));
>> 485     }
>> 486
>>

Yeah, of course we can't use MyReplicationSlot after calling
ReplicationSlotRelease().

> 
>  Attached patch proposes a required fix.
> 

Looks correct to me.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: tushar
Дата:
Сообщение: Re: Server crash in pg_replication_slot_advance function
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: Server crash in pg_replication_slot_advance function