OSDN Git Service

Properly change the state of parallel hints.
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Wed, 8 Feb 2017 01:34:09 +0000 (10:34 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Wed, 8 Feb 2017 01:41:40 +0000 (10:41 +0900)
The state member of parallel hint is forgotten to be chaned on usage.
This fixes it.

expected/ut-W.out
pg_hint_plan.c

index 571a0eb..8b47fb3 100644 (file)
@@ -23,8 +23,8 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1;
 EXPLAIN (COSTS false) SELECT * FROM s1.t1;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(t1 10 soft)
+not used hint:
 duplication hint:
 error hint:
 
@@ -39,8 +39,8 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM s1.t1;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(t1 10 soft)
+not used hint:
 duplication hint:
 error hint:
 
@@ -55,8 +55,8 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM s1.t1;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(t1 10 hard)
+not used hint:
 duplication hint:
 error hint:
 
@@ -72,8 +72,8 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM p1;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p1 10 soft)
+not used hint:
 duplication hint:
 error hint:
 
@@ -97,8 +97,8 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM p1;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p1 10 hard)
+not used hint:
 duplication hint:
 error hint:
 
@@ -139,8 +139,8 @@ EXPLAIN (COSTS false) SELECT * FROM p1_c1 join p2_c1 on p1_c1.id = p2_c1.id;
 EXPLAIN (COSTS false) SELECT * FROM p1_c1 join p2_c1 on p1_c1.id = p2_c1.id;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p1_c1 10 hard)
+not used hint:
 duplication hint:
 error hint:
 
@@ -165,8 +165,8 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM p1_c1 join p2_c1 on p1_c1.id = p2_c1.id;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p2_c1 10 hard)
+not used hint:
 duplication hint:
 error hint:
 
@@ -191,9 +191,9 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM p1_c1 join p2_c1 on p1_c1.id = p2_c1.id;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p1_c1 10 hard)
 Parallel(p2_c1 10 hard)
+not used hint:
 duplication hint:
 error hint:
 
@@ -221,8 +221,8 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM p1 join p2 on p1.id = p2.id;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p1 10 soft)
+not used hint:
 duplication hint:
 error hint:
 
@@ -259,8 +259,8 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM p1 join p2 on p1.id = p2.id;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p2 10 hard)
+not used hint:
 duplication hint:
 error hint:
 
@@ -297,9 +297,9 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM p1 join p2 on p1.id = p2.id;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p1 5 hard)
 Parallel(p2 10 hard)
+not used hint:
 duplication hint:
 error hint:
 
@@ -357,8 +357,8 @@ EXPLAIN (COSTS false) SELECT * FROM p1;
 EXPLAIN (COSTS false) SELECT * FROM p1;
 LOG:  pg_hint_plan:
 used hint:
-not used hint:
 Parallel(p1 0 hard)
+not used hint:
 duplication hint:
 error hint:
 
index 1ed9d65..9e0d15c 100644 (file)
@@ -2531,8 +2531,11 @@ static void
 setup_parallel_plan_enfocement(ParallelHint *hint, HintState *state)
 {
        if (hint)
+       {
+               hint->base.state = HINT_STATE_USED;
                set_config_int32_option("max_parallel_workers_per_gather",
                                                                hint->nworkers, state->context);
+       }
        else
                set_config_int32_option("max_parallel_workers_per_gather",
                                                                state->init_nworkers, state->context);