Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGDUo-0000LK-IT for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Jun 2016 22:53:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bGDUn-0003NA-Mn for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Jun 2016 22:53:13 +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 1bGDUl-0003MZ-OX for pgsql-bugs@postgresql.org; Thu, 23 Jun 2016 22:53:11 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bGDUi-0000Jl-56 for pgsql-bugs@postgresql.org; Thu, 23 Jun 2016 22:53:11 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id AFB3920367; Thu, 23 Jun 2016 18:53:04 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 23 Jun 2016 18:53:04 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=3vg41EbX39Sax6cFN5xKy+tjFVM=; b=NjIe2 U5eiYjb/8LIbavqk8uTfxzQ22fVYesoSMyMfoPXj8FYNuPK7B/dZPn0FXVRNuV/J x+5V+2CrSGoT7fIOvwrgCAnsSQcWtLbPD8i31+bAEUO2a0hv6RSSLzqggKTn2S6c Nq6W0xZUYsjPkx6Ij0JSY/XPswIJUVvW6EITx8= X-Sasl-enc: 0jNHruLrBtmoe6WHaJDVi0Xu582RT0EJmwXAx5A5JHoX 1466722384 Received: from intern.anarazel.de (unknown [208.71.159.84]) by mail.messagingengine.com (Postfix) with ESMTPA id 22CD9F2022; Thu, 23 Jun 2016 18:53:04 -0400 (EDT) Date: Thu, 23 Jun 2016 15:53:01 -0700 From: Andres Freund To: Tom Lane Cc: petrum@gmail.com, pgsql-bugs@postgresql.org Subject: Re: BUG #14208: Inconsistent code modification - 3 Message-ID: <20160623225301.4v7heuiyvkfwi5ev@alap3.anarazel.de> References: <20160622144830.5791.22512@wrigleys.postgresql.org> <31897.1466610316@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31897.1466610316@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) 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 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 > > > The line is > > if (txn->nentries != txn->nentries_mem) > > But shouldn't be there cur_txn instead of txn? > > Actually, the function is ReorderBufferIterTXNInit, and in HEAD this > is line 963, but yeah that looks pretty broken. Andres, do you > concur? 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. > Or maybe the logic needs to be different for subtransactions? > > > I do not know exactly the semantics of the code because I detected the > > problem with a CodeSonar prototype plugin. > > Seems like a cool tool. Indeed. What heuristic lead to detecting this? I can think of some, but they all owuld have significant false-positive rates. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs