* Choose the execution identity (who does this executor serve?). * There are types: * * 1. No-Op (ignore) -- this occurs when the specified direction is * NoMovementScanDirection or when Gp_role is GP_ROLE_DISPATCH * and the current slice belongs to a QE. * * 2. Executor serves a Root Slice -- this occurs when Gp_role is * GP_ROLE_UTILITY or the current slice is a root. It corresponds
| 1957 | * motion nodes (as in case 2). |
| 1958 | */ |
| 1959 | GpExecIdentity |
| 1960 | getGpExecIdentity(QueryDesc *queryDesc, |
| 1961 | ScanDirection direction, |
| 1962 | EState *estate) |
| 1963 | { |
| 1964 | ExecSlice *currentSlice; |
| 1965 | |
| 1966 | currentSlice = getCurrentSlice(estate, LocallyExecutingSliceIndex(estate)); |
| 1967 | if (currentSlice) |
| 1968 | { |
| 1969 | if (Gp_role == GP_ROLE_EXECUTE || |
| 1970 | sliceRunsOnQD(currentSlice)) |
| 1971 | currentSliceId = currentSlice->sliceIndex; |
| 1972 | } |
| 1973 | |
| 1974 | /* select the strategy */ |
| 1975 | if (direction == NoMovementScanDirection) |
| 1976 | { |
| 1977 | return GP_IGNORE; |
| 1978 | } |
| 1979 | else if (Gp_role == GP_ROLE_DISPATCH && sliceRunsOnQE(currentSlice)) |
| 1980 | { |
| 1981 | return GP_IGNORE; |
| 1982 | } |
| 1983 | else if (Gp_role == GP_ROLE_EXECUTE && LocallyExecutingSliceIndex(estate) != RootSliceIndex(estate)) |
| 1984 | { |
| 1985 | return GP_NON_ROOT_ON_QE; |
| 1986 | } |
| 1987 | else |
| 1988 | { |
| 1989 | return GP_ROOT_SLICE; |
| 1990 | } |
| 1991 | } |
| 1992 | |
| 1993 | /* |
| 1994 | * End the gp-specific part of the executor. |
no test coverage detected