Re: [HACKERS] Issues with logical replication

Поиск
Список
Период
Сортировка
От Stas Kelvich
Тема Re: [HACKERS] Issues with logical replication
Дата
Msg-id DAA36A22-324E-46BA-9C39-2F135A08A956@postgrespro.ru
обсуждение исходный текст
Ответ на Re: [HACKERS] Issues with logical replication  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
Ответы Re: [HACKERS] Issues with logical replication
Список pgsql-hackers
> On 29 Nov 2017, at 18:46, Petr Jelinek <petr.jelinek@2ndquadrant.com> wrote:
>
> What I don't understand is how it leads to crash (and I could not
> reproduce it using the pgbench file attached in this thread either) and
> moreover how it leads to 0 xid being logged. The only explanation I can
> come up is that some kind of similar race has to be in
> LogStandbySnapshot() but we explicitly check for 0 xid value there.
>

Zero xid isn’t logged. Loop in XactLockTableWait() does following:

    for (;;)
    {
        Assert(TransactionIdIsValid(xid));
        Assert(!TransactionIdEquals(xid, GetTopTransactionIdIfAny()));

    <...>

        xid = SubTransGetParent(xid);
    }

So if last statement is reached for top transaction then next iteration
will crash in first assert. And it will be reached if whole this loop
happens before transaction acquired heavyweight lock.

Probability of that crash can be significantly increased be adding sleep
between xid generation and lock insertion in AssignTransactionId().




Stas Kelvich
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



Вложения

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

Предыдущее
От: Nikolay Shaplov
Дата:
Сообщение: Re: [HACKERS] [PATCH] Move all am-related reloption code into src/backend/access/[am-name] and get rid of relopt_kind for custom AM
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: [HACKERS] SQL procedures