提交 b74721d3 编写于 作者: C Cary Xu

[TD-11437]<feature>(connector,query,insert,other,tools,taosAdapter):add...

[TD-11437]<feature>(connector,query,insert,other,tools,taosAdapter):add shortcutFlag to facilitate analysis of insert performance
上级 c5d64b3a
......@@ -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){
......
......@@ -333,6 +333,11 @@ int tscSendMsgToServer(SSqlObj *pSql) {
.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;
}
......
......@@ -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
......
......@@ -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";
......
......@@ -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
......
......@@ -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 {
......
......@@ -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));
......
......@@ -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
......
......@@ -103,7 +103,9 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
}
// write into WAL
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册