Re: [BUGS] Re: BUG #14680: startup process on standby encounter adeadlock of TwoPhaseStateLock when redo 2PC xlog

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [BUGS] Re: BUG #14680: startup process on standby encounter adeadlock of TwoPhaseStateLock when redo 2PC xlog
Дата
Msg-id CAB7nPqRmegQw=NLquqEPKE61UgegFOmUXaxYVRYGgfMuzZt12w@mail.gmail.com
обсуждение исходный текст
Ответ на [BUGS] Re: BUG #14680: startup process on standby encounter a deadlock ofTwoPhaseStateLock when redo 2PC xlog  (wangchuanting <wangchuanting@huawei.com>)
Ответы [BUGS] Re: BUG #14680: startup process on standby encounter a deadlock ofTwoPhaseStateLock when redo 2PC xlog  (wangchuanting <wangchuanting@huawei.com>)
Re: [BUGS] Re: BUG #14680: startup process on standby encounter adeadlock of TwoPhaseStateLock when redo 2PC xlog  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-bugs
On Fri, Jun 2, 2017 at 10:59 AM, wangchuanting <wangchuanting@huawei.com> wrote:
> Appreciate for your quick response.

Back into business for this issue.

> i look carefully on the patch, because of we removed TwoPhaseStateLock
> lwlock acquire in `RemoveGXact' and let caller held lwlock, so i think:
> 1. xact_redo also need held lwlock before call PrepareRedoRemove
> 2. RecoverPreparedTransactions also need held lwlock before call
> ProcessTwoPhaseBuffer

Thanks for the input. I have reviewed all the code paths that have
been modified, and strengthened the code with assertions using
LWLockHeldByMeInMode() to make sure that the correct lock is always
hold in those code paths. There is actually no point in holding the
lock in restoreTwoPhaseData(), but as this makes the code less
consistent with the rest I added one. Also, I have replaced the lock
acquisition in PrepareRedoAdd() with acquisitions at higher levels,
and added an assertion in this routine. This makes the 2PC state data
addition and removal more consistent with each other.
-- 
Michael

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [BUGS] BUG #14687: pg_xlogdump does only count "main data" forrecord length and leading to incorrect statistics
Следующее
От: Michael Paquier
Дата:
Сообщение: [BUGS] Re: BUG #14680: startup process on standby encounter a deadlock ofTwoPhaseStateLock when redo 2PC xlog