0001-Drop-the-tuple-slot-when-no-longer-needed.patch
application/octet-stream
Filename: 0001-Drop-the-tuple-slot-when-no-longer-needed.patch
Type: application/octet-stream
Part: 0
Patch
Format: format-patch
Series: patch 0001
Subject: Drop the tuple slot when no longer needed
| File | + | − |
|---|---|---|
| src/backend/replication/pgoutput/pgoutput.c | 13 | 0 |
From 9a5cee68d380e18615a784a20ba7779cffc99571 Mon Sep 17 00:00:00 2001
From: Hou Zhijie <houzj.fnst@cn.fujitsu.com>
Date: Tue, 25 Jun 2024 19:30:07 +0800
Subject: [PATCH] Drop the tuple slot when no longer needed
In pgoutput, when converting the child table's tuple format to match the
parent table's, we temporarily create a new slot to store the converted
tuple. However, we missed to drop such temp slots, leading to resource
accumulation and causing the walsender to hang.
This commit fix the issue by dropping the temp slots in each cycle.
---
src/backend/replication/pgoutput/pgoutput.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index d2b35cfb96..b8fa90e09b 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -1554,6 +1554,19 @@ cleanup:
ancestor = NULL;
}
+ /*
+ * If the tuple was converted, drop the new slot that was used to
+ * store the converted tuple.
+ */
+ if (relentry->attrmap)
+ {
+ if (old_slot)
+ ExecDropSingleTupleTableSlot(old_slot);
+
+ if (new_slot)
+ ExecDropSingleTupleTableSlot(new_slot);
+ }
+
MemoryContextSwitchTo(old);
MemoryContextReset(data->context);
}
--
2.30.0.windows.2