提交 a2ecd1fa 编写于 作者: G Gang Xiong

Remove unnecessary argument of cdbdisp_makeDispatcherState

上级 fd57666f
......@@ -318,12 +318,12 @@ cdbdisp_handleError(struct CdbDispatcherState *ds)
*
* Call cdbdisp_destroyDispatcherState to free it.
*
* maxResults: max number of results, normally equals to max number of QEs.
* maxSlices: max number of slices of the query/command.
*/
void
cdbdisp_makeDispatcherState(CdbDispatcherState * ds, int maxResults,
int maxSlices, bool cancelOnError)
cdbdisp_makeDispatcherState(CdbDispatcherState * ds,
int maxSlices,
bool cancelOnError)
{
MemoryContext oldContext = NULL;
......@@ -339,8 +339,7 @@ cdbdisp_makeDispatcherState(CdbDispatcherState * ds, int maxResults,
ALLOCSET_DEFAULT_MAXSIZE);
oldContext = MemoryContextSwitchTo(ds->dispatchStateContext);
ds->primaryResults = cdbdisp_makeDispatchResults(maxResults,
maxSlices,
ds->primaryResults = cdbdisp_makeDispatchResults(maxSlices,
cancelOnError);
ds->dispatchThreads = cdbdisp_makeDispatchThreads(maxSlices);
MemoryContextSwitchTo(oldContext);
......
......@@ -88,7 +88,6 @@ cdbdisp_dispatchDtxProtocolCommand(DtxProtocolCommand dtxProtocolCommand,
DispatchCommandDtxProtocolParms dtxProtocolParms;
Gang *primaryGang;
int nsegdb = getgpsegmentCount();
elog((Debug_print_full_dtm ? LOG : DEBUG5),
"cdbdisp_dispatchDtxProtocolCommand: %s for gid = %s, direct content #: %d",
......@@ -125,7 +124,7 @@ cdbdisp_dispatchDtxProtocolCommand(DtxProtocolCommand dtxProtocolCommand,
/*
* Dispatch the command.
*/
cdbdisp_makeDispatcherState(&ds, nsegdb, 0, /* cancelOnError */ false);
cdbdisp_makeDispatcherState(&ds, /* slice count */1, /* cancelOnError */ false);
cdbdisp_dtxParmsInit(&ds, &dtxProtocolParms);
ds.primaryResults->writer_gang = primaryGang;
......
......@@ -511,7 +511,6 @@ cdbdisp_dispatchCommand(const char *strCommand,
{
DispatchCommandQueryParms queryParms;
Gang *primaryGang;
int nsegdb = getgpsegmentCount();
CdbComponentDatabaseInfo *qdinfo;
if (log_dispatch_stats)
......@@ -560,7 +559,7 @@ cdbdisp_dispatchCommand(const char *strCommand,
*/
ds->primaryResults = NULL;
ds->dispatchThreads = NULL;
cdbdisp_makeDispatcherState(ds, nsegdb, 0, cancelOnError);
cdbdisp_makeDispatcherState(ds, /*slice count*/1, cancelOnError);
cdbdisp_queryParmsInit(ds, &queryParms);
ds->primaryResults->writer_gang = primaryGang;
......@@ -1272,7 +1271,7 @@ cdbdisp_dispatchX(DispatchCommandQueryParms *pQueryParms,
ds->primaryResults = NULL;
ds->dispatchThreads = NULL;
cdbdisp_makeDispatcherState(ds, nSlices * largestGangsize(), nSlices, cancelOnError);
cdbdisp_makeDispatcherState(ds, nSlices, cancelOnError);
cdbdisp_queryParmsInit(ds, pQueryParms);
cdb_total_plans++;
......@@ -1441,7 +1440,6 @@ cdbdisp_dispatchSetCommandToAllGangs(const char *strCommand,
List *allocatedReaderGangs;
ListCell *le;
int nsegdb = getgpsegmentCount();
int gangCount;
MemSet(&queryParms, 0, sizeof(queryParms));
......@@ -1478,7 +1476,7 @@ cdbdisp_dispatchSetCommandToAllGangs(const char *strCommand,
ds->primaryResults = NULL;
ds->dispatchThreads = NULL;
cdbdisp_makeDispatcherState(ds, nsegdb * gangCount, gangCount, cancelOnError);
cdbdisp_makeDispatcherState(ds, gangCount, cancelOnError);
cdbdisp_queryParmsInit(ds, &queryParms);
ds->primaryResults->writer_gang = primaryGang;
......
......@@ -394,15 +394,7 @@ CdbDispatchCmdThreads *
cdbdisp_makeDispatchThreads(int maxSlices)
{
int maxThreadsPerGang = getMaxThreadsPerGang();
/*
* the maximum number of command parameter blocks we'll possibly need is
* * one for each slice on the primary gang. Max sure that we
* * have enough -- once we've created the command block we're stuck with it
* * for the duration of this statement (including CDB-DTM ).
* * X 2 for good measure ?
*/
int maxThreads = maxThreadsPerGang * 4 * Max(maxSlices, 5);
int maxThreads = maxThreadsPerGang * maxSlices;
int maxConn = gp_connections_per_thread;
int size = 0;
......
......@@ -887,11 +887,11 @@ cdbdisp_checkResultsErrcode(struct CdbDispatchResults *meleeResults)
* memory context.
*/
CdbDispatchResults *
cdbdisp_makeDispatchResults(int resultCapacity,
int sliceCapacity,
cdbdisp_makeDispatchResults(int sliceCapacity,
bool cancelOnError)
{
CdbDispatchResults *results = palloc0(sizeof(*results));
int resultCapacity = largestGangsize() * sliceCapacity;
int nbytes = resultCapacity * sizeof(results->resultArray[0]);
results->resultArray = palloc0(nbytes);
......
......@@ -129,12 +129,10 @@ cdbdisp_handleError(struct CdbDispatcherState *ds);
*
* Call cdbdisp_destroyDispatcherState to free it.
*
* maxResults: max number of results, normally equals to max number of QEs.
* maxSlices: max number of slices of the query/command.
*/
void
cdbdisp_makeDispatcherState(CdbDispatcherState *ds,
int maxResults,
int maxSlices,
bool cancelOnError);
......
......@@ -316,8 +316,7 @@ cdbdisp_checkResultsErrcode(struct CdbDispatchResults *meeleResults);
* memory context.
*/
CdbDispatchResults *
cdbdisp_makeDispatchResults(int resultCapacity,
int sliceCapacity,
cdbdisp_makeDispatchResults(int sliceCapacity,
bool cancelOnError);
#endif /* CDBDISPATCHRESULT_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册