postgres.git / summary / log / commit / refs

commit    2b6df05461cb540d8f103dfe55f38efc09b4189b
Author:   Amit Kapila <akapila@postgresql.org>
Date:     Sat Jan 07 06:47:14 2023 +0000
First released in: 16.0, 14.7, 15.2

    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


src/backend/replication/logical/reorderbuffer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index f284fc2e304..29a018c58af 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2936,6 +2936,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); } [parent: a14a5832923e]