summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorDavid Rowley2023-02-15 08:21:59 +0000
committerDavid Rowley2023-02-15 08:21:59 +0000
commit5352ca22e0012d48055453ca9992a9515d811291 (patch)
treeb247f2abbca2b0198280a69117a175c93fe4241b /src/backend
parent8e0e0698f12bd77da38f6863ecdbe88a63ed49dc (diff)
Rename force_parallel_mode to debug_parallel_query
force_parallel_mode is meant to be used to allow us to exercise the parallel query infrastructure to ensure that it's working as we expect. It seems some users think this GUC is for forcing the query planner into picking a parallel plan regardless of the costs. A quick look at the documentation would have made them realize that they were wrong, but the GUC is likely too conveniently named which, evidently, seems to often result in users expecting that it forces the planner into usefully parallelizing queries. Here we rename the GUC to something which casual users are less likely to mistakenly think is what they need to make their query run more quickly. For now, the old name can still be used. We'll revisit if the old name mapping can be removed once the buildfarm configs are all updated. Reviewed-by: John Naylor Discussion: https://postgr.es/m/CAApHDvrsOi92_uA7PEaHZMH-S4Xv+MGhQWA+GrP8b1kjpS1HjQ@mail.gmail.com
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/transam/parallel.c4
-rw-r--r--src/backend/commands/explain.c4
-rw-r--r--src/backend/optimizer/plan/planmain.c4
-rw-r--r--src/backend/optimizer/plan/planner.c20
-rw-r--r--src/backend/utils/misc/guc.c1
-rw-r--r--src/backend/utils/misc/guc_tables.c32
6 files changed, 34 insertions, 31 deletions
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index 9e3ec0d5d8a..b26f2a64fbc 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -1152,11 +1152,11 @@ HandleParallelMessage(ParallelContext *pcxt, int i, StringInfo msg)
* If desired, add a context line to show that this is a
* message propagated from a parallel worker. Otherwise, it
* can sometimes be confusing to understand what actually
- * happened. (We don't do this in FORCE_PARALLEL_REGRESS mode
+ * happened. (We don't do this in DEBUG_PARALLEL_REGRESS mode
* because it causes test-result instability depending on
* whether a parallel worker is actually used or not.)
*/
- if (force_parallel_mode != FORCE_PARALLEL_REGRESS)
+ if (debug_parallel_query != DEBUG_PARALLEL_REGRESS)
{
if (edata.context)
edata.context = psprintf("%s\n%s", edata.context,
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index fbbf28cf063..e57bda7b62d 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -756,8 +756,8 @@ ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc)
/*
* Sometimes we mark a Gather node as "invisible", which means that it's
* not to be displayed in EXPLAIN output. The purpose of this is to allow
- * running regression tests with force_parallel_mode=regress to get the
- * same results as running the same tests with force_parallel_mode=off.
+ * running regression tests with debug_parallel_query=regress to get the
+ * same results as running the same tests with debug_parallel_query=off.
* Such marking is currently only supported on a Gather at the top of the
* plan. We skip that node, and we must also hide per-worker detail data
* further down in the plan tree.
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index 4c17407e5df..7afd434c601 100644
--- a/src/backend/optimizer/plan/planmain.c
+++ b/src/backend/optimizer/plan/planmain.c
@@ -114,12 +114,12 @@ query_planner(PlannerInfo *root,
* Anything parallel-restricted in the query tlist will be
* dealt with later.) This is normally pretty silly, because
* a Result-only plan would never be interesting to
- * parallelize. However, if force_parallel_mode is on, then
+ * parallelize. However, if debug_parallel_query is on, then
* we want to execute the Result in a parallel worker if
* possible, so we must do this.
*/
if (root->glob->parallelModeOK &&
- force_parallel_mode != FORCE_PARALLEL_OFF)
+ debug_parallel_query != DEBUG_PARALLEL_OFF)
final_rel->consider_parallel =
is_parallel_safe(root, parse->jointree->quals);
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index db5ff6fdca4..a1873ce26d4 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -70,7 +70,7 @@
/* GUC parameters */
double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION;
-int force_parallel_mode = FORCE_PARALLEL_OFF;
+int debug_parallel_query = DEBUG_PARALLEL_OFF;
bool parallel_leader_participation = true;
/* Hook for plugins to get control in planner() */
@@ -364,12 +364,12 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
* true during plan creation if a Gather or Gather Merge plan is actually
* created (cf. create_gather_plan, create_gather_merge_plan).
*
- * However, if force_parallel_mode = on or force_parallel_mode = regress,
- * then we impose parallel mode whenever it's safe to do so, even if the
- * final plan doesn't use parallelism. It's not safe to do so if the
- * query contains anything parallel-unsafe; parallelModeOK will be false
- * in that case. Note that parallelModeOK can't change after this point.
- * Otherwise, everything in the query is either parallel-safe or
+ * However, if debug_parallel_query = on or debug_parallel_query =
+ * regress, then we impose parallel mode whenever it's safe to do so, even
+ * if the final plan doesn't use parallelism. It's not safe to do so if
+ * the query contains anything parallel-unsafe; parallelModeOK will be
+ * false in that case. Note that parallelModeOK can't change after this
+ * point. Otherwise, everything in the query is either parallel-safe or
* parallel-restricted, and in either case it should be OK to impose
* parallel-mode restrictions. If that ends up breaking something, then
* either some function the user included in the query is incorrectly
@@ -377,7 +377,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
* parallel-unsafe, or else the query planner itself has a bug.
*/
glob->parallelModeNeeded = glob->parallelModeOK &&
- (force_parallel_mode != FORCE_PARALLEL_OFF);
+ (debug_parallel_query != DEBUG_PARALLEL_OFF);
/* Determine what fraction of the plan is likely to be scanned */
if (cursorOptions & CURSOR_OPT_FAST_PLAN)
@@ -431,7 +431,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
* Optionally add a Gather node for testing purposes, provided this is
* actually a safe thing to do.
*/
- if (force_parallel_mode != FORCE_PARALLEL_OFF && top_plan->parallel_safe)
+ if (debug_parallel_query != DEBUG_PARALLEL_OFF && top_plan->parallel_safe)
{
Gather *gather = makeNode(Gather);
@@ -449,7 +449,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
gather->plan.righttree = NULL;
gather->num_workers = 1;
gather->single_copy = true;
- gather->invisible = (force_parallel_mode == FORCE_PARALLEL_REGRESS);
+ gather->invisible = (debug_parallel_query == DEBUG_PARALLEL_REGRESS);
/*
* Since this Gather has no parallel-aware descendants to signal to,
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index bc83f3577d7..51e07d55825 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -186,6 +186,7 @@ static const unit_conversion time_unit_conversion_table[] =
static const char *const map_old_guc_names[] = {
"sort_mem", "work_mem",
"vacuum_mem", "maintenance_work_mem",
+ "force_parallel_mode", "debug_parallel_query",
NULL
};
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index b46e3b8c558..43b9d926600 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -360,16 +360,16 @@ static const struct config_enum_entry recovery_prefetch_options[] = {
{NULL, 0, false}
};
-static const struct config_enum_entry force_parallel_mode_options[] = {
- {"off", FORCE_PARALLEL_OFF, false},
- {"on", FORCE_PARALLEL_ON, false},
- {"regress", FORCE_PARALLEL_REGRESS, false},
- {"true", FORCE_PARALLEL_ON, true},
- {"false", FORCE_PARALLEL_OFF, true},
- {"yes", FORCE_PARALLEL_ON, true},
- {"no", FORCE_PARALLEL_OFF, true},
- {"1", FORCE_PARALLEL_ON, true},
- {"0", FORCE_PARALLEL_OFF, true},
+static const struct config_enum_entry debug_parallel_query_options[] = {
+ {"off", DEBUG_PARALLEL_OFF, false},
+ {"on", DEBUG_PARALLEL_ON, false},
+ {"regress", DEBUG_PARALLEL_REGRESS, false},
+ {"true", DEBUG_PARALLEL_ON, true},
+ {"false", DEBUG_PARALLEL_OFF, true},
+ {"yes", DEBUG_PARALLEL_ON, true},
+ {"no", DEBUG_PARALLEL_OFF, true},
+ {"1", DEBUG_PARALLEL_ON, true},
+ {"0", DEBUG_PARALLEL_OFF, true},
{NULL, 0, false}
};
@@ -4852,13 +4852,15 @@ struct config_enum ConfigureNamesEnum[] =
},
{
- {"force_parallel_mode", PGC_USERSET, DEVELOPER_OPTIONS,
- gettext_noop("Forces use of parallel query facilities."),
- gettext_noop("If possible, run query using a parallel worker and with parallel restrictions."),
+ {"debug_parallel_query", PGC_USERSET, DEVELOPER_OPTIONS,
+ gettext_noop("Forces the planner's use parallel query nodes."),
+ gettext_noop("This can be useful for testing the parallel query infrastructure "
+ "by forcing the planner to generate plans which contains nodes "
+ "which perform tuple communication between workers and the main process."),
GUC_NOT_IN_SAMPLE | GUC_EXPLAIN
},
- &force_parallel_mode,
- FORCE_PARALLEL_OFF, force_parallel_mode_options,
+ &debug_parallel_query,
+ DEBUG_PARALLEL_OFF, debug_parallel_query_options,
NULL, NULL, NULL
},