]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Release postmaster working memory context in slotsync worker
authorFujii Masao <fujii@postgresql.org>
Mon, 6 Apr 2026 14:04:18 +0000 (23:04 +0900)
committerFujii Masao <fujii@postgresql.org>
Mon, 6 Apr 2026 14:04:18 +0000 (23:04 +0900)
Child processes do not need the postmaster's working memory context and
normally release it at the start of their main entry point. However,
the slotsync worker forgot to do so.

This commit makes the slotsync worker release the postmaster's working
memory context at startup, preventing unintended use.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tiancheng Ge <getiancheng_2012@163.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwHO05JaUpgKF8FBDmPdBUJsK22axRRcgmAUc2Jyi8OK8g@mail.gmail.com

src/backend/replication/logical/slotsync.c

index d615ff8a81c89a814879504afe76e0d83e607071..8b53bd3ac7f948b098431149e8275bbdc5d7f006 100644 (file)
@@ -1494,6 +1494,13 @@ ReplSlotSyncWorkerMain(const void *startup_data, size_t startup_data_len)
 
        Assert(startup_data_len == 0);
 
+       /* Release postmaster's working memory context */
+       if (PostmasterContext)
+       {
+               MemoryContextDelete(PostmasterContext);
+               PostmasterContext = NULL;
+       }
+
        init_ps_display(NULL);
 
        Assert(GetProcessingMode() == InitProcessing);