OSDN Git Service

Make core.c to the right version.
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Thu, 27 Jul 2017 09:06:59 +0000 (18:06 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Thu, 27 Jul 2017 10:20:31 +0000 (19:20 +0900)
core.c in 9e5b1753d00cb1071eb44570d3c7f9e18823ba67 seems to be
somewhat different version. Fixed it to right version.

core.c
pg_hint_plan.c

diff --git a/core.c b/core.c
index 91fbe62..14f7576 100644 (file)
--- a/core.c
+++ b/core.c
@@ -637,26 +637,6 @@ create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel)
 {
        int                     parallel_workers;
 
-       parallel_workers = compute_parallel_worker(rel, rel->pages);
-
-       /* If any limit was set to zero, the user doesn't want a parallel scan. */
-       if (parallel_workers <= 0)
-               return;
-
-       /* Add an unordered partial path based on a parallel sequential scan. */
-       add_partial_path(rel, create_seqscan_path(root, rel, NULL, parallel_workers));
-}
-
-/*
- * Compute the number of parallel workers that should be used to scan a
- * relation.  "pages" is the number of pages from the relation that we
- * expect to scan.
- */
-static int
-compute_parallel_worker(RelOptInfo *rel, BlockNumber pages)
-{
-       int                     parallel_workers;
-
        /*
         * If the user has set the parallel_workers reloption, use that; otherwise
         * select a default number of workers.
@@ -674,9 +654,9 @@ compute_parallel_worker(RelOptInfo *rel, BlockNumber pages)
                 * might not be worthwhile just for this relation, but when combined
                 * with all of its inheritance siblings it may well pay off.
                 */
-               if (pages < (BlockNumber) min_parallel_relation_size &&
+               if (rel->pages < (BlockNumber) min_parallel_relation_size &&
                        rel->reloptkind == RELOPT_BASEREL)
-                       return 0;
+                       return;
 
                /*
                 * Select the number of workers based on the log of the size of the
@@ -687,7 +667,7 @@ compute_parallel_worker(RelOptInfo *rel, BlockNumber pages)
                 */
                parallel_workers = 1;
                parallel_threshold = Max(min_parallel_relation_size, 1);
-               while (pages >= (BlockNumber) (parallel_threshold * 3))
+               while (rel->pages >= (BlockNumber) (parallel_threshold * 3))
                {
                        parallel_workers++;
                        parallel_threshold *= 3;
@@ -701,9 +681,13 @@ compute_parallel_worker(RelOptInfo *rel, BlockNumber pages)
         */
        parallel_workers = Min(parallel_workers, max_parallel_workers_per_gather);
 
-       return parallel_workers;
-}
+       /* If any limit was set to zero, the user doesn't want a parallel scan. */
+       if (parallel_workers <= 0)
+               return;
 
+       /* Add an unordered partial path based on a parallel sequential scan. */
+       add_partial_path(rel, create_seqscan_path(root, rel, NULL, parallel_workers));
+}
 
 /*
  * join_search_one_level
index e3966d7..1fe1cbb 100644 (file)
@@ -454,7 +454,6 @@ void pg_hint_plan_set_rel_pathlist(PlannerInfo * root, RelOptInfo *rel,
                                                                   Index rti, RangeTblEntry *rte);
 static void create_plain_partial_paths(PlannerInfo *root,
                                                                                                        RelOptInfo *rel);
-static int compute_parallel_worker(RelOptInfo *rel, BlockNumber pages);
 
 static void make_rels_by_clause_joins(PlannerInfo *root, RelOptInfo *old_rel,
                                                                          ListCell *other_rels);