Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1anS7w-0001td-LD for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Apr 2016 14:38:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1anS7w-0000rL-8E for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Apr 2016 14:38:44 +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 1anS7v-0000mR-2E for pgsql-hackers@postgresql.org; Tue, 05 Apr 2016 14:38:43 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1anS7q-0005Gz-I8; Tue, 05 Apr 2016 14:38:42 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [200.83.202.40]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 8466A400C06; Tue, 5 Apr 2016 07:38:30 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 028C18FA; Tue, 5 Apr 2016 11:38:28 -0300 (CLT) Date: Tue, 5 Apr 2016 11:38:27 -0300 From: Alvaro Herrera To: Simon Riggs Cc: Andres Freund , Aleksander Alekseev , Michael Paquier , pgsql-hackers , Robert Haas Subject: Re: Yet another small patch - reorderbuffer.c:1099 Message-ID: <20160405143827.GA258373@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Simon Riggs wrote: > On 5 April 2016 at 10:12, Andres Freund wrote: > > > On 2016-04-05 12:07:40 +0300, Aleksander Alekseev wrote: > > > > I recall discussing this code with Andres, and I think that he has > > > > mentioned me this is intentional, because should things be changed for > > > > a reason or another in the future, we want to keep in mind that a list > > > > of TXIDs and a list of sub-TXIDs should be handled differently. > > > > > > I see. If this it true I think there should be a comment that explains > > > it. When you read such a code you suspect a bug. Not mentioning that > > > static code analyzers (I'm currently experimenting with Clang and PVS > > > Studio) complain about code like this. > > > > There's different comments in both branches... > > Then one or both of the comments is incomplete. IMO the code is wrong. There should be a single block comment saying something like "Remove the node from its containing list. In the FOO case, the list corresponds to BAR and therefore we delete it because BAZ. In the QUUX case the list is PLUGH and we delete in because THUD." Then a single line dlist_delete(...) follows. The current arrangement looks bizantine to me, for no reason. If we think that one of the two branches might do something additional to the list deletion, surely that will be in a separate stanza with its own comment; and if we ever want to remove the list deletion from one of the two cases (something that strikes me as unlikely) then we will need to fix the comment, too. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers