aboutsummaryrefslogtreecommitdiff
path: root/src/include/replication/reorderbuffer.h
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2018-01-05 12:17:10 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2018-01-05 12:17:10 -0300
commita19c262f3a013065429462c7a322eebf3f7e3771 (patch)
tree6897008983e8e844a23910662d30791aa5d4794b /src/include/replication/reorderbuffer.h
parent0dc5dfcd7a7190739247a88c1c6249c75591effd (diff)
downloadpostgresql-a19c262f3a013065429462c7a322eebf3f7e3771.tar.gz
postgresql-a19c262f3a013065429462c7a322eebf3f7e3771.zip
Fix failure to delete spill files of aborted transactions
Logical decoding's reorderbuffer.c may spill transaction files to disk when transactions are large. These are supposed to be removed when they become "too old" by xid; but file removal requires the boundary LSNs of the transaction to be known. The final_lsn is only set when we see the commit or abort record for the transaction, but nothing sets the value for transactions that crash, so the removal code misbehaves -- in assertion-enabled builds, it crashes by a failed assertion. To fix, modify the final_lsn of transactions that don't have a value set, to the LSN of the very latest change in the transaction. This causes the spilled files to be removed appropriately. Author: Atsushi Torikoshi Reviewed-by: Kyotaro HORIGUCHI, Craig Ringer, Masahiko Sawada Discussion: https://postgr.es/m/54e4e488-186b-a056-6628-50628e4e4ebc@lab.ntt.co.jp
Diffstat (limited to 'src/include/replication/reorderbuffer.h')
-rw-r--r--src/include/replication/reorderbuffer.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h
index 86effe106bd..0fcd722b767 100644
--- a/src/include/replication/reorderbuffer.h
+++ b/src/include/replication/reorderbuffer.h
@@ -168,6 +168,8 @@ typedef struct ReorderBufferTXN
* * plain abort record
* * prepared transaction abort
* * error during decoding
+ * * for a crashed transaction, the LSN of the last change, regardless of
+ * what it was.
* ----
*/
XLogRecPtr final_lsn;