0004-Fix-for-Table-sync-worker-sending-the-feedback-even-.patch
text/x-patch
Filename: 0004-Fix-for-Table-sync-worker-sending-the-feedback-even-.patch
Type: text/x-patch
Part: 3
Patch
Format: format-patch
Series: patch 0004
Subject: Fix for Table sync worker sending the feedback even after the streaming is ended.
| File | + | − |
|---|---|---|
| src/backend/replication/logical/worker.c | 2 | 1 |
From 2c5223f7eb24798b1da0f5a080fe9c9038a250b5 Mon Sep 17 00:00:00 2001
From: Vignesh C <vignesh21@gmail.com>
Date: Mon, 31 Jul 2023 22:05:34 +0530
Subject: [PATCH] Fix for Table sync worker sending the feedback even after the
streaming is ended.
In the case when the tablesync worker has to apply the transactions
after the table is synced, the tablesync worker sends the feedback of
writepos, applypos and flushpos which results in "No copy in progress" error
as the stream was ended already. Fixed it by exiting the streaming loop
if the tablesync worker is done with the synchronization.
---
src/backend/replication/logical/worker.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index d25bf5bea2..23ed4adfa4 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -3634,7 +3634,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
if (MyLogicalRepWorker->relsync_completed)
{
endofstream = true;
- break;
+ goto streaming_done;
}
}
@@ -3669,6 +3669,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
endofstream = true;
}
+streaming_done:
/* Cleanup the memory. */
MemoryContextResetAndDeleteChildren(ApplyMessageContext);
MemoryContextSwitchTo(TopMemoryContext);
--
2.34.1