aboutsummaryrefslogtreecommitdiff
path: root/src/include/replication/reorderbuffer.h
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2023-02-08 07:58:25 +0530
committerAmit Kapila <akapila@postgresql.org>2023-02-08 07:58:25 +0530
commit8c58624df46222d4d09c5655d8350f3b037880c8 (patch)
treebf75763c08fa8cf3495e4019d3b70dad23fe46df /src/include/replication/reorderbuffer.h
parentfee7b77b9000f35e445de9954a8cbf241f181e60 (diff)
downloadpostgresql-8c58624df46222d4d09c5655d8350f3b037880c8.tar.gz
postgresql-8c58624df46222d4d09c5655d8350f3b037880c8.zip
Fix the logical replication timeout during large DDLs.
The DDLs like Refresh Materialized views that generate lots of temporary data due to rewrite rules may not be processed by output plugins (for example pgoutput). So, we won't send keep-alive messages for a long time while processing such commands and that can lead the subscriber side to timeout. We have previously fixed a similar case for large transactions in commit f95d53eded where the output plugin filters all or most of the changes but missed to handle the DDLs. We decided not to backpatch this as this adds a new callback in the existing exposed structure and moreover, users can increase the wal_sender_timeout and wal_receiver_timeout to avoid this problem. Author: Wang wei, Hou Zhijie Reviewed-by: Peter Smith, Ashutosh Bapat, Shi yu, Amit Kapila Discussion: https://postgr.es/m/OS3PR01MB6275478E5D29E4A563302D3D9E2B9@OS3PR01MB6275.jpnprd01.prod.outlook.com Discussion: https://postgr.es/m/CAA5-nLARN7-3SLU_QUxfy510pmrYK6JJb=bk3hcgemAM_pAv+w@mail.gmail.com
Diffstat (limited to 'src/include/replication/reorderbuffer.h')
-rw-r--r--src/include/replication/reorderbuffer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h
index e5db041df18..215d1494e90 100644
--- a/src/include/replication/reorderbuffer.h
+++ b/src/include/replication/reorderbuffer.h
@@ -526,6 +526,12 @@ typedef void (*ReorderBufferStreamTruncateCB) (
Relation relations[],
ReorderBufferChange *change);
+/* update progress txn callback signature */
+typedef void (*ReorderBufferUpdateProgressTxnCB) (
+ ReorderBuffer *rb,
+ ReorderBufferTXN *txn,
+ XLogRecPtr lsn);
+
struct ReorderBuffer
{
/*
@@ -590,6 +596,12 @@ struct ReorderBuffer
ReorderBufferStreamTruncateCB stream_truncate;
/*
+ * Callback to be called when updating progress during sending data of a
+ * transaction (and its subtransactions) to the output plugin.
+ */
+ ReorderBufferUpdateProgressTxnCB update_progress_txn;
+
+ /*
* Pointer that will be passed untouched to the callbacks.
*/
void *private_data;