diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 2ddae0f903a6c42235343a6dd526d37e53147734..036a95fe15b0062fe5daff336cb4e6bda85b34b6 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -313,7 +313,12 @@ static void tscAsyncResultCallback(SSchedMsg *pMsg) { } assert(pSql->res.code != TSDB_CODE_SUCCESS); - tscError("0x%"PRIx64" async result callback, code:%s", pSql->self, tstrerror(pSql->res.code)); + if (tsShortcutFlag) { + tscDebug("0x%" PRIx64 " async result callback, code:%s", pSql->self, tstrerror(pSql->res.code)); + pSql->res.code = TSDB_CODE_SUCCESS; + } else { + tscError("0x%" PRIx64 " async result callback, code:%s", pSql->self, tstrerror(pSql->res.code)); + } SSqlRes *pRes = &pSql->res; if (pSql->fp == NULL || pSql->fetchFp == NULL){ diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 3849e90ce4526ea974792969217473eb8aef5925..22ddea557efb7de1a29b96a89e90161fa3c57b4e 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -332,7 +332,12 @@ int tscSendMsgToServer(SSqlObj *pSql) { .handle = NULL, .code = 0 }; - + + if ((rpcMsg.msgType == TSDB_MSG_TYPE_SUBMIT) && (tsShortcutFlag & TSDB_SHORTCUT_RPC_SEND_SUBMIT)) { + rpcFreeCont(rpcMsg.pCont); + return TSDB_CODE_FAILED; + } + rpcSendRequest(pObj->pRpcObj->pDnodeConn, &pSql->epSet, &rpcMsg, &pSql->rpcRid); return TSDB_CODE_SUCCESS; } diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 890bed123bb1a03c93d676b1b12495c7a8b65ade..e1a4fe6eb8409a1d43ea5e8099f97163c6c4b8c0 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -64,6 +64,7 @@ extern int32_t tsCompressMsgSize; extern int32_t tsCompressColData; extern int32_t tsMaxNumOfDistinctResults; extern char tsTempDir[]; +extern int32_t tsShortcutFlag; // query buffer management extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 2b84c486a38fbb2654cbac6fd64ccf3d6fce05da..3c82a97d610ee68fc9bb53bf59eaa5f3769cc8dc 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -65,6 +65,7 @@ char tsLocale[TSDB_LOCALE_LEN] = {0}; char tsCharset[TSDB_LOCALE_LEN] = {0}; // default encode string int8_t tsEnableCoreFile = 0; int32_t tsMaxBinaryDisplayWidth = 30; +int32_t tsShortcutFlag = 0; // shortcut flag to facilitate debugging /* * denote if the server needs to compress response message at the application layer to client, including query rsp, @@ -1749,6 +1750,17 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_MB; taosInitConfigOption(cfg); + // shortcut flag to facilitate debugging + cfg.option = "shortcutFlag"; + cfg.ptr = &tsShortcutFlag; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT; + cfg.minValue = 0; + cfg.maxValue = INT32_MAX; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + #ifdef TD_TSZ // lossy compress cfg.option = "lossyColumns"; diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index c5d65b831a4803c4da76dc848027a963800bcae2..b23e3f3e1c3abda326a09c2a6ba3a2ccb73ce066 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -417,6 +417,11 @@ do { \ #define TSDB_DEFAULT_STABLES_HASH_SIZE 100 #define TSDB_DEFAULT_CTABLES_HASH_SIZE 20000 +#define TSDB_SHORTCUT_RPC_SEND_SUBMIT 0x01u +#define TSDB_SHORTCUT_RPC_RECV_SUBMIT 0x02u +#define TSDB_SHORTCUT_VNODE_WAL_WRITE 0x04u +#define TSDB_SHORTCUT_TSDB_COMMIT 0x08u + #define TSDB_PORT_DNODESHELL 0 #define TSDB_PORT_DNODEDNODE 5 #define TSDB_PORT_SYNC 10 diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index c2bebaeee6cc21acab197e92b77358ddba42b0ff..60a5837fec8ace0fb01178737fe471a92d88e433 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1160,6 +1160,19 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte rpcMsg.handle = pConn; rpcAddRef(pRpc); // add the refCount for requests + switch (rpcMsg.msgType) { + case TSDB_MSG_TYPE_SUBMIT: + if ((tsShortcutFlag & TSDB_SHORTCUT_RPC_RECV_SUBMIT)) { + SRpcMsg rMsg = {.handle = rpcMsg.handle, .pCont = NULL, .contLen = 0}; + rpcSendResponse(&rMsg); + rpcFreeCont(rpcMsg.pCont); + return; + } + break; + default: + break; + } + // notify the server app (*(pRpc->cfp))(&rpcMsg, NULL); } else { diff --git a/src/tsdb/src/tsdbCommit.c b/src/tsdb/src/tsdbCommit.c index db675d0427901f55e676a17592f0c131820e8718..cd2ea7214a18a4565cc7eb00bcf6c747924ee981 100644 --- a/src/tsdb/src/tsdbCommit.c +++ b/src/tsdb/src/tsdbCommit.c @@ -98,6 +98,11 @@ void *tsdbCommitData(STsdbRepo *pRepo) { } tsdbStartCommit(pRepo); + if (tsShortcutFlag & TSDB_SHORTCUT_TSDB_COMMIT) { + tsdbEndCommit(pRepo, terrno); + return NULL; + } + // Commit to update meta file if (tsdbCommitMeta(pRepo) < 0) { tsdbError("vgId:%d error occurs while committing META data since %s", REPO_ID(pRepo), tstrerror(terrno)); diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index fd9a340a25a752b18ab07a8fbb2691038af3b71b..752930ed7e762eac31c77b8c1c1a91aa626ef16a 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define TSDB_CFG_MAX_NUM 131 +#define TSDB_CFG_MAX_NUM 132 #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 40148fcc6d34196bed1997cb2499a4202a460fe2..a3464f75ba63fd3d40312ff966de1b50261cf7e0 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -103,7 +103,9 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara } // write into WAL - code = walWrite(pVnode->wal, pHead); + if (!(tsShortcutFlag & TSDB_SHORTCUT_VNODE_WAL_WRITE)) { + code = walWrite(pVnode->wal, pHead); + } if (code < 0) { if (syncCode > 0) atomic_sub_fetch_32(&pWrite->processedCount, 1); vError("vgId:%d, hver:%" PRIu64 " vver:%" PRIu64 " code:0x%x", pVnode->vgId, pHead->version, pVnode->version, code);