From 748c7f9cf2e8c9510a8e8e53766c6d1d95815d55 Mon Sep 17 00:00:00 2001 From: kailixu Date: Fri, 15 Nov 2024 19:26:12 +0800 Subject: [PATCH 1/7] enh: add bypassFlag to facilitate performance testing --- docs/zh/14-reference/01-components/01-taosd.md | 1 + docs/zh/14-reference/01-components/02-taosc.md | 1 + include/common/tglobal.h | 1 + include/util/tdef.h | 9 +++++++++ source/common/src/tglobal.c | 13 +++++++++++-- source/dnode/vnode/src/tsdb/tsdbCommit2.c | 2 +- 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index 64ae69528b32..b2d40dde9066 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -294,6 +294,7 @@ charset 的有效值是 UTF-8。 |checkpointBackupDir | |内部参数,用于恢复 snode 数据| |enableAuditDelete | |内部参数,用于测试审计功能| |slowLogThresholdTest| |内部参数,用于测试慢日志| +|bypassFlag |3.3.4.5 后|内部参数,用于短路测试,默认值 0| ### 压缩参数 |参数名称|支持版本|参数含义| diff --git a/docs/zh/14-reference/01-components/02-taosc.md b/docs/zh/14-reference/01-components/02-taosc.md index 09653ae3ef6b..82e1661b143c 100755 --- a/docs/zh/14-reference/01-components/02-taosc.md +++ b/docs/zh/14-reference/01-components/02-taosc.md @@ -97,6 +97,7 @@ TDengine 客户端驱动提供了应用编程所需要的全部 API,并且在 |safetyCheckLevel |3.3.3.0 后|内部参数,用于随机失败测试| |simdEnable |3.3.4.3 后|内部参数,用于测试 SIMD 加速| |AVX512Enable |3.3.4.3 后|内部参数,用于测试 AVX512 加速| +|bypassFlag |3.3.4.5 后|内部参数,用于短路测试,缺省值:0| ### SHELL 相关 |参数名称|支持版本|参数含义| diff --git a/include/common/tglobal.h b/include/common/tglobal.h index e6c471eaf10f..5125c1caefce 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -67,6 +67,7 @@ extern int64_t tsTickPerHour[3]; extern int32_t tsCountAlwaysReturnValue; extern float tsSelectivityRatio; extern int32_t tsTagFilterResCacheSize; +extern int32_t tsBypassFlag; // queue & threads extern int32_t tsNumOfRpcThreads; diff --git a/include/util/tdef.h b/include/util/tdef.h index 4e1fb2183855..e869d993a334 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -620,6 +620,15 @@ enum { enum { RAND_ERR_MEMORY = 1, RAND_ERR_FILE = 2, RAND_ERR_NETWORK = 4 }; +/** + * RB: return before + * RA: return after + * NR: not return, skip and go on following code + */ +#define TSDB_BYPASS_RB_RPC_SEND_SUBMIT 0x01u +#define TSDB_BYPASS_RA_RPC_RECV_SUBMIT 0x02u +#define TSDB_BYPASS_RB_TSDB_COMMIT 0x08u + #define DEFAULT_HANDLE 0 #define MNODE_HANDLE 1 #define QNODE_HANDLE -1 diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 0133428c5331..93c86a2dcd3a 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -217,6 +217,8 @@ float tsSelectivityRatio = 1.0; int32_t tsTagFilterResCacheSize = 1024 * 10; char tsTagFilterCache = 0; +int32_t tsBypassFlag = 0; + // the maximum allowed query buffer size during query processing for each data node. // -1 no limit (default) // 0 no query allowed, queries are disabled @@ -612,6 +614,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { cfgAddInt64(pCfg, "randErrorDivisor", tsRandErrDivisor, 1, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "randErrorScope", tsRandErrScope, 0, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "safetyCheckLevel", tsSafetyCheckLevel, 0, 5, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); + TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "bypassFlag", tsBypassFlag, 0, INT32_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); tsNumOfRpcThreads = tsNumOfCores / 2; tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS); @@ -1303,6 +1306,10 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "safetyCheckLevel"); tsSafetyCheckLevel = pItem->i32; + + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "bypassFlag"); + tsBypassFlag = pItem->i32; + TAOS_RETURN(TSDB_CODE_SUCCESS); } @@ -2046,7 +2053,8 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { {"supportVnodes", &tsNumOfSupportVnodes}, {"experimental", &tsExperimental}, {"maxTsmaNum", &tsMaxTsmaNum}, - {"safetyCheckLevel", &tsSafetyCheckLevel}}; + {"safetyCheckLevel", &tsSafetyCheckLevel}, + {"bypassFlag", &tsBypassFlag}}; if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) { code = taosCfgSetOption(options, tListLen(options), pItem, false); @@ -2302,7 +2310,8 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { {"multiResultFunctionStarReturnTags", &tsMultiResultFunctionStarReturnTags}, {"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay}, {"tsmaDataDeleteMark", &tsmaDataDeleteMark}, - {"safetyCheckLevel", &tsSafetyCheckLevel}}; + {"safetyCheckLevel", &tsSafetyCheckLevel}, + {"bypassFlag", &tsBypassFlag}}; if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) { code = taosCfgSetOption(options, tListLen(options), pItem, false); diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index 95c5daf842a8..e3c75760c8ab 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -667,7 +667,7 @@ int32_t tsdbCommitBegin(STsdb *tsdb, SCommitInfo *info) { int64_t nRow = imem->nRow; int64_t nDel = imem->nDel; - if (nRow == 0 && nDel == 0) { + if ((nRow == 0 && nDel == 0) || (tsBypassFlag & TSDB_BYPASS_RB_TSDB_COMMIT)) { (void)taosThreadMutexLock(&tsdb->mutex); tsdb->imem = NULL; (void)taosThreadMutexUnlock(&tsdb->mutex); From 3225c381e2ffcc4a38768a5b8033fe01a162b13c Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 18 Nov 2024 15:41:08 +0800 Subject: [PATCH 2/7] enh: add bypassFlag to facilitate performance testing --- include/util/taoserror.h | 3 ++- include/util/tdef.h | 3 ++- source/client/src/clientImpl.c | 5 +++-- source/dnode/vnode/src/vnd/vnodeSvr.c | 8 ++++++++ source/libs/scheduler/src/schRemote.c | 10 ++++++---- source/libs/scheduler/src/scheduler.c | 2 +- source/libs/transport/src/trans.c | 5 +++++ source/util/src/terror.c | 3 ++- 8 files changed, 29 insertions(+), 10 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 2c811495fdee..863c2126571f 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -96,7 +96,8 @@ int32_t taosGetErrSize(); #define TSDB_CODE_RPC_ASYNC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0027) #define TSDB_CODE_RPC_ASYNC_IN_PROCESS TAOS_DEF_ERROR_CODE(0, 0x0028) #define TSDB_CODE_RPC_NO_STATE TAOS_DEF_ERROR_CODE(0, 0x0029) -#define TSDB_CODE_RPC_STATE_DROPED TAOS_DEF_ERROR_CODE(0, 0x002A) +#define TSDB_CODE_RPC_STATE_DROPED TAOS_DEF_ERROR_CODE(0, 0x002A) +#define TSDB_CODE_RPC_BYPASS_SEND TAOS_DEF_ERROR_CODE(0, 0x002B) //common & util #define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) // diff --git a/include/util/tdef.h b/include/util/tdef.h index e869d993a334..0e2f7ed8a680 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -623,10 +623,11 @@ enum { RAND_ERR_MEMORY = 1, RAND_ERR_FILE = 2, RAND_ERR_NETWORK = 4 }; /** * RB: return before * RA: return after - * NR: not return, skip and go on following code + * NR: not return, skip and go on following steps */ #define TSDB_BYPASS_RB_RPC_SEND_SUBMIT 0x01u #define TSDB_BYPASS_RA_RPC_RECV_SUBMIT 0x02u +#define TSDB_BYPASS_RB_TSDB_WRITE_MEM 0x04u #define TSDB_BYPASS_RB_TSDB_COMMIT 0x08u #define DEFAULT_HANDLE 0 diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 8a0b1ddaab04..bc1e834ed8a4 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -3108,8 +3108,9 @@ void taosAsyncFetchImpl(SRequestObj* pRequest, __taos_async_fn_t fp, void* param void doRequestCallback(SRequestObj* pRequest, int32_t code) { pRequest->inCallback = true; int64_t this = pRequest->self; - if (tsQueryTbNotExistAsEmpty && TD_RES_QUERY(&pRequest->resType) && pRequest->isQuery && - (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_TDB_TABLE_NOT_EXIST)) { + if ((tsQueryTbNotExistAsEmpty && TD_RES_QUERY(&pRequest->resType) && pRequest->isQuery && + (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_TDB_TABLE_NOT_EXIST)) || + ((tsBypassFlag & TSDB_BYPASS_RB_RPC_SEND_SUBMIT) && (code == TSDB_CODE_RPC_BYPASS_SEND))) { code = TSDB_CODE_SUCCESS; pRequest->type = TSDB_SQL_RETRIEVE_EMPTY_RESULT; } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 6702b8b5888a..c0d0f5a6c408 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -362,6 +362,10 @@ static int32_t vnodePreProcessSubmitMsg(SVnode *pVnode, SRpcMsg *pMsg) { int32_t code = 0; int32_t lino = 0; + if (tsBypassFlag & TSDB_BYPASS_RA_RPC_RECV_SUBMIT) { + return TSDB_CODE_MSG_PREPROCESSED; + } + SDecoder *pCoder = &(SDecoder){0}; if (taosHton64(((SSubmitReq2Msg *)pMsg->pCont)->version) != 1) { @@ -1787,6 +1791,10 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in int32_t code = 0; terrno = 0; + if (tsBypassFlag & TSDB_BYPASS_RA_RPC_RECV_SUBMIT) { + return TSDB_CODE_MSG_PREPROCESSED; + } + SSubmitReq2 *pSubmitReq = &(SSubmitReq2){0}; SSubmitRsp2 *pSubmitRsp = &(SSubmitRsp2){0}; SArray *newTbUids = NULL; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index eefb32f78361..ced5c6f4a358 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -1021,10 +1021,12 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery _return: - if (pJob) { - SCH_TASK_ELOG("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); - } else { - qError("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); + if(code != TSDB_CODE_RPC_BYPASS_SEND) { + if (pJob) { + SCH_TASK_ELOG("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); + } else { + qError("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); + } } if (pMsgSendInfo) { diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index db9ecd602502..73ac26495aa3 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -172,7 +172,7 @@ void schedulerFreeJob(int64_t *jobId, int32_t errCode) { SSchJob *pJob = NULL; (void)schAcquireJob(*jobId, &pJob); if (NULL == pJob) { - qWarn("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); + qTrace("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); return; } diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index de129773a02b..a1e0342d83b1 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -190,6 +190,11 @@ int32_t rpcSendRequest(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t return transSendRequest(pInit, pEpSet, pMsg, NULL); } int32_t rpcSendRequestWithCtx(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) { + if ((tsBypassFlag & TSDB_BYPASS_RB_RPC_SEND_SUBMIT) && (pMsg->msgType == TDMT_VND_SUBMIT)) { + transFreeMsg(pMsg->pCont); + pMsg->pCont = NULL; + return TSDB_CODE_RPC_BYPASS_SEND; + } if (pCtx != NULL || pMsg->info.handle != 0 || pMsg->info.noResp != 0 || pRid == NULL) { return transSendRequest(pInit, pEpSet, pMsg, pCtx); } else { diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 0d8a85155aa1..227c55e5c093 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -61,7 +61,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MODULE_QUIT, "rpc module already qu TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_MODULE_QUIT, "rpc async module already quit") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_IN_PROCESS, "rpc async in process") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NO_STATE, "rpc no state") -TAOS_DEFINE_ERROR(TSDB_CODE_RPC_STATE_DROPED, "rpc state already dropped") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_STATE_DROPED, "rpc state already dropped") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BYPASS_SEND, "rpc bypass send") //common & util TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized") From 3ebb664953c3129fa7f62c64fcca100b4a629c92 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 18 Nov 2024 18:12:39 +0800 Subject: [PATCH 3/7] enh: add bypassFlag to facilitate performance testing --- source/client/src/clientImpl.c | 5 ++-- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 4 +++ source/dnode/vnode/src/vnd/vnodeSvr.c | 4 --- source/libs/scheduler/src/schRemote.c | 31 +++++++--------------- source/libs/transport/src/trans.c | 5 ---- 5 files changed, 15 insertions(+), 34 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index bc1e834ed8a4..8a0b1ddaab04 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -3108,9 +3108,8 @@ void taosAsyncFetchImpl(SRequestObj* pRequest, __taos_async_fn_t fp, void* param void doRequestCallback(SRequestObj* pRequest, int32_t code) { pRequest->inCallback = true; int64_t this = pRequest->self; - if ((tsQueryTbNotExistAsEmpty && TD_RES_QUERY(&pRequest->resType) && pRequest->isQuery && - (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_TDB_TABLE_NOT_EXIST)) || - ((tsBypassFlag & TSDB_BYPASS_RB_RPC_SEND_SUBMIT) && (code == TSDB_CODE_RPC_BYPASS_SEND))) { + if (tsQueryTbNotExistAsEmpty && TD_RES_QUERY(&pRequest->resType) && pRequest->isQuery && + (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_TDB_TABLE_NOT_EXIST)) { code = TSDB_CODE_SUCCESS; pRequest->type = TSDB_SQL_RETRIEVE_EMPTY_RESULT; } diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index eb223353110f..5b26d175197b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -122,6 +122,10 @@ int32_t tsdbInsertTableData(STsdb *pTsdb, int64_t version, SSubmitTbData *pSubmi tb_uid_t suid = pSubmitTbData->suid; tb_uid_t uid = pSubmitTbData->uid; + if (tsBypassFlag & TSDB_BYPASS_RB_TSDB_WRITE_MEM) { + goto _err; + } + // create/get STbData to op code = tsdbGetOrCreateTbData(pMemTable, suid, uid, &pTbData); if (code) { diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index c0d0f5a6c408..16c5e026d127 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1791,10 +1791,6 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in int32_t code = 0; terrno = 0; - if (tsBypassFlag & TSDB_BYPASS_RA_RPC_RECV_SUBMIT) { - return TSDB_CODE_MSG_PREPROCESSED; - } - SSubmitReq2 *pSubmitReq = &(SSubmitReq2){0}; SSubmitRsp2 *pSubmitRsp = &(SSubmitRsp2){0}; SArray *newTbUids = NULL; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index ced5c6f4a358..3321fdb4b579 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -1021,12 +1021,10 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery _return: - if(code != TSDB_CODE_RPC_BYPASS_SEND) { - if (pJob) { - SCH_TASK_ELOG("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); - } else { - qError("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); - } + if (pJob) { + SCH_TASK_ELOG("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); + } else { + qError("fail to send msg, type:%d, %s, error:%s", msgType, TMSG_INFO(msgType), tstrerror(code)); } if (pMsgSendInfo) { @@ -1347,30 +1345,19 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); } -#if 1 - SSchTrans trans = {.pTrans = pJob->conn.pTrans, .pHandle = SCH_GET_TASK_HANDLE(pTask)}; - code = schAsyncSendMsg(pJob, pTask, &trans, addr, msgType, msg, (uint32_t)msgSize, persistHandle, (rpcCtx.args ? &rpcCtx : NULL)); - msg = NULL; - SCH_ERR_JRET(code); - - if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY) { - SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execId)); - } -#else - if (TDMT_VND_SUBMIT != msgType) { + if ((tsBypassFlag & TSDB_BYPASS_RB_RPC_SEND_SUBMIT) && (TDMT_VND_SUBMIT == msgType)) { + taosMemoryFree(msg); + SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + } else { SSchTrans trans = {.pTrans = pJob->conn.pTrans, .pHandle = SCH_GET_TASK_HANDLE(pTask)}; - code = schAsyncSendMsg(pJob, pTask, &trans, addr, msgType, msg, msgSize, persistHandle, (rpcCtx.args ? &rpcCtx : NULL)); + code = schAsyncSendMsg(pJob, pTask, &trans, addr, msgType, msg, (uint32_t)msgSize, persistHandle, (rpcCtx.args ? &rpcCtx : NULL)); msg = NULL; SCH_ERR_JRET(code); if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY) { SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execId)); } - } else { - taosMemoryFree(msg); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); } -#endif return TSDB_CODE_SUCCESS; diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index a1e0342d83b1..de129773a02b 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -190,11 +190,6 @@ int32_t rpcSendRequest(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t return transSendRequest(pInit, pEpSet, pMsg, NULL); } int32_t rpcSendRequestWithCtx(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) { - if ((tsBypassFlag & TSDB_BYPASS_RB_RPC_SEND_SUBMIT) && (pMsg->msgType == TDMT_VND_SUBMIT)) { - transFreeMsg(pMsg->pCont); - pMsg->pCont = NULL; - return TSDB_CODE_RPC_BYPASS_SEND; - } if (pCtx != NULL || pMsg->info.handle != 0 || pMsg->info.noResp != 0 || pRid == NULL) { return transSendRequest(pInit, pEpSet, pMsg, pCtx); } else { From d1724bccd24df046905fe50d5bf84fa3125e98da Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 18 Nov 2024 20:03:25 +0800 Subject: [PATCH 4/7] test: add test case for alter bypassFlag --- tests/army/alter/alterConfig.py | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/army/alter/alterConfig.py b/tests/army/alter/alterConfig.py index f8c52551e3a3..d4ccca961357 100644 --- a/tests/army/alter/alterConfig.py +++ b/tests/army/alter/alterConfig.py @@ -100,6 +100,47 @@ def alterSupportVnodes(self): tdSql.query('show dnodes') tdSql.checkData(0, 3, "64") + def alterBypassFlag(self): + """Add test case for altering bypassFlag(TD-32907) + """ + tdSql.execute(f"drop database if exists db;") + tdSql.execute(f"create database db;") + tdSql.execute("use db;") + tdSql.execute("alter local 'bypassFlag 1';") + tdSql.execute("create table stb0(ts timestamp, c0 int) tags(t0 int);") + tdSql.execute("create table ctb0 using stb0 tags(0);") + tdSql.execute("insert into ctb0 values(now, 1);") + tdSql.query("select * from stb0;") + tdSql.checkRows(0) + tdSql.execute("alter local 'bypassFlag 0';") + tdSql.execute("alter all dnodes 'bypassFlag 2';") + tdSql.execute("insert into ctb0 values(now, 2);") + tdSql.query("select * from stb0;") + tdSql.checkRows(0) + tdSql.execute("alter all dnodes 'bypassFlag 4';") + tdSql.execute("insert into ctb0 values(now, 4);") + tdSql.execute("insert into ctb1 using stb0 tags(1) values(now, 10);") + tdSql.query("select * from stb0;") + tdSql.checkRows(0) + tdSql.query("show db.tables;") + tdSql.checkRows(2) + tdSql.execute("alter all dnodes 'bypassFlag 8';") + tdSql.execute("insert into ctb0 values(now, 8);") + tdSql.execute("insert into ctb1 values(now, 18);") + tdSql.query("select * from stb0;") + tdSql.checkRows(2) + tdSql.execute("flush database db;") + tdSql.query("select * from stb0;") + tdSql.checkRows(0) + tdSql.execute("alter all dnodes 'bypassFlag 0';") + tdSql.execute("insert into ctb0 values(now, 80);") + tdSql.execute("insert into ctb1 values(now, 180);") + tdSql.query("select * from stb0;") + tdSql.checkRows(2) + tdSql.execute("flush database db;") + tdSql.query("select * from stb0;") + tdSql.checkRows(2) + # run def run(self): tdLog.debug(f"start to excute {__file__}") @@ -110,6 +151,8 @@ def run(self): self.alterTtlConfig() # TS-5390 self.alterCachemodel() + # TD-32907 + self.alterBypassFlag() tdLog.success(f"{__file__} successfully executed") From d0236e1792b16994e2440218c32012bb1416670a Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 18 Nov 2024 20:09:19 +0800 Subject: [PATCH 5/7] chore: restore the error code --- include/util/taoserror.h | 3 +-- source/util/src/terror.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 863c2126571f..2c811495fdee 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -96,8 +96,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_RPC_ASYNC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0027) #define TSDB_CODE_RPC_ASYNC_IN_PROCESS TAOS_DEF_ERROR_CODE(0, 0x0028) #define TSDB_CODE_RPC_NO_STATE TAOS_DEF_ERROR_CODE(0, 0x0029) -#define TSDB_CODE_RPC_STATE_DROPED TAOS_DEF_ERROR_CODE(0, 0x002A) -#define TSDB_CODE_RPC_BYPASS_SEND TAOS_DEF_ERROR_CODE(0, 0x002B) +#define TSDB_CODE_RPC_STATE_DROPED TAOS_DEF_ERROR_CODE(0, 0x002A) //common & util #define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) // diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 227c55e5c093..0d8a85155aa1 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -61,8 +61,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MODULE_QUIT, "rpc module already qu TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_MODULE_QUIT, "rpc async module already quit") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_IN_PROCESS, "rpc async in process") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NO_STATE, "rpc no state") -TAOS_DEFINE_ERROR(TSDB_CODE_RPC_STATE_DROPED, "rpc state already dropped") -TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BYPASS_SEND, "rpc bypass send") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_STATE_DROPED, "rpc state already dropped") //common & util TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized") From a1c1d21c3c6dd96f2036d07850ebad326062ed73 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 19 Nov 2024 08:45:36 +0800 Subject: [PATCH 6/7] enh: test case for alter config --- tests/army/alter/alterConfig.py | 81 +++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/tests/army/alter/alterConfig.py b/tests/army/alter/alterConfig.py index d4ccca961357..ef8de0011b88 100644 --- a/tests/army/alter/alterConfig.py +++ b/tests/army/alter/alterConfig.py @@ -100,45 +100,68 @@ def alterSupportVnodes(self): tdSql.query('show dnodes') tdSql.checkData(0, 3, "64") + def checkKeyValue(self, res, key, value, ikey = 0, ival = 1): + result = False + for row in res: + if row[ikey] == key: + if row[ival] != value: + raise Exception(f"key:{key} value:{row[ival]} != {value}") + else: + tdLog.info(f"key:{key} value:{row[ival]} == {value}") + result = True + break + if not result: + raise Exception(f"key:{key} not found") + def alterBypassFlag(self): """Add test case for altering bypassFlag(TD-32907) """ - tdSql.execute(f"drop database if exists db;") - tdSql.execute(f"create database db;") - tdSql.execute("use db;") - tdSql.execute("alter local 'bypassFlag 1';") - tdSql.execute("create table stb0(ts timestamp, c0 int) tags(t0 int);") - tdSql.execute("create table ctb0 using stb0 tags(0);") - tdSql.execute("insert into ctb0 values(now, 1);") - tdSql.query("select * from stb0;") + tdSql.execute(f"drop database if exists db") + tdSql.execute(f"create database db") + tdSql.execute("use db") + self.checkKeyValue(tdSql.getResult("show local variables;"), "bypassFlag", "0") + self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "0", 1, 2) + tdSql.execute("alter local 'bypassFlag 1'") + self.checkKeyValue(tdSql.getResult("show local variables;"), "bypassFlag", "1") + self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "0", 1, 2) + tdSql.execute("create table stb0(ts timestamp, c0 int) tags(t0 int)") + tdSql.execute("create table ctb0 using stb0 tags(0)") + tdSql.execute("insert into ctb0 values(now, 1)") + tdSql.query("select * from stb0") tdSql.checkRows(0) - tdSql.execute("alter local 'bypassFlag 0';") - tdSql.execute("alter all dnodes 'bypassFlag 2';") - tdSql.execute("insert into ctb0 values(now, 2);") - tdSql.query("select * from stb0;") + tdSql.execute("alter local 'bypassFlag 0'") + tdSql.execute("alter all dnodes 'bypassFlag 2'") + self.checkKeyValue(tdSql.getResult("show local variables"), "bypassFlag", "0") + self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "2", 1, 2) + tdSql.execute("insert into ctb0 values(now, 2)") + tdSql.query("select * from stb0") tdSql.checkRows(0) - tdSql.execute("alter all dnodes 'bypassFlag 4';") - tdSql.execute("insert into ctb0 values(now, 4);") - tdSql.execute("insert into ctb1 using stb0 tags(1) values(now, 10);") - tdSql.query("select * from stb0;") + tdSql.execute("alter all dnodes 'bypassFlag 4'") + self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "4", 1, 2) + tdSql.execute("insert into ctb0 values(now, 4)") + tdSql.execute("insert into ctb1 using stb0 tags(1) values(now, 10)") + tdSql.query("select * from stb0") tdSql.checkRows(0) - tdSql.query("show db.tables;") + tdSql.query("show db.tables") tdSql.checkRows(2) - tdSql.execute("alter all dnodes 'bypassFlag 8';") - tdSql.execute("insert into ctb0 values(now, 8);") - tdSql.execute("insert into ctb1 values(now, 18);") - tdSql.query("select * from stb0;") + tdSql.execute("alter all dnodes 'bypassFlag 8'") + self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "8", 1, 2) + tdSql.execute("insert into ctb0 values(now, 8)") + tdSql.execute("insert into ctb1 values(now, 18)") + tdSql.query("select * from stb0") tdSql.checkRows(2) - tdSql.execute("flush database db;") - tdSql.query("select * from stb0;") + tdSql.execute("flush database db") + tdSql.query("select * from stb0") tdSql.checkRows(0) - tdSql.execute("alter all dnodes 'bypassFlag 0';") - tdSql.execute("insert into ctb0 values(now, 80);") - tdSql.execute("insert into ctb1 values(now, 180);") - tdSql.query("select * from stb0;") + tdSql.execute("alter all dnodes 'bypassFlag 0'") + self.checkKeyValue(tdSql.getResult("show local variables"), "bypassFlag", "0") + self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "0", 1, 2) + tdSql.execute("insert into ctb0 values(now, 80)") + tdSql.execute("insert into ctb1 values(now, 180)") + tdSql.query("select * from stb0") tdSql.checkRows(2) - tdSql.execute("flush database db;") - tdSql.query("select * from stb0;") + tdSql.execute("flush database db") + tdSql.query("select * from stb0") tdSql.checkRows(2) # run From ca49a3eaf06afca6f6a006da92f8a0d5a11e2de8 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 19 Nov 2024 09:01:45 +0800 Subject: [PATCH 7/7] chore: restore the code change --- source/libs/scheduler/src/scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 73ac26495aa3..db9ecd602502 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -172,7 +172,7 @@ void schedulerFreeJob(int64_t *jobId, int32_t errCode) { SSchJob *pJob = NULL; (void)schAcquireJob(*jobId, &pJob); if (NULL == pJob) { - qTrace("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); + qWarn("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); return; }