Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIPE7-0003ZC-Ui for pgsql-committers@arkaria.postgresql.org; Sat, 25 Nov 2017 01:25:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIPE6-0002yk-U0 for pgsql-committers@arkaria.postgresql.org; Sat, 25 Nov 2017 01:25:50 +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 1eIPE6-0002ya-P7 for pgsql-committers@lists.postgresql.org; Sat, 25 Nov 2017 01:25:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eIPE3-0008Fx-0N for pgsql-committers@postgresql.org; Sat, 25 Nov 2017 01:25:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAP1PcMR004619; Fri, 24 Nov 2017 20:25:38 -0500 From: Tom Lane To: Andres Freund cc: Tomas Vondra , Simon Riggs , pgsql-committers Subject: Re: pgsql: Generational memory allocator In-reply-to: <16449.1511548313@sss.pgh.pa.us> References: <20171123001649.y2nf7422iay6cw3v@alap3.anarazel.de> <16449.1511548313@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 24 Nov 2017 13:31:53 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <4584.1511573108.0@sss.pgh.pa.us> Date: Fri, 24 Nov 2017 20:25:38 -0500 Message-ID: <4618.1511573138@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4584.1511573108.1@sss.pgh.pa.us> I wrote: > For me, this patch fixes the valgrind failures inside generation.c > itself, but I still see one more in the test_decoding run: ... > Not sure what to make of this: the stack traces make it look unrelated > to the GenerationContext changes, but if it's not related, how come > skink was passing before that patch went in? I've pushed fixes for everything that I could find wrong in generation.c (and there was a lot :-(). But I'm still seeing the "invalid read in SnapBuildProcessNewCid" failure when I run test_decoding under valgrind. Somebody who has more familiarity with the logical decoding stuff than I do needs to look into that. I tried to narrow down exactly which fetch in SnapBuildProcessNewCid was triggering the failure, with the attached patch. Weirdly, *it does not fail* with this. I have no explanation for that. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="hack-to-split-up-fetches.patch"; charset="us-ascii" Content-ID: <4584.1511573108.2@sss.pgh.pa.us> Content-Description: hack-to-split-up-fetches.patch Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/rep= lication/logical/snapbuild.c index ad65b98..a48db7e 100644 *** a/src/backend/replication/logical/snapbuild.c --- b/src/backend/replication/logical/snapbuild.c *************** SnapBuildProcessNewCid(SnapBuild *builde *** 770,775 **** --- 770,781 ---- XLogRecPtr lsn, xl_heap_new_cid *xlrec) { CommandId cid; + TransactionId top_xid; + RelFileNode node; + ItemPointerData tid; + CommandId cmin; + CommandId cmax; + CommandId combocid; = /* * we only log new_cid's if a catalog tuple was modified, so mark the *************** SnapBuildProcessNewCid(SnapBuild *builde *** 777,786 **** */ ReorderBufferXidSetCatalogChanges(builder->reorder, xid, lsn); = ! ReorderBufferAddNewTupleCids(builder->reorder, xlrec->top_xid, lsn, ! xlrec->target_node, xlrec->target_tid, ! xlrec->cmin, xlrec->cmax, ! xlrec->combocid); = /* figure out new command id */ if (xlrec->cmin !=3D InvalidCommandId && --- 783,799 ---- */ ReorderBufferXidSetCatalogChanges(builder->reorder, xid, lsn); = ! top_xid =3D xlrec->top_xid; ! node =3D xlrec->target_node; ! tid =3D xlrec->target_tid; ! cmin =3D xlrec->cmin; ! cmax =3D xlrec->cmax; ! combocid =3D xlrec->combocid; ! = ! ReorderBufferAddNewTupleCids(builder->reorder, top_xid, lsn, ! node, tid, ! cmin, cmax, ! combocid); = /* figure out new command id */ if (xlrec->cmin !=3D InvalidCommandId && ------- =_aaaaaaaaaa0--