diff options
author | Noah Misch <noah@leadboat.com> | 2024-09-17 19:53:11 -0700 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2024-09-17 19:54:26 -0700 |
commit | 5c698e8987dbaf1d5079f451f1379abed3725c0c (patch) | |
tree | c04d5c848ad99c058b3dd01831e0117347cd95a6 /src/backend/optimizer/plan/planner.c | |
parent | b36ee879c54cf42f21c9374aceb5baf65efecbc3 (diff) | |
download | postgresql-5c698e8987dbaf1d5079f451f1379abed3725c0c.tar.gz postgresql-5c698e8987dbaf1d5079f451f1379abed3725c0c.zip |
Don't enter parallel mode when holding interrupts.
Doing so caused the leader to hang in wait_event=ParallelFinish, which
required an immediate shutdown to resolve. Back-patch to v12 (all
supported versions).
Francesco Degrassi
Discussion: https://postgr.es/m/CAC-SaSzHUKT=vZJ8MPxYdC_URPfax+yoA1hKTcF4ROz_Q6z0_Q@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r-- | src/backend/optimizer/plan/planner.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 5da863d85de..17c82b376f4 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -327,6 +327,11 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions, * if we want to allow parallel inserts in general; updates and deletes * have additional problems especially around combo CIDs.) * + * We don't try to use parallel mode unless interruptible. The leader + * expects ProcessInterrupts() calls to reach HandleParallelMessages(). + * Even if we called HandleParallelMessages() another way, starting a + * parallel worker is too delay-prone to be prudent when uncancellable. + * * For now, we don't try to use parallel mode if we're running inside a * parallel worker. We might eventually be able to relax this * restriction, but for now it seems best not to have parallel workers @@ -337,6 +342,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions, parse->commandType == CMD_SELECT && !parse->hasModifyingCTE && max_parallel_workers_per_gather > 0 && + INTERRUPTS_CAN_BE_PROCESSED() && !IsParallelWorker()) { /* all the cheap tests pass, so scan the query tree */ |