Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGfpi-0000Pa-SC for pgsql-bugs@arkaria.postgresql.org; Sat, 25 Jun 2016 05:08:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bGfpi-000065-DV for pgsql-bugs@arkaria.postgresql.org; Sat, 25 Jun 2016 05:08:42 +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 1bGfen-0006jB-K0 for pgsql-bugs@postgresql.org; Sat, 25 Jun 2016 04:57:25 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bGfek-0004fP-0U for pgsql-bugs@postgresql.org; Sat, 25 Jun 2016 04:57:25 +0000 Received: by mail-wm0-x235.google.com with SMTP id v199so42262498wmv.0 for ; Fri, 24 Jun 2016 21:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=Xj+Baa46g1pr76SZFLy4WDXaJtjEgXvf6RPs7qluRc8=; b=knoAIP6Nk60tGMmgqk1UmmMrRuhPjH9mbieq9oraxn7e1ubt69f1i8rjg94Gu3MzjG oNorXLULAQ+10UZJc52LiHin19slinrE/2tTYjZCht6tlYFVOdH7IqmQIL9wncXpCIwu 2cPt0IN22EqzX30qMEB5dSuBGcGICHWrkust3E8jLTjt23EnXYOr4/NSiSNwY6OhoPik WAoan+r3ZQnP9J9t5Ak75YMMgYZc7x0/b0HoxYj4B3g97p640Pztz8vGJNSej7Bi8U19 gePHA9HIc1mLUQgBRSWAw2HL8v4rIB1SJbnoxk22MiaD0OU3Gk/qfh1W3DiAMmbFeMot 1PCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=Xj+Baa46g1pr76SZFLy4WDXaJtjEgXvf6RPs7qluRc8=; b=lGPK3NJnjG/Tp0H30SAuUgenyIwuRTUWr/ippVVriv7zh+QhAnfAOuJfkKaF0rYZiW ycwSV6sqyok60L0EzSqPIjL/9Ioe2SpyhJqtyuz4bN4HRS+Yql0zszZ3dptz959NMIdq PuSo/1WbsLMOgDNTQzlrdxRXmsPvbx5TNTWxT8Hjq4J58sSsb41jhXE8iMMSdO/IGnMq HoFFb8stSH7Neswk/yaCnaCbnUilQiPOS0vvh5KQQ+4cCwnlOtP473rvNs7hiXYYTB43 hk5CdofwbJqqQLdLRkpvqrEYtVap63voTtQ5KNgbt/k4zlHjAjOdG0mlSSPzirY/qE2/ 8s5w== X-Gm-Message-State: ALyK8tI33bTK1cbb9hXYD8XXxeNC7VaFM7b0L3dFoKhwx2bGkEIJJh/O4ViU7X9eBMXtFQ== X-Received: by 10.28.125.71 with SMTP id y68mr1200684wmc.103.1466830640114; Fri, 24 Jun 2016 21:57:20 -0700 (PDT) Received: from [10.0.1.2] ([79.114.91.49]) by smtp.gmail.com with ESMTPSA id q71sm1497763wme.17.2016.06.24.21.57.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Jun 2016 21:57:18 -0700 (PDT) Subject: Re: BUG #14208: Inconsistent code modification - 3 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_3C1F9887-AA44-4725-82CD-8E2470295996"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.6b2 From: "petrum@gmail.com" In-Reply-To: <20160623225301.4v7heuiyvkfwi5ev@alap3.anarazel.de> Date: Sat, 25 Jun 2016 07:57:17 +0300 Cc: Tom Lane , pgsql-bugs@postgresql.org Message-Id: <5778942A-7E79-4621-A8D0-BA479EFCB4F7@gmail.com> References: <20160622144830.5791.22512@wrigleys.postgresql.org> <31897.1466610316@sss.pgh.pa.us> <20160623225301.4v7heuiyvkfwi5ev@alap3.anarazel.de> To: Andres Freund X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -2.7 (--) 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 --Apple-Mail=_3C1F9887-AA44-4725-82CD-8E2470295996 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 24 Jun 2016, at 01:53, Andres Freund wrote: >=20 > On 2016-06-22 11:45:16 -0400, Tom Lane wrote: >> petrum@gmail.com writes: >>> File: = postgresql-9.4.4/src/backend/replication/logical/reorderbuffer.c >>> Function: ReorderBufferInterTXNInit >>> Line: 870 >>=20 >>> The line is >>> if (txn->nentries !=3D txn->nentries_mem) >>> But shouldn't be there cur_txn instead of txn? >>=20 >> Actually, the function is ReorderBufferIterTXNInit, and in HEAD this >> is line 963, but yeah that looks pretty broken. Andres, do you >> concur? >=20 > Ugh, yes, that looks broken. In a way that can very likely lead to = wrong > data being returned :(. I assume an empty toplevel transaction + > subtransactions with spilled-to-disk contents will be bad. >=20 >=20 >> Or maybe the logic needs to be different for subtransactions? >>=20 >>> I do not know exactly the semantics of the code because I detected = the >>> problem with a CodeSonar prototype plugin. >>=20 >> Seems like a cool tool. >=20 > Indeed. What heuristic lead to detecting this? I can think of some, = but > they all owuld have significant false-positive rates. Thank you :). I cannot disclose this. The tool I develop is a CodeSonar = (www.grammatech.com) plugin. It is work in progress still under refinement. --Apple-Mail=_3C1F9887-AA44-4725-82CD-8E2470295996 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXbg8tAAoJEDfAZc7pAdfuN5cQAITC74lHFs5Y/Ok8ulx+8UfN Raf2eUwWenzVDl5p4BwiI44DrOB7+QpZRV0Qsozo8uQtVvhV3uHvXF8G/a6OtpX4 7MGtZdjVuF9CWduizqLdItxbqNl30fnUXtUjyO/1+Vo4Luii+GV4+xWq5HjJFqRc 8x2q0O8m9vuQgQ6a5CfGkl9V3lKcf/zDYLannIQWkCs5ERbZwMpNthiGdlJZj22L EDMGKYse2Im/fR5N7FDpVrhmo4PXizuTytsfHHb3TdNH40QfEAvBJtHgcVew4NnX ZwblcGla/qt77FsOahr6KAhG62k0Mn+9acYsf2l9/466GEHTQT8iDgTo2HwXqA00 GUG5WBYQGq62MLp1XmZqjEKtHKXWjf3GLBpMfMfSGVBsrtgCH7XQIaEwL4uayOoB L3foPTBTowxL2xnQMq/kIcPuqln9QJQcyov5Q/GGXdGUeUiLgMQZ5rvVhFjiTpU1 aFkgSexFnpT0fNi2737DS+9e2BujK+fkni9FtHbD5dzrpDlXPcVrtNbhnXrwzxyS yuBOFq+fWp1k56EnNQo0ewjRjz4RrgySiwiMLjW8/8f3psqGIPceJ4vo4IR0qDFs 9AopC+/tj4sUVZ5ONemzDP/8IHEszdXWQYVYe8SyUxJoX4AV6h1h6xIsa6T7ttq3 zOP1+1DPR+CWQh6rUfZC =DkC5 -----END PGP SIGNATURE----- --Apple-Mail=_3C1F9887-AA44-4725-82CD-8E2470295996--