From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | wangchuanting <wangchuanting(at)huawei(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog |
Date: | 2017-06-05 01:27:54 |
Message-ID: | CAB7nPqRmegQw=NLquqEPKE61UgegFOmUXaxYVRYGgfMuzZt12w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
On Fri, Jun 2, 2017 at 10:59 AM, wangchuanting <wangchuanting(at)huawei(dot)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
Attachment | Content-Type | Size |
---|---|---|
2pc-redo-lwlock-fix-v2.patch | application/octet-stream | 10.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-06-05 01:28:39 | Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog |
Previous Message | Andres Freund | 2017-06-04 23:10:12 | Re: BUG #14687: pg_xlogdump does only count "main data" for record length and leading to incorrect statistics |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-06-05 01:28:39 | Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog |
Previous Message | Jing Wang | 2017-06-05 01:09:03 | Support to COMMENT ON DATABASE CURRENT_DATABASE |