Avoid creating parallel apply state hash table unless required.
authorAmit Kapila <akapila@postgresql.org>
Fri, 13 Jan 2023 02:58:05 +0000 (08:28 +0530)
committerAmit Kapila <akapila@postgresql.org>
Fri, 13 Jan 2023 02:58:05 +0000 (08:28 +0530)
commitdca8b01f5f1f7c83c59a16393724fbd8a29ddecb
tree1acb6a3685042dd6131c6ebf8b171189422c6ea0
parente753ae6397fe16db8e8e5b3e34ca6d53b4eded61
Avoid creating parallel apply state hash table unless required.

This hash table is used to cache the state of streaming transactions being
applied by the parallel apply workers. So, this should be created only
when we are successful in launching at least one worker. This avoids rare
case memory leak when we are never able to launch any worker.

Author: Ted Yu
Discussion: https://postgr.es/m/CALte62wg0rBR3Vj2beV=HiWo2qG9L0hzKcX=yULNER0wmf4aEw@mail.gmail.com
src/backend/replication/logical/applyparallelworker.c