* mark_invalid_subplans_as_finished * Marks the ParallelAppendState's pa_finished as true for each invalid * subplan. * * This function should only be called for parallel Append with run-time * pruning enabled. */
| 854 | * pruning enabled. |
| 855 | */ |
| 856 | static void |
| 857 | mark_invalid_subplans_as_finished(AppendState *node) |
| 858 | { |
| 859 | int i; |
| 860 | |
| 861 | /* Only valid to call this while in parallel Append mode */ |
| 862 | Assert(node->as_pstate); |
| 863 | |
| 864 | /* |
| 865 | * NB: In upstream, we assert node->as_prune_state to be not empty. |
| 866 | * However, after pg12 merge, we'll allow the case that |
| 867 | * as_valid_subplans and as_prune_state both be emty while |
| 868 | * node->join_prune_paramids is true. |
| 869 | * |
| 870 | * If as_valid_subplans is empty we'll call this function. And the |
| 871 | * assertion must be removed. |
| 872 | */ |
| 873 | #if 0 |
| 874 | /* Shouldn't have been called when run-time pruning is not enabled */ |
| 875 | Assert(node->as_prune_state); |
| 876 | #endif |
| 877 | |
| 878 | /* Nothing to do if all plans are valid */ |
| 879 | if (bms_num_members(node->as_valid_subplans) == node->as_nplans) |
| 880 | return; |
| 881 | |
| 882 | /* Mark all non-valid plans as finished */ |
| 883 | for (i = 0; i < node->as_nplans; i++) |
| 884 | { |
| 885 | if (!bms_is_member(i, node->as_valid_subplans)) |
| 886 | node->as_pstate->pa_finished[i] = true; |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | /* ---------------------------------------------------------------- |
| 891 | * Asynchronous Append Support |
no test coverage detected