aboutsummaryrefslogtreecommitdiff
path: root/src/include/replication/reorderbuffer.h
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2017-06-18 18:48:22 -0700
committerAndres Freund <andres@anarazel.de>2017-06-18 19:13:50 -0700
commit1ba1adf772e60e9dde0e5b21b71f89609b10464c (patch)
tree04eacb4c0f72fc3d74ee3551b2d665affb859fc7 /src/include/replication/reorderbuffer.h
parent501e6f8b7875a1d7928653d0a0a01b84db6c1257 (diff)
downloadpostgresql-1ba1adf772e60e9dde0e5b21b71f89609b10464c.tar.gz
postgresql-1ba1adf772e60e9dde0e5b21b71f89609b10464c.zip
Fix leaking of small spilled subtransactions during logical decoding.
When, during logical decoding, a transaction gets too big, it's contents get spilled to disk. Not just the top-transaction gets spilled, but *also* all of its subtransactions, even if they're not that large themselves. Unfortunately we didn't clean up such small spilled subtransactions from disk. Fix that, by keeping better track of whether a transaction has been spilled to disk. Author: Andres Freund Reported-By: Dmitriy Sarafannikov, Fabrízio de Royes Mello Discussion: https://postgr.es/m/1457621358.355011041@f382.i.mail.ru https://postgr.es/m/CAFcNs+qNMhNYii4nxpO6gqsndiyxNDYV0S=JNq0v_sEE+9PHXg@mail.gmail.com Backpatch: 9.4-, where logical decoding was introduced
Diffstat (limited to 'src/include/replication/reorderbuffer.h')
-rw-r--r--src/include/replication/reorderbuffer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h
index fe35edf3112..b7c86614472 100644
--- a/src/include/replication/reorderbuffer.h
+++ b/src/include/replication/reorderbuffer.h
@@ -207,6 +207,15 @@ typedef struct ReorderBufferTXN
uint64 nentries_mem;
/*
+ * Has this transaction been spilled to disk? It's not always possible to
+ * deduce that fact by comparing nentries with nentries_mem, because
+ * e.g. subtransactions of a large transaction might get serialized
+ * together with the parent - if they're restored to memory they'd have
+ * nentries_mem == nentries.
+ */
+ bool serialized;
+
+ /*
* List of ReorderBufferChange structs, including new Snapshots and new
* CommandIds
*/