* Function AssignGangs runs on the QD and finishes construction of the * global slice table for a plan by assigning gangs allocated by the * executor factory to the slices of the slice table. * * On entry, the executor slice table (at queryDesc->estate->es_sliceTable) * has been initialized and has correct (by InitSliceTable function) * * Gang assignment involves taking an inventory of the
| 1821 | * slice in the slice table. |
| 1822 | */ |
| 1823 | void |
| 1824 | AssignGangs(CdbDispatcherState *ds, QueryDesc *queryDesc) |
| 1825 | { |
| 1826 | SliceTable *sliceTable; |
| 1827 | EState *estate; |
| 1828 | int rootIdx; |
| 1829 | |
| 1830 | estate = queryDesc->estate; |
| 1831 | sliceTable = estate->es_sliceTable; |
| 1832 | rootIdx = RootSliceIndex(queryDesc->estate); |
| 1833 | |
| 1834 | /* cleanup processMap because initPlan and main Plan share the same slice table */ |
| 1835 | for (int i = 0; i < sliceTable->numSlices; i++) |
| 1836 | sliceTable->slices[i].processesMap = NULL; |
| 1837 | |
| 1838 | AssignWriterGangFirst(ds, sliceTable, rootIdx); |
| 1839 | InventorySliceTree(ds, sliceTable, rootIdx); |
| 1840 | } |
| 1841 | |
| 1842 | /* |
| 1843 | * AssignWriterGangFirst() - Try to assign writer gang first. |
no test coverage detected