On Mon, Feb 22, 2021 at 6:25 PM houzj.f...@fujitsu.com
<houzj.f...@fujitsu.com> wrote:
>
> Hi
>
> (I may be wrong here)
> I noticed that the patch does not have check for partial index(index 
> predicate).
> It seems parallel index build will check it like the following:
> ----------
>         /*
>          * Determine if it's safe to proceed.
>          *
>          * Currently, parallel workers can't access the leader's temporary 
> tables.
>          * Furthermore, any index predicate or index expressions must be 
> parallel
>          * safe.
>          */
>         if (heap->rd_rel->relpersistence == RELPERSISTENCE_TEMP ||
>                 !is_parallel_safe(root, (Node *) 
> RelationGetIndexExpressions(index)) ||
>                 !is_parallel_safe(root, (Node *) 
> RelationGetIndexPredicate(index)))
> ----------
>
> Should we do parallel safety check for it ?
>

Thanks, it looks like you're right, it is missing (and there's no test for it).
I can add a fix to the index-checking code, something like:

+        if (!found_max_hazard)
+        {
+            ii_Predicate = RelationGetIndexPredicate(index_rel);
+            if (ii_Predicate != NIL)
+            {
+                if (max_parallel_hazard_walker((Node *)ii_Predicate, context))
+                {
+                    found_max_hazard = true;
+                }
+            }
+        }

Also will need a bit of renaming of that function.
I'll include this in the next patch update.

Regards,
Greg Nancarrow
Fujitsu Australia


Reply via email to