Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLAKL-0007uU-Iw for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Jun 2017 15:35:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dLAKL-0000cI-5f for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Jun 2017 15:35: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 1dLAKK-0000a5-8L for pgsql-bugs@postgresql.org; Wed, 14 Jun 2017 15:35:24 +0000 Received: from mail-qt0-x22d.google.com ([2607:f8b0:400d:c0d::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dLAKI-0000VJ-0h for pgsql-bugs@postgresql.org; Wed, 14 Jun 2017 15:35:23 +0000 Received: by mail-qt0-x22d.google.com with SMTP id u19so3847876qta.3 for ; Wed, 14 Jun 2017 08:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=63JvtFEa1BwUETvLs2a4ubgv8jxXxYC2swKwr0NlYdA=; b=NVbtRa5mRy7NGAtC7io7M5Q10jONpNksBl0BnYpJW8Zt0LK+VNIhw/TO7k3LVwd2du BBotESYHIpKbd0CSy773bqRHDIUJ9hN6rSHkavcpVlfc4+IHVO1SkioaxOL1M9kOCiwP 1IvkG5QUptJLCvqTZKtqwASDM3VzwIG7nq44Cdn4UCY1BYBGhoIq4e6M713t5jMRNvIt bcZTcpKS9O9NwhISp2S4g7yQfzQIqJPTPALxxURceGuQxYy9o7QAHxv4a0doLK+INmfN we8Z0LNgFFgu3SBfEZpRCvs6duc+dNWmYs9nrm8eownXYBVYTI2I9x2rzvxuUJzqjm58 qurw== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=63JvtFEa1BwUETvLs2a4ubgv8jxXxYC2swKwr0NlYdA=; b=RwsTOMoWShQNZA85Kfm87bFQQwk6tNN3G+c+A3UlMtaXzYDoy+JmzrwYuACCXSAhRP tA9b3KqIAf+IUZELA19q/yLmgNR7B5frES+FpAozBrFsA/UPkK2vGqNaypiR33uU3/bf 970aZf9i9Wm2Lh5yZdpPSZsgJ9GPplgV2uzniFzKdUleuP8Yx12aXwdX0GlKxccf+M44 rkFqH09JeQgwAQ785/l+p0BJJw/KRYfM5iRpPcHRmoITumzFljK8BvdHjqj4P9Ruj05R yoARn2+w4OiI59adZQzHq6/qjXeRc7m33E6QmQ+D25piY6DQHaCyZLgbM/h5JQ2ZJb4m daQQ== X-Gm-Message-State: AKS2vOwFa+SNeEjlYmt/PIzEo1y7AALZCJ5CAmHNM+l0xwTZIf4IdwOf UBJnblQ3iFMCv5Dx X-Received: by 10.237.45.103 with SMTP id h94mr822941qtd.204.1497454519989; Wed, 14 Jun 2017 08:35:19 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([190.217.209.130]) by smtp.gmail.com with ESMTPSA id m9sm198834qke.8.2017.06.14.08.35.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 08:35:18 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id AA54D493; Wed, 14 Jun 2017 12:35:10 -0300 (-03) Date: Wed, 14 Jun 2017 11:35:10 -0400 From: Alvaro Herrera To: Michael Paquier Cc: wangchuanting , PostgreSQL mailing lists Subject: Re: Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog Message-ID: <20170614153510.l57n2dgr3ukkgla4@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.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 Michael Paquier wrote: > On Wed, Jun 14, 2017 at 8:08 AM, Alvaro Herrera > 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. Thanks, pushed. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs