mirror of
https://github.com/postgres/postgres.git
synced 2026-05-28 04:35:45 -04:00
Fix mistakes in commit 4020b370f2
cost_tidrangescan() was setting the disabled_nodes value correctly, and then immediately resetting it to zero, due to poor code editing on my part. materialized_finished_plan correctly set matpath.parent to zero, but forgot to also set matpath.parallel_workers = 0, causing an access to uninitialized memory in cost_material. (This shouldn't result in any real problem, but it makes valgrind unhappy.) reparameterize_path was dereferencing a variable before verifying that it was not NULL. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> (issue #1) Reported-by: Michael Paquier <michael@paquier.xyz> (issue #1) Diagnosed-by: Lukas Fittl <lukas@fittl.com> (issue #1) Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> (issue #2) Reported-by: Richard Guo <guofenglinux@gmail.com> (issue #3) Discussion: http://postgr.es/m/CAN4CZFPvwjNJEZ_JT9Y67yR7C=KMNa=LNefOB8ZY7TKDcmAXOA@mail.gmail.com Discussion: http://postgr.es/m/aXrnPgrq6Gggb5TG@paquier.xyz
This commit is contained in:
parent
20a8f783e1
commit
71c1136989
3 changed files with 6 additions and 4 deletions
|
|
@ -1461,7 +1461,6 @@ cost_tidrangescan(Path *path, PlannerInfo *root,
|
|||
enable_mask |= PGS_CONSIDER_NONPARTIAL;
|
||||
path->disabled_nodes =
|
||||
(baserel->pgs_mask & enable_mask) != enable_mask ? 1 : 0;
|
||||
path->disabled_nodes = 0;
|
||||
path->startup_cost = startup_cost;
|
||||
path->total_cost = startup_cost + cpu_run_cost + disk_run_cost;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6526,8 +6526,11 @@ materialize_finished_plan(Plan *subplan)
|
|||
subplan->startup_cost -= initplan_cost;
|
||||
subplan->total_cost -= initplan_cost;
|
||||
|
||||
/* Set cost data */
|
||||
/* Clear fields that cost_material() will consult */
|
||||
matpath.parallel_workers = 0;
|
||||
matpath.parent = NULL;
|
||||
|
||||
/* Set cost data */
|
||||
cost_material(&matpath,
|
||||
enable_material,
|
||||
subplan->disabled_nodes,
|
||||
|
|
|
|||
|
|
@ -3971,10 +3971,10 @@ reparameterize_path(PlannerInfo *root, Path *path,
|
|||
spath = reparameterize_path(root, spath,
|
||||
required_outer,
|
||||
loop_count);
|
||||
enabled =
|
||||
(mpath->path.disabled_nodes <= spath->disabled_nodes);
|
||||
if (spath == NULL)
|
||||
return NULL;
|
||||
enabled =
|
||||
(mpath->path.disabled_nodes <= spath->disabled_nodes);
|
||||
return (Path *) create_material_path(rel, spath, enabled);
|
||||
}
|
||||
case T_Memoize:
|
||||
|
|
|
|||
Loading…
Reference in a new issue