Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ankP0-0003NO-Po for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Apr 2016 10:09:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ankP0-00033i-CV for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Apr 2016 10:09:34 +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 1ankNf-0001ZN-2y for pgsql-hackers@postgresql.org; Wed, 06 Apr 2016 10:08:11 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ankNZ-0005tV-LR for pgsql-hackers@postgresql.org; Wed, 06 Apr 2016 10:08:10 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 2A43F21C78CE; Wed, 6 Apr 2016 13:08:05 +0300 (MSK) Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L_ZorTwdKuH2; Wed, 6 Apr 2016 13:08:03 +0300 (MSK) Received: from fujitsu (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 1EA3221C78A0; Wed, 6 Apr 2016 13:08:03 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1459937283; bh=pWVru7h52hb/u7JZA/kX3AO7Ds/y0Wk2kABNfvqC/Xk=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=e8Yf8Y0dTHeYHMmC+3u4RBrsiIP4uFRs6HUlLhrjWborKfhk9AkRIg5Xx/5s33D5Y /FTEwvRqyD/MBe52OSnJFo3dCsJD7mthMzV5eAFqx6HUoQ99vhtdou6tvTUIYE0sfZ kPX2e6vYJvboqWf12y+WB6MqUQGm6L47s9CY3Qa0= Date: Wed, 6 Apr 2016 13:07:33 +0300 From: Aleksander Alekseev To: Robert Haas Cc: Alvaro Herrera , Simon Riggs , Andres Freund , Michael Paquier , pgsql-hackers Subject: Re: Yet another small patch - reorderbuffer.c:1099 Message-ID: <20160406130733.686c2764@fujitsu> In-Reply-To: References: <20160405143827.GA258373@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/IvvTstjSTPzJEN.cTXSSWux" X-Pg-Spam-Score: -3.0 (---) 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 --MP_/IvvTstjSTPzJEN.cTXSSWux Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline > > 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. > > +1 to everything here except for the way byzantine is spelled. > +1 and yet another patch. -- Best regards, Aleksander Alekseev http://eax.me/ --MP_/IvvTstjSTPzJEN.cTXSSWux Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=reorderbuffer-v2.diff diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 52c6986..360e6fd 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -1159,17 +1159,17 @@ ReorderBufferCleanupTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) txn->base_snapshot_lsn = InvalidXLogRecPtr; } - /* delete from list of known subxacts */ - if (txn->is_known_as_subxact) - { - /* NB: nsubxacts count of parent will be too high now */ - dlist_delete(&txn->node); - } - /* delete from LSN ordered list of toplevel TXNs */ - else - { - dlist_delete(&txn->node); - } + /* + * Remove TXN from its containing list. Note that following line covers + * two cases. + * + * If TXN is a subxact we delete it from list of known subxacts. NB: + * nsubxacts count of parent becomes too high in this case. + * + * Otherwise we delete TXN from ordered list of toplevel TXNs. + * + */ + dlist_delete(&txn->node); /* now remove reference from buffer */ hash_search(rb->by_txn, --MP_/IvvTstjSTPzJEN.cTXSSWux Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --MP_/IvvTstjSTPzJEN.cTXSSWux--