diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index 3ca923b0aaa9822e65a377096d20958c63d057d8..f1a9447e9cf4688ece784506d6576c11916e7b46 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -20,6 +20,7 @@ extern "C" { #endif +#include "query.h" #include "tmsg.h" #include "tarray.h" @@ -122,7 +123,7 @@ typedef struct SSubplan { SSubplanId id; // unique id of the subplan int32_t type; // QUERY_TYPE_MERGE|QUERY_TYPE_PARTIAL|QUERY_TYPE_SCAN|QUERY_TYPE_MODIFY int32_t level; // the execution level of current subplan, starting from 0. - SEpSet execEpSet; // for the scan/modify subplan, the optional execution node + SQueryNodeAddr execNode; // for the scan/modify subplan, the optional execution node SArray *pChildern; // the datasource subplan,from which to fetch the result SArray *pParents; // the data destination subplan, get data from current subplan SPhyNode *pNode; // physical plan of current subplan diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 4d5b1a8bd3db1bbc9a2d0654ce8031710afb1909..4bfb774435a2024c2310575b7ddae9e07398fbab 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -111,6 +111,13 @@ typedef struct SMsgSendInfo { SDataBuf msgInfo; } SMsgSendInfo; +typedef struct SQueryNodeAddr{ + int32_t nodeId; //vgId or qnodeId + int8_t inUse; + int8_t numOfEps; + SEpAddrMsg epAddr[TSDB_MAX_REPLICA]; +} SQueryNodeAddr; + bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags); int32_t initTaskQueue(); diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h index d6cac976d41c1da8001e5bc18a95ee9a85d1b2bd..b2ba7acebfcdc832f25cc5f0a1c9662d0ec054ab 100644 --- a/include/libs/scheduler/scheduler.h +++ b/include/libs/scheduler/scheduler.h @@ -50,13 +50,6 @@ typedef struct SQueryProfileSummary { uint64_t resultSize; // generated result size in Kb. } SQueryProfileSummary; -typedef struct SQueryNodeAddr{ - int32_t nodeId; //vgId or qnodeId - int8_t inUse; - int8_t numOfEps; - SEpAddrMsg epAddr[TSDB_MAX_REPLICA]; -} SQueryNodeAddr; - typedef struct SQueryResult { int32_t code; uint64_t numOfRows; diff --git a/source/libs/planner/src/physicalPlan.c b/source/libs/planner/src/physicalPlan.c index 97c9cec7c7b31345c2065daf79f6a4f389a3e10b..22a1beaa35b84444a050e9443d207ccf51109a1a 100644 --- a/source/libs/planner/src/physicalPlan.c +++ b/source/libs/planner/src/physicalPlan.c @@ -211,22 +211,22 @@ static SSubplan* initSubplan(SPlanContext* pCxt, int32_t type) { return subplan; } -static void vgroupInfoToEpSet(const SVgroupInfo* vg, SEpSet* epSet) { - epSet->inUse = 0; // todo - epSet->numOfEps = vg->numOfEps; +static void vgroupInfoToEpSet(const SVgroupInfo* vg, SQueryNodeAddr* execNode) { + execNode->nodeId = vg->vgId; + execNode->inUse = 0; // todo + execNode->numOfEps = vg->numOfEps; for (int8_t i = 0; i < vg->numOfEps; ++i) { - epSet->port[i] = vg->epAddr[i].port; - strcpy(epSet->fqdn[i], vg->epAddr[i].fqdn); + execNode->epAddr[i] = vg->epAddr[i]; } return; } -static void vgroupMsgToEpSet(const SVgroupMsg* vg, SEpSet* epSet) { - epSet->inUse = 0; // todo - epSet->numOfEps = vg->numOfEps; +static void vgroupMsgToEpSet(const SVgroupMsg* vg, SQueryNodeAddr* execNode) { + execNode->nodeId = vg->vgId; + execNode->inUse = 0; // todo + execNode->numOfEps = vg->numOfEps; for (int8_t i = 0; i < vg->numOfEps; ++i) { - epSet->port[i] = vg->epAddr[i].port; - strcpy(epSet->fqdn[i], vg->epAddr[i].fqdn); + execNode->epAddr[i] = vg->epAddr[i]; } return; } @@ -236,7 +236,7 @@ static uint64_t splitSubplanByTable(SPlanContext* pCxt, SQueryPlanNode* pPlanNod for (int32_t i = 0; i < pTable->pMeta->vgroupList->numOfVgroups; ++i) { STORE_CURRENT_SUBPLAN(pCxt); SSubplan* subplan = initSubplan(pCxt, QUERY_TYPE_SCAN); - vgroupMsgToEpSet(&(pTable->pMeta->vgroupList->vgroups[i]), &subplan->execEpSet); + vgroupMsgToEpSet(&(pTable->pMeta->vgroupList->vgroups[i]), &subplan->execNode); subplan->pNode = createMultiTableScanNode(pPlanNode, pTable); subplan->pDataSink = createDataDispatcher(pCxt, pPlanNode); RECOVERY_CURRENT_SUBPLAN(pCxt); @@ -297,7 +297,7 @@ static void splitInsertSubplan(SPlanContext* pCxt, SQueryPlanNode* pPlanNode) { STORE_CURRENT_SUBPLAN(pCxt); SSubplan* subplan = initSubplan(pCxt, QUERY_TYPE_MODIFY); SVgDataBlocks* blocks = (SVgDataBlocks*)taosArrayGetP(vgs, i); - vgroupInfoToEpSet(&blocks->vg, &subplan->execEpSet); + vgroupInfoToEpSet(&blocks->vg, &subplan->execNode); subplan->pNode = NULL; subplan->pDataSink = createDataInserter(pCxt, blocks); subplan->type = QUERY_TYPE_MODIFY;