Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZfZB-0002JP-9j for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Nov 2019 18:28:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iZfZA-0003Ev-15 for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Nov 2019 18:28:00 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZfZ9-0003En-LB for pgsql-bugs@lists.postgresql.org; Tue, 26 Nov 2019 18:27:59 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZfZ6-0001AC-Ir for pgsql-bugs@lists.postgresql.org; Tue, 26 Nov 2019 18:27:59 +0000 Received: by mail-wr1-x443.google.com with SMTP id y11so20549727wrt.6 for ; Tue, 26 Nov 2019 10:27:56 -0800 (PST) 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:references:mime-version :content-disposition:in-reply-to; bh=E0O8NXaHD3PLMnrRB1tx6kV3VoS8ZVG5jXNzPsqISOk=; b=badd3SXLFo/GIc5oWAF9WlCioL52bWnUV7LFDpshGBnFpCBry0J/qIgi67JJnli9eY TWQzScEZuHg0kVvqZ0wSEiRvDcPMZ+SW5wvt4TvCycKtYC2Lw5GLo5lSNBNquP/IUTya lVDALBiBkaqsZCbjOHOE+D7qGL+gZ5F9w7n2X5WoOrvtCsvHHwbhFn1zV0RuRM7PwOxV +QWpV4dVlaN7LSweyklSZvBMszAXo4FaPetJouxtB9bprkLScUuxrdPHwOGBXWTxJP6t A93Tkzr5KOUgtiVh2gvh8agJu8QWSjekbbWkKqYmwDFcvs3fW4QMLbqK/HpRFptpABuE Nw7A== 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; bh=E0O8NXaHD3PLMnrRB1tx6kV3VoS8ZVG5jXNzPsqISOk=; b=Eq0FLPuYutmA0wWIbh6eXjk5PObGvo7Z0YXNadF4SorVn9/xHzL3+uhI65jah7E3I0 6sjdKwHn9bZ55magStnek9CZnqb1G46ZeMtit8SpbXNBrKJolj868/9hXPsa6pfZuk7b aI4lmgkH0vSKD2o4AekUlx35oiZ+WUdCAjWFk7qLLIGA5CTLMODXYGGkzTtiL9elu1mT MgSHJFd3bIvmns6hjiukETVRDInpm4sqXj+i7GDK0WsX2jg6OHhYhScXVMna/UcECup8 wqPeKhKlYd4bdRt+8lr+7jTgLcZKMa23jxJJp1+aoKjVODnC59MUtrwMZ2cdgAiiTsEh x8zQ== X-Gm-Message-State: APjAAAVvCVAJJucTkgscMz1sWxaMlX4pdz7LG4yKjz+Wvk9++iVwGZCt L9PYI780vnvUJ6r2K4DWaScfCw== X-Google-Smtp-Source: APXvYqxj89v6gSoLew3XZR3aDv5tHrWL1nY2QAyK3VJTA15vPRIX7sZPIuywM7b8VnCm1lAcA9+I5w== X-Received: by 2002:a5d:6192:: with SMTP id j18mr39932069wru.239.1574792874775; Tue, 26 Nov 2019 10:27:54 -0800 (PST) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id h15sm16460744wrb.44.2019.11.26.10.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 10:27:53 -0800 (PST) Date: Tue, 26 Nov 2019 19:27:52 +0100 From: Tomas Vondra To: Alvaro Herrera Cc: Andres Freund , Andrey Salnikov , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16125: Crash of PostgreSQL's wal sender during logical replication Message-ID: <20191126182752.byojog7xws2or73x@development> References: <16125-a78dafa032d53f7e@postgresql.org> <20191118205816.5wne6hxedrm7zd5p@development> <20191119221732.pcqtxljac334zgb4@development> <20191119232849.qhtuhq4udrqrz4he@alap3.anarazel.de> <20191126171054.GB4161@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191126171054.GB4161@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Nov 26, 2019 at 02:10:54PM -0300, Alvaro Herrera wrote: >On 2019-Nov-19, Andres Freund wrote: > >> > > 2518:rmgr: Heap len (rec/tot): 2063/ 2063, tx: 1667601530, lsn: 25EE/D66F11E8, prev 25EE/D66F0CB0, desc: INSERT off 4, blkref #0: rel 1663/13018/88964795 blk 3125 >> > > 2520:rmgr: Btree len (rec/tot): 64/ 64, tx: 1667601530, lsn: 25EE/D66F1A38, prev 25EE/D66F19F8, desc: INSERT_LEAF off 256, blkref #0: rel 1663/13018/88964797 blk 15840 >> > > 2522:rmgr: Heap len (rec/tot): 1341/ 9385, tx: 1667601530, lsn: 25EE/D66F2118, prev 25EE/D66F1A78, desc: INSERT off 7, blkref #0: rel 1663/13018/88964795 blk 3139 FPW >> > > 2524:rmgr: Btree len (rec/tot): 64/ 64, tx: 1667601530, lsn: 25EE/D66F54C8, prev 25EE/D66F45E0, desc: INSERT_LEAF off 257, blkref #0: rel 1663/13018/88964797 blk 15840 >> > > 2525:rmgr: Heap len (rec/tot): 1671/ 1671, tx: 1667601530, lsn: 25EE/D66F5508, prev 25EE/D66F54C8, desc: INSERT off 2, blkref #0: rel 1663/13018/88964792 blk 18475 >> > > 2527:rmgr: Btree len (rec/tot): 64/ 64, tx: 1667601530, lsn: 25EE/D66F6738, prev 25EE/D66F5B90, desc: INSERT_LEAF off 140, blkref #0: rel 1663/13018/88964798 blk 2058 >> > > 2530:rmgr: Btree len (rec/tot): 96/ 96, tx: 1667601530, lsn: 25EE/D66F7E40, prev 25EE/D66F7E10, desc: INSERT_LEAF off 28, blkref #0: rel 1663/13018/88964799 blk 5076 >> > > 2531:rmgr: Btree len (rec/tot): 80/ 80, tx: 1667601530, lsn: 25EE/D66F7EA0, prev 25EE/D66F7E40, desc: INSERT_LEAF off 88, blkref #0: rel 1663/13018/88964800 blk 3412 >> > > 2532:rmgr: Heap len (rec/tot): 54/ 54, tx: 1667601530, lsn: 25EE/D66F7EF0, prev 25EE/D66F7EA0, desc: DELETE off 2 , blkref #0: rel 1663/13018/88964792 blk 18475 >> > > 2533:rmgr: Heap len (rec/tot): 54/ 54, tx: 1667601530, lsn: 25EE/D66F7F28, prev 25EE/D66F7EF0, desc: DELETE off 4 , blkref #0: rel 1663/13018/88964795 blk 3125 >> > > 2534:rmgr: Heap len (rec/tot): 54/ 54, tx: 1667601530, lsn: 25EE/D66F7F60, prev 25EE/D66F7F28, desc: DELETE off 7 , blkref #0: rel 1663/13018/88964795 blk 3139 >> > > 56346:rmgr: Heap len (rec/tot): 378/ 8198, tx: 1667601537, lsn: 25EE/D6DE33B0, prev 25EE/D6DE1628, desc: DELETE off 6 KEYS_UPDATED , blkref #0: rel 1663/13018/88964815 blk 1938695 FPW >> >> > > 56347:rmgr: Heap len (rec/tot): 54/ 54, tx: 1667601538, lsn: 25EE/D6DE53D0, prev 25EE/D6DE33B0, desc: LOCK off 5: xid 1667601538: flags 0 LOCK_ONLY EXCL_LOCK , blkref #0: rel 1663/13018/88964792 blk 18460 >> > > 56348:rmgr: Heap len (rec/tot): 6563/ 6563, tx: 1667601538, lsn: 25EE/D6DE5408, prev 25EE/D6DE53D0, desc: UPDATE off 5 xmax 1667601538 ; new off 3 xmax 0, blkref #0: rel 1663/13018/88964792 blk 18499, blkref #1: rel 1663/13018/88964792 blk 18460 >> > > 56349:rmgr: Btree len (rec/tot): 64/ 64, tx: 1667601538, lsn: 25EE/D6DE6DC8, prev 25EE/D6DE5408, desc: INSERT_LEAF off 140, blkref #0: rel 1663/13018/88964798 blk 2058 >> > > 56350:rmgr: Btree len (rec/tot): 96/ 96, tx: 1667601538, lsn: 25EE/D6DE6E08, prev 25EE/D6DE6DC8, desc: INSERT_LEAF off 28, blkref #0: rel 1663/13018/88964799 blk 5076 >> > > 56351:rmgr: Btree len (rec/tot): 80/ 80, tx: 1667601538, lsn: 25EE/D6DE6E68, prev 25EE/D6DE6E08, desc: INSERT_LEAF off 88, blkref #0: rel 1663/13018/88964800 blk 3412 >> > > 56352:rmgr: Transaction len (rec/tot): 66/ 66, tx: 1667601527, lsn: 25EE/D6DE6EB8, prev 25EE/D6DE6E68, desc: COMMIT 2019-11-16 03:01:39.326201 UTC; subxacts: 1667601528 1667601530 1667601537 1667601538 >> >> > So, this DELETE change triggers the issue. If I understand it correctly, >> > that means the transaction locked the tuple and then deleted it. But I >> > don't see any record about the lock. >> >> Hm. I don't think it necessarily means that. compute_new_xmax_infomask(), when >> called from heap_delete(), will e.g. set HEAP_KEYS_UPDATED when >> >> if (old_infomask & HEAP_XMAX_INVALID) >> >> is true. Which is the most common case. > >I don't understand what you guys are saying. There's a DELETE at >25EE/D6DE33B0 (line 56346) which seems to be the one causing trouble. >Right? There's also a LOCK+UPDATE sequence just below that, which is >unrelated (different rel). Are you saying that one of them is toast and >the other is its main heap? It would be useful to know more about the >rels. > I was wondering why there's no LOCK before the DELETE, when the waldump output has KEYS_UPDATED for that change. But as Andres says, it's likely normal because e.g. heap_delete sets flag in certain cases. I agree it would be useful to know more about the rels. AFAIK 88964815 is the heap, and my guess is the other rels are various indexes on it. I've already said so in my message from last week. >> I actually find it *more* >> curious to *not* see that for a delete. I've not traced fully through >> it, yet. >> Alvaro, it's not clear to me whether the the multixact codepaths in >> compute_new_xmax_infomask() actually work as expected for deletes. > >Are you saying that the three *prior* deletes (lines 2532-2534) are >strange because they lack the KEYS_UPDATED bit? (Note these are all for >different rels). > >I'm not sure what to do about this report at this point. >Notwithstanding my general failure to focus on anything too complex >given my surrounding social context. > I think having more information about the structure (tables, indexes, mapping for relfilenodes) and a better idea what the transaction is doing, would be helpful. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services