Fall back to serializing when parallel apply runs out of DSM segments.

Commit 216a784829c made the leader apply worker serialize a streamed
transaction to a file if it fails to set up the shared memory for a
parallel apply worker. However, it called dsm_create() without
DSM_CREATE_NULL_IF_MAXSEGMENTS, so running out of DSM segments raised
an ERROR instead. The leader apply worker then exited and failed again
at the same STREAM START after restarting, so replication made no
progress until segments were freed.

Fix by passing DSM_CREATE_NULL_IF_MAXSEGMENTS, as parallel query does.

Backpatch to v16, where parallel apply was introduced.

Author: Baji Shaik <[email protected]>
Reviewed-by: Zhijie Hou <[email protected]>
Reviewed-by: Bharath Rupireddy <[email protected]>
Reviewed-by: Masahiko Sawada <[email protected]>
Discussion: 
https://postgr.es/m/ca+fm-rmyb6eomuk+a4_hzou9cdthfb6mj1uv-7yb_yutwlu...@mail.gmail.com
Backpatch-through: 16

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5aafc5cb6ee2747cf76fa60804ca248c833039f4

Modified Files
--------------
src/backend/replication/logical/applyparallelworker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Reply via email to