From c53664b0443cbd80b0a0d8e1f04516361edbcc87 Mon Sep 17 00:00:00 2001 From: wangw Date: Thu, 20 Jan 2022 13:24:18 +0800 Subject: [PATCH] Send keepalive. --- src/backend/replication/pgoutput/pgoutput.c | 9 +++++++++ src/backend/replication/walsender.c | 1 + 2 files changed, 10 insertions(+) diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index af8d51aee9..30dc4192cf 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -654,15 +654,24 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, { case REORDER_BUFFER_CHANGE_INSERT: if (!relentry->pubactions.pubinsert) + { + OutputPluginUpdateProgress(ctx); return; + } break; case REORDER_BUFFER_CHANGE_UPDATE: if (!relentry->pubactions.pubupdate) + { + OutputPluginUpdateProgress(ctx); return; + } break; case REORDER_BUFFER_CHANGE_DELETE: if (!relentry->pubactions.pubdelete) + { + OutputPluginUpdateProgress(ctx); return; + } break; default: Assert(false); diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 4cf95ce439..39f985ddf3 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -1453,6 +1453,7 @@ WalSndUpdateProgress(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId static TimestampTz sendTime = 0; TimestampTz now = GetCurrentTimestamp(); + WalSndKeepaliveIfNecessary(); /* * Track lag no more than once per WALSND_LOGICAL_LAG_TRACK_INTERVAL_MS to * avoid flooding the lag tracker when we commit frequently. -- 2.18.4