Re: Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: wangchuanting <wangchuanting(at)huawei(dot)com>, 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-14 01:03:11
Message-ID: CAB7nPqQnfR5aHr+Qtr2RJiw59yOkcQSrhTto2ZfDqFVn+iGmtw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Jun 14, 2017 at 8:08 AM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> So I propose that RecoverPreparedTransactions grabs exclusive lock at
> the top, and only the bottom part of the loop is done unlocked, which
> AFAICS should be safe. (MarkAsPrepared gained a boolean argument
> indicating that caller already holds lock).

Logically both approaches are really close as with this approach the
additional locked area is when scanning the entries of TwoPhaseState.
But I agree that your suggestion would be safer in the long run. This
looks good to me after a close look.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2017-06-14 04:37:40 Re: BUG #13837: Files in pg_committs not deleted
Previous Message Alvaro Herrera 2017-06-13 23:08:12 Re: Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-06-14 01:37:21 Re: PG10 Partitioned tables and relation_is_updatable()
Previous Message Alvaro Herrera 2017-06-13 23:08:12 Re: Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog