Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea792bf

Browse files
committed
Fix memory leak in pgoutput for the WAL sender
RelationSyncCache, the hash table in charge of tracking the relationschemas sent through pgoutput, was forgetting to free the TupleDescassociated to the two slots used to store the new and old tuples,causing some memory to be leaked each time a relation is invalidatedwhen the slots of an existing relation entry are cleaned up.This is rather hard to notice as the bloat is pretty minimal, but along-running WAL sender would be in trouble over time depending on theworkload. sysbench has proved to be pretty good at showing the problem,coupled with some memory monitoring of the WAL sender.Issue introduced in52e4f0c, that has added row filters for tableslogically replicated.Author: Boyu YangReviewed-by: Michael Paquier, Hou ZhijieDiscussion:https://postgr.es/m/DM3PR84MB3442E14B340E553313B5C816E3252@DM3PR84MB3442.NAMPRD84.PROD.OUTLOOK.COMBackpatch-through: 15
1 parentf95da9f commitea792bf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎src/backend/replication/pgoutput/pgoutput.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,10 +2095,34 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
20952095
* Tuple slots cleanups. (Will be rebuilt later if needed).
20962096
*/
20972097
if (entry->old_slot)
2098+
{
2099+
TupleDescdesc=entry->old_slot->tts_tupleDescriptor;
2100+
2101+
Assert(desc->tdrefcount==-1);
2102+
20982103
ExecDropSingleTupleTableSlot(entry->old_slot);
2104+
2105+
/*
2106+
* ExecDropSingleTupleTableSlot() would not free the TupleDesc, so
2107+
* do it now to avoid any leaks.
2108+
*/
2109+
FreeTupleDesc(desc);
2110+
}
20992111
if (entry->new_slot)
2112+
{
2113+
TupleDescdesc=entry->new_slot->tts_tupleDescriptor;
2114+
2115+
Assert(desc->tdrefcount==-1);
2116+
21002117
ExecDropSingleTupleTableSlot(entry->new_slot);
21012118

2119+
/*
2120+
* ExecDropSingleTupleTableSlot() would not free the TupleDesc, so
2121+
* do it now to avoid any leaks.
2122+
*/
2123+
FreeTupleDesc(desc);
2124+
}
2125+
21022126
entry->old_slot=NULL;
21032127
entry->new_slot=NULL;
21042128

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp