Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHdxf-0000PQ-4U for pgsql-bugs@arkaria.postgresql.org; Sun, 04 Jun 2017 22:25:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dHdxd-0006Wk-LB for pgsql-bugs@arkaria.postgresql.org; Sun, 04 Jun 2017 22:25:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dHdwv-0003yS-Dy for pgsql-bugs@postgresql.org; Sun, 04 Jun 2017 22:24:41 +0000 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dHdwq-0005xU-D3 for pgsql-bugs@postgresql.org; Sun, 04 Jun 2017 22:24:40 +0000 Received: by mail-pf0-x22d.google.com with SMTP id 83so16492107pfr.0 for ; Sun, 04 Jun 2017 15:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gYmLi6GiwNIsZVYGanSEF1+fb+GEsHHFvMw6WXD5E7w=; b=KzzAq3dYy3jaO/vq1U1BimdRXz63zyVPNwx/gKmMBN5qcmF7ybb7N+m0fivNfAYP3q RFMhY0JXUTDQ2DnBjntFoOAsY7W3cwOK/aY/qaQgvNU4YqI3OLoBmhFaWg0xp+h6vMpZ V4w+EyFeuQPIYvkIHUpKOJNuJS9fXUqlfgNgs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gYmLi6GiwNIsZVYGanSEF1+fb+GEsHHFvMw6WXD5E7w=; b=PUvHBPR6gFrI5+LCsNG8d5BUz+F27px1AaLNon3yI5bMBYRJ32k2LI0doC0JqKBQp3 vZIaB1Nl8bpp/Yt5PIPcNewftT0OI7WsB9282ZtlPPog14QGWfpG4h7lGKo/j2CW/CrA 0ONYHinHUtN0HT5Siq1yBgDxiox2aSP/sABgZw3JPBK2sr+G17z8CKdO6giaVlGGJIa4 B1se5socCL62frBvBu/TLgjpqzHtdGBpTQDtBaDj+lcqXFNahaWOWo15KHcxI1MXWJGc wu4mcrMfQIoFQELA6FSp/+jCHyJT1trbsw/yJ29BZxPmc7lszCw44QfrABJaqzSV+eIF AmAA== X-Gm-Message-State: AODbwcBCN/PPYfF+8tMqEqmrlnClup87pgTsUrdPM/MwgsMQcV/HRS2g hlXpyz1fm2AcMyxu X-Received: by 10.99.127.73 with SMTP id p9mr18165941pgn.169.1496615073745; Sun, 04 Jun 2017 15:24:33 -0700 (PDT) Received: from rfd.leadboat.com (c-73-158-248-138.hsd1.ca.comcast.net. [73.158.248.138]) by smtp.gmail.com with ESMTPSA id d3sm52091236pfg.30.2017.06.04.15.24.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jun 2017 15:24:32 -0700 (PDT) Date: Sun, 4 Jun 2017 22:24:30 +0000 From: Noah Misch To: simon@2ndquadrant.com Cc: Michael Paquier , wangchuanting@huawei.com, PostgreSQL mailing lists , Tom Lane , pgsql-hackers@postgresql.org Subject: Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog Message-ID: <20170604222430.GA1547727@rfd.leadboat.com> References: <20170531033228.1487.10124@wrigleys.postgresql.org> <28851.1496239047@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Thu, Jun 01, 2017 at 01:07:53AM -0700, Michael Paquier wrote: > On Wed, May 31, 2017 at 12:30 PM, Michael Paquier > wrote: > > On Wed, May 31, 2017 at 6:57 AM, Tom Lane wrote: > >> wangchuanting@huawei.com writes: > >>> startup process on standby encounter a deadlock of TwoPhaseStateLock when > >>> redo 2PC xlog. > >> > >> Please provide an example of how to get into this state. > > > > That would help. Are you seeing in the logs something like "removing > > future two-phase state from memory for XXX" or "removing stale > > two-phase state from shared memory for XXX"? > > > > Even with that, the light-weight lock sequence taken in those code > > paths look definitely wrong to me, we should not take twice > > TwoPhaseStateLock in the same code path. I think that we should remove > > the lock acquisitions in RemoveGXact() and PrepareRedoRemove, and then > > upgrade the locks of PrescanPreparedTransactions() and > > StandbyRecoverPreparedTransactions() to be exclusive. We still need to > > keep a lock as CheckPointTwoPhase() may still be triggered by the > > checkpoint. Tom, what do you think? > > Attached is what I was thinking about for reference. I just came back > from a long flight and I am pretty tired, so my brain may have missed > something. I'll take again a look at this issue on Monday, an open > item has been added for now. [Action required within three days. This is a generic notification.] The above-described topic is currently a PostgreSQL 10 open item. Simon, since you committed the patch believed to have created it, you own this open item. If some other commit is more relevant or if this does not belong as a v10 open item, please let us know. Otherwise, please observe the policy on open item ownership[1] and send a status update within three calendar days of this message. Include a date for your subsequent status update. Testers may discover new open items at any time, and I want to plan to get them all fixed well in advance of shipping v10. Consequently, I will appreciate your efforts toward speedy resolution. Thanks. [1] https://www.postgresql.org/message-id/20170404140717.GA2675809%40tornado.leadboat.com -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs