Merge pull request #17340 from taosdata/refact/code_format
refact: code format
This commit is contained in:
commit
f126e1e3b0
|
@ -140,8 +140,10 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) {
|
|||
pInfo->elapsedTime += el;
|
||||
pInfo->loadBlocks += 1;
|
||||
|
||||
tsdbDebug("read last block, total load:%d, trigger by uid:%"PRIu64", last file index:%d, last block index:%d, entry:%d, %p, elapsed time:%.2f ms, %s",
|
||||
pInfo->loadBlocks, pIter->uid, pIter->iStt, pIter->iSttBlk, pInfo->currentLoadBlockIndex, pBlock, el, idStr);
|
||||
tsdbDebug("read last block, total load:%d, trigger by uid:%" PRIu64
|
||||
", last file index:%d, last block index:%d, entry:%d, %p, elapsed time:%.2f ms, %s",
|
||||
pInfo->loadBlocks, pIter->uid, pIter->iStt, pIter->iSttBlk, pInfo->currentLoadBlockIndex, pBlock, el,
|
||||
idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _exit;
|
||||
}
|
||||
|
@ -386,8 +388,8 @@ void tLDataIterNextBlock(SLDataIter *pIter, const char* idStr) {
|
|||
if (index != -1) {
|
||||
pIter->iSttBlk = index;
|
||||
pIter->pSttBlk = (SSttBlk *)taosArrayGet(pIter->pBlockLoadInfo->aSttBlk, pIter->iSttBlk);
|
||||
tsdbDebug("try next last file block:%d from %d, trigger by uid:%"PRIu64", file index:%d, %s", pIter->iSttBlk, oldIndex, pIter->uid, pIter->iStt,
|
||||
idStr);
|
||||
tsdbDebug("try next last file block:%d from %d, trigger by uid:%" PRIu64 ", file index:%d, %s", pIter->iSttBlk,
|
||||
oldIndex, pIter->uid, pIter->iStt, idStr);
|
||||
} else {
|
||||
tsdbDebug("no more last block qualified, uid:%" PRIu64 ", file index::%d, %s", pIter->uid, oldIndex, idStr);
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "command.h"
|
||||
#include "os.h"
|
||||
#include "tarray.h"
|
||||
#include "planner.h"
|
||||
#include "scheduler.h"
|
||||
#include "tarray.h"
|
||||
#include "thash.h"
|
||||
#include "trpc.h"
|
||||
#include "command.h"
|
||||
|
||||
enum {
|
||||
SCH_READ = 1,
|
||||
|
@ -80,7 +80,6 @@ typedef struct SSchHbTrans {
|
|||
} SSchHbTrans;
|
||||
|
||||
typedef struct SSchApiStat {
|
||||
|
||||
#if defined(WINDOWS) || defined(_TD_DARWIN_64)
|
||||
size_t avoidCompilationErrors;
|
||||
#endif
|
||||
|
@ -88,7 +87,6 @@ typedef struct SSchApiStat {
|
|||
} SSchApiStat;
|
||||
|
||||
typedef struct SSchRuntimeStat {
|
||||
|
||||
#if defined(WINDOWS) || defined(_TD_DARWIN_64)
|
||||
size_t avoidCompilationErrors;
|
||||
#endif
|
||||
|
@ -96,7 +94,6 @@ typedef struct SSchRuntimeStat {
|
|||
} SSchRuntimeStat;
|
||||
|
||||
typedef struct SSchJobStat {
|
||||
|
||||
#if defined(WINDOWS) || defined(_TD_DARWIN_64)
|
||||
size_t avoidCompilationErrors;
|
||||
#endif
|
||||
|
@ -294,7 +291,8 @@ typedef struct SSchTaskCtx {
|
|||
|
||||
extern SSchedulerMgmt schMgmt;
|
||||
|
||||
#define SCH_TASK_TIMEOUT(_task) ((taosGetTimestampUs() - *(int64_t*)taosArrayGet((_task)->profile.execTime, (_task)->execId)) > (_task)->timeoutUsec)
|
||||
#define SCH_TASK_TIMEOUT(_task) \
|
||||
((taosGetTimestampUs() - *(int64_t *)taosArrayGet((_task)->profile.execTime, (_task)->execId)) > (_task)->timeoutUsec)
|
||||
|
||||
#define SCH_TASK_READY_FOR_LAUNCH(readyNum, task) ((readyNum) >= taosArrayGetSize((task)->children))
|
||||
|
||||
|
@ -305,10 +303,13 @@ extern SSchedulerMgmt schMgmt;
|
|||
#define SCH_TASK_EID(_task) ((_task) ? (_task)->execId : -1)
|
||||
|
||||
#define SCH_IS_DATA_BIND_QRY_TASK(task) ((task)->plan->subplanType == SUBPLAN_TYPE_SCAN)
|
||||
#define SCH_IS_DATA_BIND_TASK(task) (((task)->plan->subplanType == SUBPLAN_TYPE_SCAN) || ((task)->plan->subplanType == SUBPLAN_TYPE_MODIFY))
|
||||
#define SCH_IS_DATA_BIND_TASK(task) \
|
||||
(((task)->plan->subplanType == SUBPLAN_TYPE_SCAN) || ((task)->plan->subplanType == SUBPLAN_TYPE_MODIFY))
|
||||
#define SCH_IS_LEAF_TASK(_job, _task) (((_task)->level->level + 1) == (_job)->levelNum)
|
||||
#define SCH_IS_DATA_MERGE_TASK(task) (!SCH_IS_DATA_BIND_TASK(task))
|
||||
#define SCH_IS_LOCAL_EXEC_TASK(_job, _task) ((_job)->attr.localExec && SCH_IS_QUERY_JOB(_job) && (!SCH_IS_INSERT_JOB(_job)) && (!SCH_IS_DATA_BIND_QRY_TASK(_task)))
|
||||
#define SCH_IS_LOCAL_EXEC_TASK(_job, _task) \
|
||||
((_job)->attr.localExec && SCH_IS_QUERY_JOB(_job) && (!SCH_IS_INSERT_JOB(_job)) && \
|
||||
(!SCH_IS_DATA_BIND_QRY_TASK(_task)))
|
||||
|
||||
#define SCH_SET_TASK_STATUS(task, st) atomic_store_8(&(task)->status, st)
|
||||
#define SCH_GET_TASK_STATUS(task) atomic_load_8(&(task)->status)
|
||||
|
@ -322,16 +323,28 @@ extern SSchedulerMgmt schMgmt;
|
|||
#define SCH_GET_JOB_STATUS_STR(job) jobTaskStatusStr(SCH_GET_JOB_STATUS(job))
|
||||
|
||||
#define SCH_JOB_IN_SYNC_OP(job) ((job)->opStatus.op && (job)->opStatus.syncReq)
|
||||
#define SCH_JOB_IN_ASYNC_EXEC_OP(job) ((SCH_OP_EXEC == atomic_val_compare_exchange_32(&(job)->opStatus.op, SCH_OP_EXEC, SCH_OP_NULL)) && (!(job)->opStatus.syncReq))
|
||||
#define SCH_JOB_IN_ASYNC_FETCH_OP(job) ((SCH_OP_FETCH == atomic_val_compare_exchange_32(&(job)->opStatus.op, SCH_OP_FETCH, SCH_OP_NULL)) && (!(job)->opStatus.syncReq))
|
||||
#define SCH_JOB_IN_ASYNC_EXEC_OP(job) \
|
||||
((SCH_OP_EXEC == atomic_val_compare_exchange_32(&(job)->opStatus.op, SCH_OP_EXEC, SCH_OP_NULL)) && \
|
||||
(!(job)->opStatus.syncReq))
|
||||
#define SCH_JOB_IN_ASYNC_FETCH_OP(job) \
|
||||
((SCH_OP_FETCH == atomic_val_compare_exchange_32(&(job)->opStatus.op, SCH_OP_FETCH, SCH_OP_NULL)) && \
|
||||
(!(job)->opStatus.syncReq))
|
||||
|
||||
#define SCH_SET_JOB_NEED_FLOW_CTRL(_job) (_job)->attr.needFlowCtrl = true
|
||||
#define SCH_JOB_NEED_FLOW_CTRL(_job) ((_job)->attr.needFlowCtrl)
|
||||
#define SCH_TASK_NEED_FLOW_CTRL(_job, _task) (SCH_IS_DATA_BIND_QRY_TASK(_task) && SCH_JOB_NEED_FLOW_CTRL(_job) && SCH_IS_LEVEL_UNFINISHED((_task)->level))
|
||||
#define SCH_TASK_NEED_FLOW_CTRL(_job, _task) \
|
||||
(SCH_IS_DATA_BIND_QRY_TASK(_task) && SCH_JOB_NEED_FLOW_CTRL(_job) && SCH_IS_LEVEL_UNFINISHED((_task)->level))
|
||||
#define SCH_FETCH_TYPE(_pSrcTask) (SCH_IS_DATA_BIND_QRY_TASK(_pSrcTask) ? TDMT_SCH_FETCH : TDMT_SCH_MERGE_FETCH)
|
||||
#define SCH_TASK_NEED_FETCH(_task) ((_task)->plan->subplanType != SUBPLAN_TYPE_MODIFY)
|
||||
|
||||
#define SCH_SET_JOB_TYPE(_job, type) do { if ((type) != SUBPLAN_TYPE_MODIFY) { (_job)->attr.queryJob = true; } else { (_job)->attr.insertJob = true; } } while (0)
|
||||
#define SCH_SET_JOB_TYPE(_job, type) \
|
||||
do { \
|
||||
if ((type) != SUBPLAN_TYPE_MODIFY) { \
|
||||
(_job)->attr.queryJob = true; \
|
||||
} else { \
|
||||
(_job)->attr.insertJob = true; \
|
||||
} \
|
||||
} while (0)
|
||||
#define SCH_IS_QUERY_JOB(_job) ((_job)->attr.queryJob)
|
||||
#define SCH_IS_INSERT_JOB(_job) ((_job)->attr.insertJob)
|
||||
#define SCH_JOB_NEED_FETCH(_job) ((_job)->attr.needFetch)
|
||||
|
@ -339,10 +352,16 @@ extern SSchedulerMgmt schMgmt;
|
|||
#define SCH_JOB_NEED_DROP(_job) (SCH_IS_QUERY_JOB(_job))
|
||||
#define SCH_IS_EXPLAIN_JOB(_job) (EXPLAIN_MODE_ANALYZE == (_job)->attr.explainMode)
|
||||
#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL)
|
||||
#define SCH_MERGE_TASK_NETWORK_ERR(_task, _code, _len) (SCH_NETWORK_ERR(_code) && (((_len) > 0) || (!SCH_IS_DATA_BIND_TASK(_task))))
|
||||
#define SCH_REDIRECT_MSGTYPE(_msgType) ((_msgType) == TDMT_SCH_LINK_BROKEN || (_msgType) == TDMT_SCH_QUERY || (_msgType) == TDMT_SCH_MERGE_QUERY || (_msgType) == TDMT_SCH_FETCH || (_msgType) == TDMT_SCH_MERGE_FETCH)
|
||||
#define SCH_TASK_NEED_REDIRECT(_task, _msgType, _code, _rspLen) (SCH_REDIRECT_MSGTYPE(_msgType) && (NEED_SCHEDULER_REDIRECT_ERROR(_code) || SCH_MERGE_TASK_NETWORK_ERR((_task), (_code), (_rspLen))))
|
||||
#define SCH_NEED_RETRY(_msgType, _code) ((SCH_NETWORK_ERR(_code) && SCH_REDIRECT_MSGTYPE(_msgType)) || (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR)
|
||||
#define SCH_MERGE_TASK_NETWORK_ERR(_task, _code, _len) \
|
||||
(SCH_NETWORK_ERR(_code) && (((_len) > 0) || (!SCH_IS_DATA_BIND_TASK(_task))))
|
||||
#define SCH_REDIRECT_MSGTYPE(_msgType) \
|
||||
((_msgType) == TDMT_SCH_LINK_BROKEN || (_msgType) == TDMT_SCH_QUERY || (_msgType) == TDMT_SCH_MERGE_QUERY || \
|
||||
(_msgType) == TDMT_SCH_FETCH || (_msgType) == TDMT_SCH_MERGE_FETCH)
|
||||
#define SCH_TASK_NEED_REDIRECT(_task, _msgType, _code, _rspLen) \
|
||||
(SCH_REDIRECT_MSGTYPE(_msgType) && \
|
||||
(NEED_SCHEDULER_REDIRECT_ERROR(_code) || SCH_MERGE_TASK_NETWORK_ERR((_task), (_code), (_rspLen))))
|
||||
#define SCH_NEED_RETRY(_msgType, _code) \
|
||||
((SCH_NETWORK_ERR(_code) && SCH_REDIRECT_MSGTYPE(_msgType)) || (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR)
|
||||
|
||||
#define SCH_IS_LEVEL_UNFINISHED(_level) ((_level)->taskLaunchedNum < (_level)->taskNum)
|
||||
#define SCH_GET_CUR_EP(_addr) (&(_addr)->epSet.eps[(_addr)->epSet.inUse])
|
||||
|
@ -364,7 +383,6 @@ extern SSchedulerMgmt schMgmt;
|
|||
(_task)->profile.waitTime += us - *(int64_t *)taosArrayGet((_task)->profile.execTime, (_task)->execId); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define SCH_LOG_TASK_END_TS(_task) \
|
||||
do { \
|
||||
int64_t us = taosGetTimestampUs(); \
|
||||
|
@ -374,31 +392,67 @@ extern SSchedulerMgmt schMgmt;
|
|||
(_task)->profile.endTs = us; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define SCH_JOB_ELOG(param, ...) qError("QID:0x%" PRIx64 " " param, pJob->queryId, __VA_ARGS__)
|
||||
#define SCH_JOB_DLOG(param, ...) qDebug("QID:0x%" PRIx64 " " param, pJob->queryId, __VA_ARGS__)
|
||||
|
||||
#define SCH_TASK_ELOG(param, ...) \
|
||||
qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__)
|
||||
qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), \
|
||||
__VA_ARGS__)
|
||||
#define SCH_TASK_DLOG(param, ...) \
|
||||
qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__)
|
||||
qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), \
|
||||
__VA_ARGS__)
|
||||
#define SCH_TASK_TLOG(param, ...) \
|
||||
qTrace("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__)
|
||||
qTrace("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), \
|
||||
__VA_ARGS__)
|
||||
#define SCH_TASK_DLOGL(param, ...) \
|
||||
qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__)
|
||||
qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), \
|
||||
__VA_ARGS__)
|
||||
#define SCH_TASK_WLOG(param, ...) \
|
||||
qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__)
|
||||
qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define SCH_SET_ERRNO(_err) do { if (TSDB_CODE_SCH_IGNORE_ERROR != (_err)) { terrno = (_err); } } while (0)
|
||||
#define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { SCH_SET_ERRNO(_code); return _code; } } while (0)
|
||||
#define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { SCH_SET_ERRNO(_code); } return _code; } while (0)
|
||||
#define SCH_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { SCH_SET_ERRNO(code); goto _return; } } while (0)
|
||||
#define SCH_SET_ERRNO(_err) \
|
||||
do { \
|
||||
if (TSDB_CODE_SCH_IGNORE_ERROR != (_err)) { \
|
||||
terrno = (_err); \
|
||||
} \
|
||||
} while (0)
|
||||
#define SCH_ERR_RET(c) \
|
||||
do { \
|
||||
int32_t _code = c; \
|
||||
if (_code != TSDB_CODE_SUCCESS) { \
|
||||
SCH_SET_ERRNO(_code); \
|
||||
return _code; \
|
||||
} \
|
||||
} while (0)
|
||||
#define SCH_RET(c) \
|
||||
do { \
|
||||
int32_t _code = c; \
|
||||
if (_code != TSDB_CODE_SUCCESS) { \
|
||||
SCH_SET_ERRNO(_code); \
|
||||
} \
|
||||
return _code; \
|
||||
} while (0)
|
||||
#define SCH_ERR_JRET(c) \
|
||||
do { \
|
||||
code = c; \
|
||||
if (code != TSDB_CODE_SUCCESS) { \
|
||||
SCH_SET_ERRNO(code); \
|
||||
goto _return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SCH_LOCK_DEBUG(...) do { if (gSCHDebug.lockEnable) { qDebug(__VA_ARGS__); } } while (0)
|
||||
#define SCH_LOCK_DEBUG(...) \
|
||||
do { \
|
||||
if (gSCHDebug.lockEnable) { \
|
||||
qDebug(__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define TD_RWLATCH_WRITE_FLAG_COPY 0x40000000
|
||||
|
||||
#define SCH_LOCK(type, _lock) do { \
|
||||
#define SCH_LOCK(type, _lock) \
|
||||
do { \
|
||||
if (SCH_READ == (type)) { \
|
||||
assert(atomic_load_32(_lock) >= 0); \
|
||||
SCH_LOCK_DEBUG("SCH RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
|
@ -414,7 +468,8 @@ extern SSchedulerMgmt schMgmt;
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define SCH_UNLOCK(type, _lock) do { \
|
||||
#define SCH_UNLOCK(type, _lock) \
|
||||
do { \
|
||||
if (SCH_READ == (type)) { \
|
||||
assert(atomic_load_32((_lock)) > 0); \
|
||||
SCH_LOCK_DEBUG("SCH RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
|
@ -430,7 +485,6 @@ extern SSchedulerMgmt schMgmt;
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
void schDeregisterTaskHb(SSchJob *pJob, SSchTask *pTask);
|
||||
void schCleanClusterHb(void *pTrans);
|
||||
int32_t schLaunchTask(SSchJob *job, SSchTask *task);
|
||||
|
@ -513,7 +567,6 @@ int32_t schProcessExplainRsp(SSchJob *pJob, SSchTask *pTask, SExplainRsp *rsp);
|
|||
|
||||
extern SSchDebug gSCHDebug;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,5 +30,3 @@ void schdExecCallback(SExecResult* pResult, void* param, int32_t code) {
|
|||
|
||||
tsem_post(&schdRspSem);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "catalog.h"
|
||||
#include "query.h"
|
||||
#include "schInt.h"
|
||||
#include "tmsg.h"
|
||||
#include "query.h"
|
||||
#include "catalog.h"
|
||||
#include "tref.h"
|
||||
|
||||
void schFreeFlowCtrl(SSchJob *pJob) {
|
||||
|
@ -59,7 +59,8 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
pJob->flowCtrl = taosHashInit(pJob->taskNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
pJob->flowCtrl =
|
||||
taosHashInit(pJob->taskNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
if (NULL == pJob->flowCtrl) {
|
||||
SCH_JOB_ELOG("taosHashInit %d flowCtrl failed", pJob->taskNum);
|
||||
SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||
|
@ -93,8 +94,8 @@ int32_t schDecTaskFlowQuota(SSchJob *pJob, SSchTask *pTask) {
|
|||
--ctrl->execTaskNum;
|
||||
ctrl->tableNumSum -= pTask->plan->execNodeStat.tableNum;
|
||||
|
||||
SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d",
|
||||
ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
|
||||
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
|
||||
_return:
|
||||
|
||||
|
@ -124,8 +125,8 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
|
|||
SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d",
|
||||
ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, nctrl.tableNumSum, nctrl.execTaskNum);
|
||||
SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
|
||||
ep->port, pTask->plan->execNodeStat.tableNum, nctrl.tableNumSum, nctrl.execTaskNum);
|
||||
|
||||
*enough = true;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -173,7 +174,8 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
|
|||
_return:
|
||||
|
||||
SCH_TASK_DLOG("task quota %s added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d",
|
||||
((*enough)?"":"NOT"), ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
((*enough) ? "" : "NOT"), ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum,
|
||||
ctrl->execTaskNum);
|
||||
|
||||
SCH_UNLOCK(SCH_WRITE, &ctrl->lock);
|
||||
|
||||
|
@ -193,7 +195,6 @@ int32_t schTaskTableNumCompare(const void* key1, const void* key2) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
|
||||
SCH_LOCK(SCH_WRITE, &ctrl->lock);
|
||||
|
||||
|
@ -216,8 +217,8 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
|
|||
SEp *ep = SCH_GET_CUR_EP(&pTask->plan->execNode);
|
||||
|
||||
if (pTask->plan->execNodeStat.tableNum > remainNum && ctrl->execTaskNum > 0) {
|
||||
SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d",
|
||||
ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
|
||||
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -227,15 +228,15 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
|
|||
|
||||
taosArrayRemove(ctrl->taskList, i);
|
||||
|
||||
SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d",
|
||||
ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
|
||||
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
|
||||
SCH_ERR_JRET(schAsyncLaunchTaskImpl(pJob, pTask));
|
||||
|
||||
remainNum -= pTask->plan->execNodeStat.tableNum;
|
||||
if (remainNum <= 0) {
|
||||
SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d",
|
||||
ep->fqdn, ep->port, ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, ep->port,
|
||||
ctrl->tableNumSum, ctrl->execTaskNum);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -265,7 +266,6 @@ _return:
|
|||
SCH_RET(code);
|
||||
}
|
||||
|
||||
|
||||
int32_t schLaunchTasksInFlowCtrlList(SSchJob *pJob, SSchTask *pTask) {
|
||||
if (!SCH_TASK_NEED_FLOW_CTRL(pJob, pTask)) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -281,10 +281,9 @@ int32_t schLaunchTasksInFlowCtrlList(SSchJob *pJob, SSchTask *pTask) {
|
|||
SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
int32_t code = schLaunchTasksInFlowCtrlListImpl(pJob, ctrl);;
|
||||
int32_t code = schLaunchTasksInFlowCtrlListImpl(pJob, ctrl);
|
||||
;
|
||||
SCH_ERR_RET(code);
|
||||
|
||||
return code; // to avoid compiler error
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,8 +53,7 @@ _return:
|
|||
bool schJobDone(SSchJob *pJob) {
|
||||
int8_t status = SCH_GET_JOB_STATUS(pJob);
|
||||
|
||||
return (status == JOB_TASK_STATUS_FAIL || status == JOB_TASK_STATUS_DROP ||
|
||||
status == JOB_TASK_STATUS_SUCC);
|
||||
return (status == JOB_TASK_STATUS_FAIL || status == JOB_TASK_STATUS_DROP || status == JOB_TASK_STATUS_SUCC);
|
||||
}
|
||||
|
||||
FORCE_INLINE bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus) {
|
||||
|
@ -244,7 +243,6 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t schAppendJobDataSrc(SSchJob *pJob, SSchTask *pTask) {
|
||||
if (!SCH_IS_DATA_BIND_QRY_TASK(pTask)) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -255,7 +253,6 @@ int32_t schAppendJobDataSrc(SSchJob *pJob, SSchTask *pTask) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) {
|
||||
int32_t code = 0;
|
||||
pJob->queryId = pDag->queryId;
|
||||
|
@ -373,7 +370,6 @@ _return:
|
|||
SCH_RET(code);
|
||||
}
|
||||
|
||||
|
||||
int32_t schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes) {
|
||||
pRes->code = atomic_load_32(&pJob->errCode);
|
||||
pRes->numOfRows = pJob->resNumOfRows;
|
||||
|
@ -507,9 +503,7 @@ int32_t schHandleJobFailure(SSchJob *pJob, int32_t errCode) {
|
|||
return TSDB_CODE_SCH_IGNORE_ERROR;
|
||||
}
|
||||
|
||||
int32_t schProcessOnJobDropped(SSchJob *pJob, int32_t errCode) {
|
||||
SCH_RET(schProcessOnJobFailure(pJob, errCode));
|
||||
}
|
||||
int32_t schProcessOnJobDropped(SSchJob *pJob, int32_t errCode) { SCH_RET(schProcessOnJobFailure(pJob, errCode)); }
|
||||
|
||||
int32_t schHandleJobDrop(SSchJob *pJob, int32_t errCode) {
|
||||
if (TSDB_CODE_SCH_IGNORE_ERROR == errCode) {
|
||||
|
@ -520,7 +514,6 @@ int32_t schHandleJobDrop(SSchJob *pJob, int32_t errCode) {
|
|||
return TSDB_CODE_SCH_IGNORE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
int32_t schProcessOnJobPartialSuccess(SSchJob *pJob) {
|
||||
if (schChkCurrentOp(pJob, SCH_OP_FETCH, -1)) {
|
||||
SCH_ERR_RET(schLaunchFetchTask(pJob));
|
||||
|
@ -531,9 +524,7 @@ int32_t schProcessOnJobPartialSuccess(SSchJob *pJob) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void schProcessOnDataFetched(SSchJob *pJob) {
|
||||
schPostJobRes(pJob, SCH_OP_FETCH);
|
||||
}
|
||||
void schProcessOnDataFetched(SSchJob *pJob) { schPostJobRes(pJob, SCH_OP_FETCH); }
|
||||
|
||||
int32_t schProcessOnExplainDone(SSchJob *pJob, SSchTask *pTask, SRetrieveTableRsp *pRsp) {
|
||||
SCH_TASK_DLOG("got explain rsp, rows:%d, complete:%d", htonl(pRsp->numOfRows), pRsp->completed);
|
||||
|
@ -548,7 +539,6 @@ int32_t schProcessOnExplainDone(SSchJob *pJob, SSchTask *pTask, SRetrieveTableRs
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t schLaunchJobLowerLevel(SSchJob *pJob, SSchTask *pTask) {
|
||||
if (!SCH_IS_QUERY_JOB(pJob)) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -610,7 +600,6 @@ int32_t schGetTaskInJob(SSchJob *pJob, uint64_t taskId, SSchTask **pTask) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t schLaunchJob(SSchJob *pJob) {
|
||||
if (EXPLAIN_MODE_STATIC == pJob->attr.explainMode) {
|
||||
SCH_ERR_RET(qExecStaticExplain(pJob->pDag, (SRetrieveTableRsp **)&pJob->fetchRes));
|
||||
|
@ -623,7 +612,6 @@ int32_t schLaunchJob(SSchJob *pJob) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void schDropJobAllTasks(SSchJob *pJob) {
|
||||
schDropTaskInHashList(pJob, pJob->execTasks);
|
||||
// schDropTaskInHashList(pJob, pJob->succTasks);
|
||||
|
@ -737,8 +725,8 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
|
|||
pJob->nodeList = taosArrayDup(pReq->pNodeList);
|
||||
}
|
||||
|
||||
pJob->taskList =
|
||||
taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_ENTRY_LOCK);
|
||||
pJob->taskList = taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false,
|
||||
HASH_ENTRY_LOCK);
|
||||
if (NULL == pJob->taskList) {
|
||||
SCH_JOB_ELOG("taosHashInit %d taskList failed", pReq->pDag->numOfSubplans);
|
||||
SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||
|
@ -750,8 +738,8 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
|
|||
SCH_ERR_JRET(qExecExplainBegin(pReq->pDag, &pJob->explainCtx, pReq->startTs));
|
||||
}
|
||||
|
||||
pJob->execTasks =
|
||||
taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_ENTRY_LOCK);
|
||||
pJob->execTasks = taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false,
|
||||
HASH_ENTRY_LOCK);
|
||||
if (NULL == pJob->execTasks) {
|
||||
SCH_JOB_ELOG("taosHashInit %d execTasks failed", pReq->pDag->numOfSubplans);
|
||||
SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||
|
@ -836,7 +824,8 @@ void schProcessOnOpEnd(SSchJob *pJob, SCH_OP_TYPE type, SSchedulerReq* pReq, int
|
|||
SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock);
|
||||
op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL);
|
||||
if (SCH_OP_NULL == op || op != type) {
|
||||
SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op), jobTaskStatusStr(pJob->status));
|
||||
SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op),
|
||||
jobTaskStatusStr(pJob->status));
|
||||
}
|
||||
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
|
||||
schDumpJobExecRes(pJob, pReq->pExecRes);
|
||||
|
@ -847,7 +836,8 @@ void schProcessOnOpEnd(SSchJob *pJob, SCH_OP_TYPE type, SSchedulerReq* pReq, int
|
|||
SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock);
|
||||
op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL);
|
||||
if (SCH_OP_NULL == op || op != type) {
|
||||
SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op), jobTaskStatusStr(pJob->status));
|
||||
SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op),
|
||||
jobTaskStatusStr(pJob->status));
|
||||
}
|
||||
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
|
||||
}
|
||||
|
@ -983,6 +973,3 @@ _return:
|
|||
|
||||
SCH_RET(code);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -91,5 +91,3 @@ int32_t schHandleOpEndEvent(SSchJob* pJob, SCH_OP_TYPE type, SSchedulerReq* pReq
|
|||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
#include "catalog.h"
|
||||
#include "command.h"
|
||||
#include "query.h"
|
||||
#include "qworker.h"
|
||||
#include "schInt.h"
|
||||
#include "tglobal.h"
|
||||
#include "tmsg.h"
|
||||
#include "tref.h"
|
||||
#include "trpc.h"
|
||||
#include "qworker.h"
|
||||
#include "tglobal.h"
|
||||
|
||||
void schFreeTask(SSchJob *pJob, SSchTask *pTask) {
|
||||
schDeregisterTaskHb(pJob, pTask);
|
||||
|
@ -166,7 +166,8 @@ int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, v
|
|||
schUpdateTaskExecNode(pJob, pTask, handle, execId);
|
||||
|
||||
if ((execId != pTask->execId) || pTask->waitRetry) { // ignore it
|
||||
SCH_TASK_DLOG("handle not updated since execId %d is already not current execId %d, waitRetry %d", execId, pTask->execId, pTask->waitRetry);
|
||||
SCH_TASK_DLOG("handle not updated since execId %d is already not current execId %d, waitRetry %d", execId,
|
||||
pTask->execId, pTask->waitRetry);
|
||||
SCH_ERR_RET(TSDB_CODE_SCH_IGNORE_ERROR);
|
||||
}
|
||||
|
||||
|
@ -847,7 +848,8 @@ int32_t schHandleExplainRes(SArray *pExplainRes) {
|
|||
|
||||
pJob = schAcquireJob(localRsp->rId);
|
||||
if (NULL == pJob) {
|
||||
qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 "job no exist, may be dropped, refId:0x%" PRIx64, localRsp->qId, localRsp->tId, localRsp->rId);
|
||||
qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 "job no exist, may be dropped, refId:0x%" PRIx64, localRsp->qId,
|
||||
localRsp->tId, localRsp->rId);
|
||||
SCH_ERR_JRET(TSDB_CODE_QRY_JOB_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
@ -866,7 +868,8 @@ int32_t schHandleExplainRes(SArray *pExplainRes) {
|
|||
|
||||
schReleaseJob(pJob->refId);
|
||||
|
||||
qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ", end to handle LOCAL explain rsp msg, code:%x", localRsp->qId, localRsp->tId, code);
|
||||
qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ", end to handle LOCAL explain rsp msg, code:%x", localRsp->qId,
|
||||
localRsp->tId, code);
|
||||
|
||||
SCH_ERR_JRET(code);
|
||||
|
||||
|
@ -935,7 +938,8 @@ int32_t schLaunchLocalTask(SSchJob *pJob, SSchTask *pTask) {
|
|||
explainRes = taosArrayInit(pJob->taskNum, sizeof(SExplainLocalRsp));
|
||||
}
|
||||
|
||||
SCH_ERR_RET(qWorkerProcessLocalQuery(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId, pTask->execId, &qwMsg, explainRes));
|
||||
SCH_ERR_RET(qWorkerProcessLocalQuery(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId,
|
||||
pTask->execId, &qwMsg, explainRes));
|
||||
|
||||
if (SCH_IS_EXPLAIN_JOB(pJob)) {
|
||||
SCH_ERR_RET(schHandleExplainRes(explainRes));
|
||||
|
@ -967,8 +971,8 @@ int32_t schLaunchTaskImpl(void *param) {
|
|||
pTask->retryTimes++;
|
||||
pTask->waitRetry = false;
|
||||
|
||||
SCH_TASK_DLOG("start to launch %s task, execId %d, retry %d", SCH_IS_LOCAL_EXEC_TASK(pJob, pTask) ? "LOCAL" : "REMOTE",
|
||||
pTask->execId, pTask->retryTimes);
|
||||
SCH_TASK_DLOG("start to launch %s task, execId %d, retry %d",
|
||||
SCH_IS_LOCAL_EXEC_TASK(pJob, pTask) ? "LOCAL" : "REMOTE", pTask->execId, pTask->retryTimes);
|
||||
|
||||
SCH_LOG_TASK_START_TS(pTask);
|
||||
|
||||
|
@ -1093,7 +1097,8 @@ int32_t schExecLocalFetch(SSchJob *pJob, SSchTask *pTask) {
|
|||
explainRes = taosArrayInit(pJob->taskNum, sizeof(SExplainLocalRsp));
|
||||
}
|
||||
|
||||
SCH_ERR_RET(qWorkerProcessLocalFetch(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId, pTask->execId, &pRsp, explainRes));
|
||||
SCH_ERR_RET(qWorkerProcessLocalFetch(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId,
|
||||
pTask->execId, &pRsp, explainRes));
|
||||
|
||||
if (SCH_IS_EXPLAIN_JOB(pJob)) {
|
||||
SCH_ERR_RET(schHandleExplainRes(explainRes));
|
||||
|
|
|
@ -94,7 +94,6 @@ int32_t schRemoveHbConnection(SSchJob *pJob, SSchTask *pTask, SQueryNodeEpId *ep
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t schAddHbConnection(SSchJob *pJob, SSchTask *pTask, SQueryNodeEpId *epId, bool *exist) {
|
||||
int32_t code = 0;
|
||||
SSchHbTrans hb = {0};
|
||||
|
@ -184,8 +183,6 @@ void schDeregisterTaskHb(SSchJob *pJob, SSchTask *pTask) {
|
|||
pTask->registerdHb = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32_t schEnsureHbConnection(SSchJob *pJob, SSchTask *pTask) {
|
||||
SQueryNodeAddr *addr = taosArrayGet(pTask->candidateAddrs, pTask->candidateIdx);
|
||||
SQueryNodeEpId epId = {0};
|
||||
|
@ -226,7 +223,6 @@ int32_t schUpdateHbConnection(SQueryNodeEpId *epId, SSchTrans *trans) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void schCloseJobRef(void) {
|
||||
if (!atomic_load_8((int8_t *)&schMgmt.exit)) {
|
||||
return;
|
||||
|
@ -262,7 +258,6 @@ uint64_t schGenUUID(void) {
|
|||
return id;
|
||||
}
|
||||
|
||||
|
||||
void schFreeRpcCtxVal(const void *arg) {
|
||||
if (NULL == arg) {
|
||||
return;
|
||||
|
@ -307,5 +302,3 @@ int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTas
|
|||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
*/
|
||||
|
||||
#include "query.h"
|
||||
#include "qworker.h"
|
||||
#include "schInt.h"
|
||||
#include "tmsg.h"
|
||||
#include "tref.h"
|
||||
#include "qworker.h"
|
||||
|
||||
SSchedulerMgmt schMgmt = {
|
||||
.jobRef = -1,
|
||||
|
|
|
@ -30,15 +30,12 @@
|
|||
#endif
|
||||
#include "os.h"
|
||||
|
||||
#include "tglobal.h"
|
||||
#include "taos.h"
|
||||
#include "tdef.h"
|
||||
#include "tvariant.h"
|
||||
#include "catalog.h"
|
||||
#include "scheduler.h"
|
||||
#include "taos.h"
|
||||
#include "tdatablock.h"
|
||||
#include "tdef.h"
|
||||
#include "tglobal.h"
|
||||
#include "trpc.h"
|
||||
#include "tvariant.h"
|
||||
|
||||
|
@ -56,7 +53,8 @@
|
|||
|
||||
namespace {
|
||||
|
||||
extern "C" int32_t schHandleResponseMsg(SSchJob *job, SSchTask *task, int32_t msgType, char *msg, int32_t msgSize, int32_t rspCode);
|
||||
extern "C" int32_t schHandleResponseMsg(SSchJob *job, SSchTask *task, int32_t msgType, char *msg, int32_t msgSize,
|
||||
int32_t rspCode);
|
||||
extern "C" int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode);
|
||||
|
||||
int64_t insertJobRefId = 0;
|
||||
|
@ -72,7 +70,6 @@ int32_t schtTestMTRunSec = 10;
|
|||
int32_t schtTestPrintNum = 1000;
|
||||
int32_t schtStartFetch = 0;
|
||||
|
||||
|
||||
void schtInitLogFile() {
|
||||
const char *defaultLogFileNamePrefix = "taoslog";
|
||||
const int32_t maxLogFileNum = 10;
|
||||
|
@ -84,7 +81,6 @@ void schtInitLogFile() {
|
|||
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
|
||||
printf("failed to open log file in directory:%s\n", tsLogDir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void schtQueryCb(SExecResult *pResult, void *param, int32_t code) {
|
||||
|
@ -92,7 +88,6 @@ void schtQueryCb(SExecResult* pResult, void* param, int32_t code) {
|
|||
*(int32_t *)param = 1;
|
||||
}
|
||||
|
||||
|
||||
void schtBuildQueryDag(SQueryPlan *dag) {
|
||||
uint64_t qId = schtQueryId;
|
||||
|
||||
|
@ -206,11 +201,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) {
|
|||
nodesListAppend(dag->pSubplans, (SNode *)scan);
|
||||
}
|
||||
|
||||
|
||||
void schtFreeQueryDag(SQueryPlan *dag) {
|
||||
|
||||
}
|
||||
|
||||
void schtFreeQueryDag(SQueryPlan *dag) {}
|
||||
|
||||
void schtBuildInsertDag(SQueryPlan *dag) {
|
||||
uint64_t qId = 0x0000000000000002;
|
||||
|
@ -263,20 +254,15 @@ void schtBuildInsertDag(SQueryPlan *dag) {
|
|||
nodesListAppend(dag->pSubplans, (SNode *)inserta);
|
||||
}
|
||||
|
||||
|
||||
int32_t schtPlanToString(const SSubplan *subplan, char **str, int32_t *len) {
|
||||
*str = (char *)taosMemoryCalloc(1, 20);
|
||||
*len = 20;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void schtExecNode(SSubplan* subplan, uint64_t groupId, SQueryNodeAddr* ep) {
|
||||
void schtExecNode(SSubplan *subplan, uint64_t groupId, SQueryNodeAddr *ep) {}
|
||||
|
||||
}
|
||||
|
||||
void schtRpcSendRequest(void *shandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *pRid) {
|
||||
|
||||
}
|
||||
void schtRpcSendRequest(void *shandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *pRid) {}
|
||||
|
||||
void schtSetPlanToString() {
|
||||
static Stub stub;
|
||||
|
@ -347,7 +333,6 @@ int32_t schtAsyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTr
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void schtSetAsyncSendMsgToServer() {
|
||||
static Stub stub;
|
||||
stub.set(asyncSendMsgToServer, schtAsyncSendMsgToServer);
|
||||
|
@ -368,7 +353,6 @@ void schtSetAsyncSendMsgToServer() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void *schtSendRsp(void *param) {
|
||||
SSchJob *pJob = NULL;
|
||||
int64_t job = 0;
|
||||
|
@ -420,7 +404,6 @@ void *schtCreateFetchRspThread(void *param) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void *schtFetchRspThread(void *aa) {
|
||||
SDataBuf dataBuf = {0};
|
||||
SSchTaskCallbackParam *param = NULL;
|
||||
|
@ -476,11 +459,9 @@ void* schtRunJobThread(void *aa) {
|
|||
|
||||
schtInitLogFile();
|
||||
|
||||
|
||||
int32_t code = schedulerInit();
|
||||
assert(code == 0);
|
||||
|
||||
|
||||
schtSetPlanToString();
|
||||
schtSetExecNode();
|
||||
schtSetAsyncSendMsgToServer();
|
||||
|
@ -573,7 +554,6 @@ void* schtRunJobThread(void *aa) {
|
|||
pIter = taosHashIterate(execTasks, pIter);
|
||||
}
|
||||
|
||||
|
||||
while (true) {
|
||||
if (queryDone) {
|
||||
break;
|
||||
|
@ -628,8 +608,7 @@ void* schtFreeJobThread(void *aa) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(queryTest, normalCase) {
|
||||
void *mockPointer = (void *)0x1;
|
||||
|
@ -673,7 +652,6 @@ TEST(queryTest, normalCase) {
|
|||
code = schedulerExecJob(&req, &job);
|
||||
ASSERT_EQ(code, 0);
|
||||
|
||||
|
||||
SSchJob *pJob = schAcquireJob(job);
|
||||
|
||||
void *pIter = taosHashIterate(pJob->execTasks, NULL);
|
||||
|
@ -779,7 +757,6 @@ TEST(queryTest, readyFirstCase) {
|
|||
code = schedulerExecJob(&req, &job);
|
||||
ASSERT_EQ(code, 0);
|
||||
|
||||
|
||||
SSchJob *pJob = schAcquireJob(job);
|
||||
|
||||
void *pIter = taosHashIterate(pJob->execTasks, NULL);
|
||||
|
@ -812,7 +789,6 @@ TEST(queryTest, readyFirstCase) {
|
|||
taosUsleep(10000);
|
||||
}
|
||||
|
||||
|
||||
TdThreadAttr thattr;
|
||||
taosThreadAttrInit(&thattr);
|
||||
|
||||
|
@ -844,8 +820,6 @@ TEST(queryTest, readyFirstCase) {
|
|||
schedulerDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(queryTest, flowCtrlCase) {
|
||||
void *mockPointer = (void *)0x1;
|
||||
char *clusterId = "cluster1";
|
||||
|
@ -889,7 +863,6 @@ TEST(queryTest, flowCtrlCase) {
|
|||
code = schedulerExecJob(&req, &job);
|
||||
ASSERT_EQ(code, 0);
|
||||
|
||||
|
||||
SSchJob *pJob = schAcquireJob(job);
|
||||
|
||||
bool qDone = false;
|
||||
|
@ -958,7 +931,6 @@ TEST(queryTest, flowCtrlCase) {
|
|||
schedulerDestroy();
|
||||
}
|
||||
|
||||
|
||||
TEST(insertTest, normalCase) {
|
||||
void *mockPointer = (void *)0x1;
|
||||
char *clusterId = "cluster1";
|
||||
|
|
|
@ -12,25 +12,7 @@ FORMAT_DIR_LIST=(
|
|||
"${PRJ_ROOT_DIR}/source/os"
|
||||
"${PRJ_ROOT_DIR}/source/util"
|
||||
"${PRJ_ROOT_DIR}/source/common"
|
||||
"${PRJ_ROOT_DIR}/source/libs/cache"
|
||||
"${PRJ_ROOT_DIR}/source/libs/catalog"
|
||||
"${PRJ_ROOT_DIR}/source/libs/command"
|
||||
"${PRJ_ROOT_DIR}/source/libs/executor"
|
||||
"${PRJ_ROOT_DIR}/source/libs/function"
|
||||
"${PRJ_ROOT_DIR}/source/libs/index"
|
||||
"${PRJ_ROOT_DIR}/source/libs/monitor"
|
||||
"${PRJ_ROOT_DIR}/source/libs/nodes"
|
||||
# "${PRJ_ROOT_DIR}/source/libs/parser"
|
||||
"${PRJ_ROOT_DIR}/source/libs/planner"
|
||||
"${PRJ_ROOT_DIR}/source/libs/qcom"
|
||||
"${PRJ_ROOT_DIR}/source/libs/qworker"
|
||||
"${PRJ_ROOT_DIR}/source/libs/scalar"
|
||||
"${PRJ_ROOT_DIR}/source/libs/stream"
|
||||
"${PRJ_ROOT_DIR}/source/libs/sync"
|
||||
"${PRJ_ROOT_DIR}/source/libs/tdb"
|
||||
"${PRJ_ROOT_DIR}/source/libs/tfs"
|
||||
"${PRJ_ROOT_DIR}/source/libs/transport"
|
||||
"${PRJ_ROOT_DIR}/source/libs/wal"
|
||||
"${PRJ_ROOT_DIR}/source/libs"
|
||||
"${PRJ_ROOT_DIR}/source/client/inc"
|
||||
"${PRJ_ROOT_DIR}/source/client/src"
|
||||
"${PRJ_ROOT_DIR}/source/client/test"
|
||||
|
@ -45,7 +27,7 @@ EXCLUDE_FILE_LIST=(
|
|||
)
|
||||
|
||||
for d in ${FORMAT_DIR_LIST[@]}; do
|
||||
for f in $(find $d -type f -regex '.*\.\(cpp\|hpp\|c\|h\)'); do
|
||||
for f in $(find $d -type f -not -name '*sql.c' -regex '.*\.\(cpp\|hpp\|c\|h\)'); do
|
||||
${FORMAT_BIN} -i $f
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue