* Helper for AssignGangs takes a simple inventory of the gangs required * by a slice tree. Recursive. Closely coupled with AssignGangs. Not * generally useful. */
| 1909 | * generally useful. |
| 1910 | */ |
| 1911 | static void |
| 1912 | InventorySliceTree(CdbDispatcherState *ds, SliceTable *sliceTable, int sliceIndex) |
| 1913 | { |
| 1914 | ExecSlice *slice = &sliceTable->slices[sliceIndex]; |
| 1915 | ListCell *cell; |
| 1916 | |
| 1917 | if (slice->gangType == GANGTYPE_UNALLOCATED) |
| 1918 | { |
| 1919 | slice->primaryGang = NULL; |
| 1920 | slice->primaryProcesses = getCdbProcessesForQD(true); |
| 1921 | } |
| 1922 | else if (!slice->primaryGang) |
| 1923 | { |
| 1924 | Assert(slice->segments != NIL); |
| 1925 | slice->primaryGang = AllocateGang(ds, slice->gangType, slice->segments); |
| 1926 | setupCdbProcessList(slice); |
| 1927 | } |
| 1928 | |
| 1929 | foreach(cell, slice->children) |
| 1930 | { |
| 1931 | int childIndex = lfirst_int(cell); |
| 1932 | |
| 1933 | InventorySliceTree(ds, sliceTable, childIndex); |
| 1934 | } |
| 1935 | } |
| 1936 | |
| 1937 | /* |
| 1938 | * Choose the execution identity (who does this executor serve?). |
no test coverage detected