pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aleksander Alekseev <a.alekseev@postgrespro.ru>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Robert Haas <rhaas@postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Subject: Yet another small patch - reorderbuffer.c:1099
Date: Mon, 4 Apr 2016 19:03:45 +0300
Message-ID: <20160404190345.54d84ee8@fujitsu> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

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/

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

reorderbuffer.diff (text/x-patch, 710B) download 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,

view thread (11+ messages)  latest in thread

Message-ID: <20160404190345.54d84ee8@fujitsu>
Permalink:  ../20160404190345.54d84ee8@fujitsu/
Also on:    postgresql.org/message-id/20160404190345.54d84ee8@fujitsu

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: a.alekseev@postgrespro.ru, rhaas@postgresql.org, andres@anarazel.de
  Subject: Re: Yet another small patch - reorderbuffer.c:1099
  In-Reply-To: <20160404190345.54d84ee8@fujitsu>
  References: <20160404190345.54d84ee8@fujitsu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox