Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vlpqv-0005w3-BM for pgsql-bugs@arkaria.postgresql.org; Thu, 28 Nov 2013 00:53:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vlpqu-0003Wc-Kv for pgsql-bugs@arkaria.postgresql.org; Thu, 28 Nov 2013 00:53:08 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vlpqs-0003WT-Hg for pgsql-bugs@postgresql.org; Thu, 28 Nov 2013 00:53:06 +0000 Received: from mail12.ics.ntts.co.jp ([210.232.35.65]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vlpql-0006iY-66 for pgsql-bugs@postgresql.org; Thu, 28 Nov 2013 00:53:05 +0000 Received: from sadoku34.silk.ntts.co.jp (sadoku34 [10.7.18.34]) by mail12.ics.ntts.co.jp (8.14.4/8.14.4/NTTSOFT) with ESMTP id rAS0qm0t012561; Thu, 28 Nov 2013 09:52:48 +0900 (JST) Received: (from root@localhost) by sadoku34.silk.ntts.co.jp (8.13.8/NTTSOFT) id rAS0qmcH013913; Thu, 28 Nov 2013 09:52:48 +0900 (JST) Received: from ccmds32.silk.ntts.co.jp [10.107.0.32] by sadoku34.silk.ntts.co.jp with SMTP id KAA13909; Thu, 28 Nov 2013 09:52:48 +0900 Received: from mail147.silk.ntts.co.jp (ccmds32.silk.ntts.co.jp [127.0.0.1]) by ccmds32.silk.ntts.co.jp (8.14.3/8.14.3) with ESMTP id rAS0qlWv031613; Thu, 28 Nov 2013 09:52:47 +0900 Received: from mail147.silk.ntts.co.jp (localhost.localdomain [127.0.0.1]) by mail147.silk.ntts.co.jp (8.14.5/8.14.5/NTTSOFT) with ESMTP id rAS0qhh5022098; Thu, 28 Nov 2013 09:52:43 +0900 Received: from ccmds32 (mail145.silk.ntts.co.jp [10.107.0.145]) by mail147.silk.ntts.co.jp (8.14.5/8.14.5/NTTSOFT) with SMTP id rAS0qhDX022092; Thu, 28 Nov 2013 09:52:43 +0900 Message-ID: <529693C8.9010305@po.ntts.co.jp> Date: Thu, 28 Nov 2013 09:52:24 +0900 From: Tomonari Katsumata User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Alvaro Herrera , pgsql-bugs@postgresql.org Subject: Re: BUG #8434: Why does dead lock occur many times ? References: <20131004172217.GW5235@eldon.alvh.no-ip.org> <20131127164226.GA14522@eldon.alvh.no-ip.org> In-Reply-To: <20131127164226.GA14522@eldon.alvh.no-ip.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: CC-Mail-V4.3-Client X-CC-Mail-RelayStamp: CC-Mail-V4.3-Server X-Pg-Spam-Score: -1.9 (-) 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 Hi Alvaro, Thank you for finding it out! I'll test it from now, so please give me a while time. regards, (2013/11/28 1:42), Alvaro Herrera wrote: > I think I have figured this out. This code was being too simplistic in > that it was only checking whether there was a key-update or not; but > that, it seems, is not sufficiently fine-grained. If we instead think > in terms of an already-acquired MultiXactStatus, and a new > MultiXactStatus corresponding to the lock we're trying to acquire, we > can decide granularly whether each future version of the tuple can be > locked by us or not. And if not, we can decide whether we need to wait > on the transaction holding the lock, or fail if it already committed. > (There is a funny trick here which is that we represent the held lock > with a MultiXactStatus, even if the lock is only a plain Xid and not a > multi. This doesn't seem a problem to me.) > > So I propose the attached patch. This doesn't change the behavior > codified in the existing isolation tests, and it fixes my reduction of > your original test case. (I haven't run your original test case yet, > but I soon will.) > > Note: I don't quite like that this patch duplicates some code in > compute_new_xmax_infomask() which determines the MultiXactStatus from > the infomask bits. Not sure what a good refactoring is, though, because > that code just issues a WARNING when the LOCK_ONLY bit is set and no > other lockmode is set; whereas the new code issues an ERROR. It seems > hard to justify doing otherwise in either place, though; and doing > something more complicated doesn't seem warranted for such a corner > case. > > Note: this patch doesn't apply to master in isolation. You will need > the patch I mention in > http://www.postgresql.org/message-id/20131125201039.GF6597@eldon.alvh.no-ip.org > even though I haven't posted it yet. Will do so shortly. > -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs