aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/reorderbuffer.c
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2023-01-07 12:04:33 +0530
committerAmit Kapila <akapila@postgresql.org>2023-01-07 12:04:33 +0530
commit18b81258ab60cdd172329fe80dd2314d587bd551 (patch)
tree0c05dfa1d67c5fa476ae1e67732f6496f16b4dad /src/backend/replication/logical/reorderbuffer.c
parent2daf4664ce5402e4bd5bda24bf52716137336ad2 (diff)
downloadpostgresql-18b81258ab60cdd172329fe80dd2314d587bd551.tar.gz
postgresql-18b81258ab60cdd172329fe80dd2314d587bd551.zip
Remove the streaming files for incomplete xacts after restart.
After restart, we try to stream the changes for large transactions that were not sent before server crash and restart. However, we forget to send the abort message for such transactions. This leads to spurious streaming files on the subscriber which won't be cleaned till the apply worker or the subscriber server restarts. Reported-by: Dilip Kumar Author: Hou Zhijie Reviewed-by: Dilip Kumar and Amit Kapila Backpatch-through: 14 Discussion: https://postgr.es/m/OS0PR01MB5716A773F46768A1B75BE24394FB9@OS0PR01MB5716.jpnprd01.prod.outlook.com
Diffstat (limited to 'src/backend/replication/logical/reorderbuffer.c')
-rw-r--r--src/backend/replication/logical/reorderbuffer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index c07d25903cd..e3b67e4447a 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -2905,6 +2905,10 @@ ReorderBufferAbortOld(ReorderBuffer *rb, TransactionId oldestRunningXid)
{
elog(DEBUG2, "aborting old transaction %u", txn->xid);
+ /* Notify the remote node about the crash/immediate restart. */
+ if (rbtxn_is_streamed(txn))
+ rb->stream_abort(rb, txn, InvalidXLogRecPtr);
+
/* remove potential on-disk data, and deallocate this tx */
ReorderBufferCleanupTXN(rb, txn);
}