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

Commitafe9b0d

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 parent7eff313 commitafe9b0d

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
@@ -2055,10 +2055,34 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
20552055
* Tuple slots cleanups. (Will be rebuilt later if needed).
20562056
*/
20572057
if (entry->old_slot)
2058+
{
2059+
TupleDescdesc=entry->old_slot->tts_tupleDescriptor;
2060+
2061+
Assert(desc->tdrefcount==-1);
2062+
20582063
ExecDropSingleTupleTableSlot(entry->old_slot);
2064+
2065+
/*
2066+
* ExecDropSingleTupleTableSlot() would not free the TupleDesc, so
2067+
* do it now to avoid any leaks.
2068+
*/
2069+
FreeTupleDesc(desc);
2070+
}
20592071
if (entry->new_slot)
2072+
{
2073+
TupleDescdesc=entry->new_slot->tts_tupleDescriptor;
2074+
2075+
Assert(desc->tdrefcount==-1);
2076+
20602077
ExecDropSingleTupleTableSlot(entry->new_slot);
20612078

2079+
/*
2080+
* ExecDropSingleTupleTableSlot() would not free the TupleDesc, so
2081+
* do it now to avoid any leaks.
2082+
*/
2083+
FreeTupleDesc(desc);
2084+
}
2085+
20622086
entry->old_slot=NULL;
20632087
entry->new_slot=NULL;
20642088

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp