aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-09-04 20:49:44 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-09-04 20:49:44 -0400
commitb6182081be4a795d70b966be2542ad32d1ffbc20 (patch)
treee8d014d7d199eb5f00db29447098d922ebdc07b1
parentc7f68bea22bf680a4eab4b8b1592b3c90bc634ac (diff)
downloadpostgresql-b6182081be4a795d70b966be2542ad32d1ffbc20.tar.gz
postgresql-b6182081be4a795d70b966be2542ad32d1ffbc20.zip
Remove duplicate code from ReorderBufferCleanupTXN().
Andres is apparently the only hacker who thinks this code is better as-is. I (tgl) follow some of his logic, but the fact that it's setting off warnings from static code analyzers seems like a sufficient reason to put the complexity into a comment rather than the code. Aleksander Alekseev Discussion: <20160404190345.54d84ee8@fujitsu>
-rw-r--r--src/backend/replication/logical/reorderbuffer.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 43b584cf7e2..9b430b9acb5 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -1158,17 +1158,15 @@ 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: if txn->is_known_as_subxact, we are deleting the TXN from its
+ * parent's list of known subxacts; this leaves the parent's nsubxacts
+ * count too high, but we don't care. Otherwise, we are deleting the TXN
+ * from the LSN-ordered list of toplevel TXNs.
+ */
+ dlist_delete(&txn->node);
/* now remove reference from buffer */
hash_search(rb->by_txn,