modify scheduler api
This commit is contained in:
parent
62590e533f
commit
8146c0e0fc
|
@ -20,6 +20,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "planner.h"
|
||||||
|
|
||||||
typedef struct SQueryProfileSummary {
|
typedef struct SQueryProfileSummary {
|
||||||
int64_t startTs; // Object created and added into the message queue
|
int64_t startTs; // Object created and added into the message queue
|
||||||
int64_t endTs; // the timestamp when the task is completed
|
int64_t endTs; // the timestamp when the task is completed
|
||||||
|
@ -43,43 +45,23 @@ typedef struct SQueryProfileSummary {
|
||||||
uint64_t resultSize; // generated result size in Kb.
|
uint64_t resultSize; // generated result size in Kb.
|
||||||
} SQueryProfileSummary;
|
} SQueryProfileSummary;
|
||||||
|
|
||||||
typedef struct SQueryTask {
|
|
||||||
uint64_t queryId; // query id
|
|
||||||
uint64_t taskId; // task id
|
|
||||||
char *pSubplan; // operator tree
|
|
||||||
uint64_t status; // task status
|
|
||||||
SQueryProfileSummary summary; // task execution summary
|
|
||||||
void *pOutputHandle; // result buffer handle, to temporarily keep the output result for next stage
|
|
||||||
} SQueryTask;
|
|
||||||
|
|
||||||
typedef struct SQueryJob {
|
|
||||||
SArray **pSubtasks;
|
|
||||||
// todo
|
|
||||||
} SQueryJob;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the query job, generated according to the query physical plan.
|
* Process the query job, generated according to the query physical plan.
|
||||||
* This is a synchronized API, and is also thread-safety.
|
* This is a synchronized API, and is also thread-safety.
|
||||||
* @param pJob
|
* @param pJob
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t qProcessQueryJob(struct SQueryJob* pJob);
|
int32_t scheduleQueryJob(SQueryDag* pDag, void** pJob);
|
||||||
|
|
||||||
|
int32_t scheduleFetchRows(void *pJob, void *data);
|
||||||
|
|
||||||
/**
|
|
||||||
* The SSqlObj should not be here????
|
|
||||||
* @param pSql
|
|
||||||
* @param pVgroupId
|
|
||||||
* @param pRetVgroupId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
//SArray* qGetInvolvedVgroupIdList(struct SSqlObj* pSql, SArray* pVgroupId, SArray* pRetVgroupId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel query job
|
* Cancel query job
|
||||||
* @param pJob
|
* @param pJob
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t qKillQueryJob(struct SQueryJob* pJob);
|
int32_t scheduleCancelJob(void *pJob);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,20 @@ typedef struct SQuery {
|
||||||
int32_t currentLevel;
|
int32_t currentLevel;
|
||||||
} SQuery;
|
} SQuery;
|
||||||
|
|
||||||
|
typedef struct SQueryTask {
|
||||||
|
uint64_t queryId; // query id
|
||||||
|
uint64_t taskId; // task id
|
||||||
|
char *pSubplan; // operator tree
|
||||||
|
uint64_t status; // task status
|
||||||
|
SQueryProfileSummary summary; // task execution summary
|
||||||
|
void *pOutputHandle; // result buffer handle, to temporarily keep the output result for next stage
|
||||||
|
} SQueryTask;
|
||||||
|
|
||||||
|
typedef struct SQueryJob {
|
||||||
|
SArray **pSubtasks;
|
||||||
|
// todo
|
||||||
|
} SQueryJob;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,3 +14,44 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "schedulerInt.h"
|
#include "schedulerInt.h"
|
||||||
|
#include "taosmsg.h"
|
||||||
|
|
||||||
|
|
||||||
|
int32_t schBuildAndSendRequest(void *pRpc, const SEpSet* pMgmtEps, __taos_async_fn_t fp) {
|
||||||
|
/*
|
||||||
|
SRequestObj *pRequest = createRequest(pTscObj, fp, param, TSDB_SQL_CONNECT);
|
||||||
|
if (pRequest == NULL) {
|
||||||
|
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
SRequestMsgBody body = {0};
|
||||||
|
buildConnectMsg(pRequest, &body);
|
||||||
|
|
||||||
|
int64_t transporterId = 0;
|
||||||
|
sendMsgToServer(pTscObj->pTransporter, &pTscObj->pAppInfo->mgmtEp.epSet, &body, &transporterId);
|
||||||
|
|
||||||
|
tsem_wait(&pRequest->body.rspSem);
|
||||||
|
destroyConnectMsg(&body);
|
||||||
|
|
||||||
|
if (pRequest->code != TSDB_CODE_SUCCESS) {
|
||||||
|
const char *errorMsg = (pRequest->code == TSDB_CODE_RPC_FQDN_ERROR) ? taos_errstr(pRequest) : tstrerror(terrno);
|
||||||
|
printf("failed to connect to server, reason: %s\n\n", errorMsg);
|
||||||
|
|
||||||
|
destroyRequest(pRequest);
|
||||||
|
taos_close(pTscObj);
|
||||||
|
pTscObj = NULL;
|
||||||
|
} else {
|
||||||
|
tscDebug("0x%"PRIx64" connection is opening, connId:%d, dnodeConn:%p", pTscObj->id, pTscObj->connId, pTscObj->pTransporter);
|
||||||
|
destroyRequest(pRequest);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t scheduleQueryJob(SQueryDag* pDag, void** pJob);
|
||||||
|
|
||||||
|
int32_t scheduleFetchRows(void *pJob, void *data);
|
||||||
|
|
||||||
|
int32_t scheduleCancelJob(void *pJob);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue