Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1an6zK-0005VK-EY for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2016 16:04:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1an6zJ-0002I4-TZ for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2016 16:04:25 +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 1an6zI-0002HL-RC for pgsql-hackers@postgresql.org; Mon, 04 Apr 2016 16:04:24 +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 1an6zD-0001CD-0p; Mon, 04 Apr 2016 16:04:24 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id BFEF721C7808; Mon, 4 Apr 2016 19:04:16 +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 nsDJgWsyIETp; Mon, 4 Apr 2016 19:04:15 +0300 (MSK) Received: from fujitsu (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 1792D21C7663; Mon, 4 Apr 2016 19:04:15 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1459785855; bh=jD0EZa5M8diUMC72JZi33PX4/px8J5wLm+SitfStaBs=; h=Date:From:To:Cc:Subject; b=REIk6oF4+im9OJtArOZfWJgThnIq0R3nYuNgHkiUzhqH8B51oT34apZKzvOCCRFLV rgSca7Kujq/tJygeyTxWJupSLZp1i6IM/N1nd5UTAqDqzkN+kBy5NM7FQXRDrh0Bhl Sve23ozw8KjQlaWPcSojMnNjQ3gQI+glq2vDRAAk= Date: Mon, 4 Apr 2016 19:03:45 +0300 From: Aleksander Alekseev To: pgsql-hackers Cc: Robert Haas , Andres Freund Subject: Yet another small patch - reorderbuffer.c:1099 Message-ID: <20160404190345.54d84ee8@fujitsu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/w2=nDSDFfXe.iQOweT.A3/6" 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_/w2=nDSDFfXe.iQOweT.A3/6 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello There is weired peace of code in reorderbuffer.c: ``` /* 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); } ``` As you see `if` an `else` branches are exactly the same. I wonder whether this is a bug or code just requires a bit of cleaning. In the latter case here is a patch. According to `git log` both branches were introduced in one commit b89e1510. I added author and committer of this code to CC since they have much better understanding of it than I do. -- Best regards, Aleksander Alekseev http://eax.me/ --MP_/w2=nDSDFfXe.iQOweT.A3/6 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=reorderbuffer.diff diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 9d78c8c..454b309 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -1097,16 +1097,7 @@ ReorderBufferCleanupTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) } /* 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); - } + dlist_delete(&txn->node); /* now remove reference from buffer */ hash_search(rb->by_txn, --MP_/w2=nDSDFfXe.iQOweT.A3/6 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_/w2=nDSDFfXe.iQOweT.A3/6--