Please sign in to comment.
Fix motion hazard between outer and joinqual
A motion hazard is a deadlock between motions, a classic motion hazard in a join executor is formed by its inner and outer motions, it can be prevented by prefetching the inner plan, refer to motion_sanity_check() for details. A similar motion hazard can be formed by the outer motion and the join qual motion. A join executor fetches a outer tuple, filters it with the join qual, then repeat the process on all the outer tuples. When there are motions in both outer plan and the join qual then below state is possible: 0. processes A and B belong to the join slice, process C belongs to the outer slice, process D belongs to the JoinQual slice; 1. A has read the first outer tuple and is fetching tuples from D; 2. D is waiting for ACK from B; 3. B is fetching the first outer tuple from C; 4. C is waiting for ACK from A; So a deadlock is formed A->D->B->C->A. We can prevent it also by prefetching the join qual. Reviewed-by: Jesse Zhang <firstname.lastname@example.org> Reviewed-by: Gang Xiong <email@example.com> Reviewed-by: Zhenghua Lyu <firstname.lastname@example.org> (cherry picked from commit fa762b6)
- Loading branch information...
Showing with 369 additions and 0 deletions.
- +81 −0 src/backend/executor/execUtils.c
- +9 −0 src/backend/executor/nodeHashjoin.c
- +9 −0 src/backend/executor/nodeMergejoin.c
- +9 −0 src/backend/executor/nodeNestloop.c
- +1 −0 src/backend/nodes/copyfuncs.c
- +1 −0 src/backend/nodes/outfuncs.c
- +1 −0 src/backend/nodes/readfast.c
- +55 −0 src/backend/optimizer/plan/createplan.c
- +3 −0 src/include/executor/executor.h
- +3 −0 src/include/nodes/execnodes.h
- +1 −0 src/include/nodes/plannodes.h
- +98 −0 src/test/regress/expected/deadlock2.out
- +1 −0 src/test/regress/greenplum_schedule
- +97 −0 src/test/regress/sql/deadlock2.sql
Oops, something went wrong.