From 7b5edade957dd3c2d5348637ecf7d164a459eb8d Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 20 Feb 2025 19:50:37 +0800 Subject: [PATCH 01/22] fix:[TD-337958]send batch metadata & remove data if subscribe only meta --- source/dnode/vnode/src/tq/tqRead.c | 16 +++ source/dnode/vnode/src/tq/tqScan.c | 4 +- source/dnode/vnode/src/tq/tqUtil.c | 171 +++++++++++++++++++---------- 3 files changed, 134 insertions(+), 57 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index d650ae9751..ee705ed374 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -1098,6 +1098,22 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SMqDataRsp* pRsp, SArray* block *pSubmitTbDataRet = pSubmitTbData; } + if (fetchMeta == ONLY_META) { + if (pSubmitTbData->pCreateTbReq != NULL) { + if (pRsp->createTableReq == NULL){ + pRsp->createTableReq = taosArrayInit(0, POINTER_BYTES); + if (pRsp->createTableReq == NULL){ + return terrno; + } + } + if (taosArrayPush(pRsp->createTableReq, &pSubmitTbData->pCreateTbReq) == NULL){ + return terrno; + } + pSubmitTbData->pCreateTbReq = NULL; + } + return 0; + } + int32_t sversion = pSubmitTbData->sver; int64_t uid = pSubmitTbData->uid; pReader->lastBlkUid = uid; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 70a165906e..9d1b99f483 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -339,6 +339,9 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, int bool tmp = (pSubmitTbData->flags & pRequest->sourceExcluded) != 0; TSDB_CHECK_CONDITION(!tmp, code, lino, END, TSDB_CODE_SUCCESS); + if (pHandle->fetchMeta == ONLY_META){ + goto END; + } int32_t blockNum = taosArrayGetSize(pBlocks) == 0 ? 1 : taosArrayGetSize(pBlocks); if (pRsp->withTbName) { @@ -347,7 +350,6 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, int TSDB_CHECK_CODE(code, lino, END); } - tmp = (pHandle->fetchMeta == ONLY_META && pSubmitTbData->pCreateTbReq == NULL); TSDB_CHECK_CONDITION(!tmp, code, lino, END, TSDB_CODE_SUCCESS); for (int32_t i = 0; i < blockNum; i++) { if (taosArrayGetSize(pBlocks) == 0){ diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 9866528446..4d908b5d57 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -226,6 +226,82 @@ static void tDeleteCommon(void* parm) {} taosxRsp.createTableNum > 0 ? TMQ_MSG_TYPE__POLL_DATA_META_RSP : \ (pRequest->rawData == 1 ? TMQ_MSG_TYPE__POLL_RAW_DATA_RSP : TMQ_MSG_TYPE__POLL_DATA_RSP) +static int32_t buildBatchMeta(SMqBatchMetaRsp *btMetaRsp, int16_t type, int32_t bodyLen, void* body){ + int32_t code = 0; + + if (!btMetaRsp->batchMetaReq) { + btMetaRsp->batchMetaReq = taosArrayInit(4, POINTER_BYTES); + TQ_NULL_GO_TO_END(btMetaRsp->batchMetaReq); + btMetaRsp->batchMetaLen = taosArrayInit(4, sizeof(int32_t)); + TQ_NULL_GO_TO_END(btMetaRsp->batchMetaLen); + } + + SMqMetaRsp tmpMetaRsp = {0}; + tmpMetaRsp.resMsgType = type; + tmpMetaRsp.metaRspLen = bodyLen; + tmpMetaRsp.metaRsp = body; + uint32_t len = 0; + tEncodeSize(tEncodeMqMetaRsp, &tmpMetaRsp, len, code); + if (TSDB_CODE_SUCCESS != code) { + tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); + goto END; + } + int32_t tLen = sizeof(SMqRspHead) + len; + void* tBuf = taosMemoryCalloc(1, tLen); + TQ_NULL_GO_TO_END(tBuf); + void* metaBuff = POINTER_SHIFT(tBuf, sizeof(SMqRspHead)); + SEncoder encoder = {0}; + tEncoderInit(&encoder, metaBuff, len); + code = tEncodeMqMetaRsp(&encoder, &tmpMetaRsp); + tEncoderClear(&encoder); + + if (code < 0) { + tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); + goto END; + } + TQ_NULL_GO_TO_END (taosArrayPush(btMetaRsp->batchMetaReq, &tBuf)); + TQ_NULL_GO_TO_END (taosArrayPush(btMetaRsp->batchMetaLen, &tLen)); + +END: + return code; +} + +static int32_t buildBatchCreateContent(SMqDataRsp *taosxRsp, void** pBuf, int32_t *len){ + int32_t code = 0; + SVCreateTbBatchReq pReq = {0}; + pReq.nReqs = taosArrayGetSize(taosxRsp->createTableReq); + pReq.pArray = taosArrayInit(1, sizeof(struct SVCreateTbReq)); + TQ_NULL_GO_TO_END(pReq.pArray); + for (int i = 0; i < taosArrayGetSize(taosxRsp->createTableReq); i++){ + void *createTableReq = taosArrayGetP(taosxRsp->createTableReq, i); + TQ_NULL_GO_TO_END(taosArrayPush(pReq.pArray, createTableReq)); + } + tEncodeSize(tEncodeSVCreateTbBatchReq, &pReq, *len, code); + if (code < 0) { + goto END; + } + len += sizeof(SMsgHead); + *pBuf = taosMemoryMalloc(*len); + TQ_NULL_GO_TO_END(pBuf); + SEncoder coder = {0}; + tEncoderInit(&coder, POINTER_SHIFT(*pBuf, sizeof(SMsgHead)), *len); + code = tEncodeSVCreateTbBatchReq(&coder, &pReq); + tEncoderClear(&coder); + +END: + taosArrayDestroy(pReq.pArray); + return code; +} + +#define SEND_BATCH_META_RSP \ +tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer);\ +code = tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId);\ +goto END; + +#define SEND_DATA_RSP \ +tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer);\ +code = tqSendDataRsp(pHandle, pMsg, pRequest, &taosxRsp, POLL_RSP_TYPE(pRequest, taosxRsp), vgId);\ +goto END; static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, STqOffsetVal* offset) { int32_t vgId = TD_VID(pTq->pVnode); @@ -261,6 +337,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, uint64_t st = taosGetTimestampMs(); int totalRows = 0; int32_t totalMetaRows = 0; + int32_t totalAutoMetaRows = 0; while (1) { int32_t savedEpoch = atomic_load_32(&pHandle->epoch); if (savedEpoch > pRequest->epoch) { @@ -271,15 +348,10 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, } if (tqFetchLog(pTq, pHandle, &fetchVer, pRequest->reqId) < 0) { - if (totalMetaRows > 0) { - tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); - code = tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); - goto END; + if (totalMetaRows > 0 || totalAutoMetaRows > 0) { + SEND_BATCH_META_RSP } - tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer); - code = tqSendDataRsp(pHandle, pMsg, pRequest, &taosxRsp, - POLL_RSP_TYPE(pRequest, taosxRsp), vgId); - goto END; + SEND_DATA_RSP } SWalCont* pHead = &pHandle->pWalReader->pHead->head; @@ -288,11 +360,11 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, // process meta if (pHead->msgType != TDMT_VND_SUBMIT) { + if (totalAutoMetaRows > 0){ + SEND_BATCH_META_RSP + } if (totalRows > 0) { - tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer); - code = tqSendDataRsp(pHandle, pMsg, pRequest, &taosxRsp, - POLL_RSP_TYPE(pRequest, taosxRsp), vgId); - goto END; + SEND_DATA_RSP } if ((pRequest->sourceExcluded & TD_REQ_FROM_TAOX) != 0) { @@ -318,53 +390,20 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, code = tqSendMetaPollRsp(pHandle, pMsg, pRequest, &metaRsp, vgId); goto END; } - - if (!btMetaRsp.batchMetaReq) { - btMetaRsp.batchMetaReq = taosArrayInit(4, POINTER_BYTES); - TQ_NULL_GO_TO_END(btMetaRsp.batchMetaReq); - btMetaRsp.batchMetaLen = taosArrayInit(4, sizeof(int32_t)); - TQ_NULL_GO_TO_END(btMetaRsp.batchMetaLen); - } + code = buildBatchMeta(&btMetaRsp, pHead->msgType, pHead->bodyLen, pHead->body); fetchVer++; - - SMqMetaRsp tmpMetaRsp = {0}; - tmpMetaRsp.resMsgType = pHead->msgType; - tmpMetaRsp.metaRspLen = pHead->bodyLen; - tmpMetaRsp.metaRsp = pHead->body; - uint32_t len = 0; - tEncodeSize(tEncodeMqMetaRsp, &tmpMetaRsp, len, code); - if (TSDB_CODE_SUCCESS != code) { - tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); + if (code != 0){ continue; } - int32_t tLen = sizeof(SMqRspHead) + len; - void* tBuf = taosMemoryCalloc(1, tLen); - TQ_NULL_GO_TO_END(tBuf); - void* metaBuff = POINTER_SHIFT(tBuf, sizeof(SMqRspHead)); - SEncoder encoder = {0}; - tEncoderInit(&encoder, metaBuff, len); - code = tEncodeMqMetaRsp(&encoder, &tmpMetaRsp); - tEncoderClear(&encoder); - - if (code < 0) { - tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); - continue; - } - TQ_NULL_GO_TO_END (taosArrayPush(btMetaRsp.batchMetaReq, &tBuf)); - TQ_NULL_GO_TO_END (taosArrayPush(btMetaRsp.batchMetaLen, &tLen)); totalMetaRows++; if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || (taosGetTimestampMs() - st > pRequest->timeout)) { - tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); - code = tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); - goto END; + SEND_BATCH_META_RSP } continue; } if (totalMetaRows > 0) { - tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); - code = tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); - goto END; + SEND_BATCH_META_RSP } // process data @@ -376,17 +415,37 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, TQ_ERR_GO_TO_END(tqTaosxScanLog(pTq, pHandle, submit, &taosxRsp, &totalRows, pRequest)); + if (pHandle->fetchMeta == ONLY_META){ + int32_t len = 0; + void *pBuf = NULL; + code = buildBatchCreateContent(&taosxRsp, &pBuf, &len); + if (code == 0){ + code = buildBatchMeta(&btMetaRsp, TDMT_VND_CREATE_TABLE, len, pBuf); + } + taosMemoryFree(pBuf); + taosArrayDestroyP(taosxRsp.createTableReq, NULL); + taosxRsp.createTableReq = NULL; + fetchVer++; + if (code != 0){ + continue; + } + totalAutoMetaRows ++; + if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || (taosGetTimestampMs() - st > pRequest->timeout)) { + SEND_BATCH_META_RSP + } + continue; + } + if ((pRequest->rawData == 0 && totalRows >= pRequest->minPollRows) || (taosGetTimestampMs() - st > pRequest->timeout) || (pRequest->rawData != 0 && (taosArrayGetSize(taosxRsp.blockData) > pRequest->minPollRows || terrno == TSDB_CODE_TMQ_RAW_DATA_SPLIT))) { -// tqDebug("start to send rsp, block num:%d, totalRows:%d, createTableNum:%d, terrno:%d", -// (int)taosArrayGetSize(taosxRsp.blockData), totalRows, taosxRsp.createTableNum, terrno); - tqOffsetResetToLog(&taosxRsp.rspOffset, terrno == TSDB_CODE_TMQ_RAW_DATA_SPLIT ? fetchVer : fetchVer + 1); - code = tqSendDataRsp(pHandle, pMsg, pRequest, &taosxRsp, - POLL_RSP_TYPE(pRequest, taosxRsp), vgId); - if (terrno == TSDB_CODE_TMQ_RAW_DATA_SPLIT){terrno = 0;} - goto END; + if (terrno == TSDB_CODE_TMQ_RAW_DATA_SPLIT){ + terrno = 0; + } else{ + fetchVer++; + } + SEND_DATA_RSP } else { fetchVer++; } From e594c2bbd585f49261d8ab9c43e77e1973029d72 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 21 Feb 2025 11:49:17 +0800 Subject: [PATCH 02/22] feat:[TD-33798]modify metadata logic for tmq --- source/common/src/tglobal.c | 2 +- source/dnode/vnode/src/tq/tqScan.c | 22 +- source/dnode/vnode/src/tq/tqUtil.c | 22 +- tests/parallel_test/cases.task | 1 - tests/parallel_test/cases_tdengine.task | 2 +- .../7-tmq/{tmq_ts-5473.py => tmq_c_test.py} | 8 + tests/system-test/7-tmq/tmq_taosx.py | 48 +-- tests/system-test/7-tmq/tmq_ts-5776.py | 39 --- utils/test/c/CMakeLists.txt | 8 + utils/test/c/tmq_td33798.c | 312 ++++++++++++++++++ 10 files changed, 375 insertions(+), 89 deletions(-) rename tests/system-test/7-tmq/{tmq_ts-5473.py => tmq_c_test.py} (81%) delete mode 100644 tests/system-test/7-tmq/tmq_ts-5776.py create mode 100644 utils/test/c/tmq_td33798.c diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 2fd16b4f67..6369358008 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -188,7 +188,7 @@ char tsCheckpointBackupDir[PATH_MAX] = "/var/lib/taos/backup/checkpoint/"; // tmq int32_t tmqMaxTopicNum = 20; -int32_t tmqRowSize = 4096; +int32_t tmqRowSize = 1000; // query int32_t tsQueryPolicy = 1; bool tsQueryTbNotExistAsEmpty = false; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 9d1b99f483..549a47d006 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -405,14 +405,16 @@ static void preProcessSubmitMsg(STqHandle* pHandle, const SMqPollReq* pRequest, } int64_t uid = pSubmitTbData->uid; - if (taosHashGet(pRequest->uidHash, &uid, LONG_BYTES) != NULL) { - tqDebug("poll rawdata split,uid:%" PRId64 " is already exists", uid); - terrno = TSDB_CODE_TMQ_RAW_DATA_SPLIT; - return; - } else { - int32_t code = taosHashPut(pRequest->uidHash, &uid, LONG_BYTES, &uid, LONG_BYTES); - if (code != 0){ - tqError("failed to add table uid to hash, code:%d, uid:%"PRId64, code, uid); + if (pRequest->rawData) { + if (taosHashGet(pRequest->uidHash, &uid, LONG_BYTES) != NULL) { + tqDebug("poll rawdata split,uid:%" PRId64 " is already exists", uid); + terrno = TSDB_CODE_TMQ_RAW_DATA_SPLIT; + return; + } else { + int32_t code = taosHashPut(pRequest->uidHash, &uid, LONG_BYTES, &uid, LONG_BYTES); + if (code != 0) { + tqError("failed to add table uid to hash, code:%d, uid:%" PRId64, code, uid); + } } } @@ -455,9 +457,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, SMqData } code = tqReaderSetSubmitMsg(pReader, submit.msgStr, submit.msgLen, submit.ver, rawList); TSDB_CHECK_CODE(code, lino, END); - if (pRequest->rawData) { - preProcessSubmitMsg(pHandle, pRequest, &rawList); - } + preProcessSubmitMsg(pHandle, pRequest, &rawList); // data could not contains same uid data in rawdata mode if (pRequest->rawData != 0 && terrno == TSDB_CODE_TMQ_RAW_DATA_SPLIT){ goto END; diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 4d908b5d57..7dc9a88164 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -266,7 +266,7 @@ END: return code; } -static int32_t buildBatchCreateContent(SMqDataRsp *taosxRsp, void** pBuf, int32_t *len){ +static int32_t buildCreateTbBatchReqBinary(SMqDataRsp *taosxRsp, void** pBuf, int32_t *len){ int32_t code = 0; SVCreateTbBatchReq pReq = {0}; pReq.nReqs = taosArrayGetSize(taosxRsp->createTableReq); @@ -280,7 +280,7 @@ static int32_t buildBatchCreateContent(SMqDataRsp *taosxRsp, void** pBuf, int32_ if (code < 0) { goto END; } - len += sizeof(SMsgHead); + *len += sizeof(SMsgHead); *pBuf = taosMemoryMalloc(*len); TQ_NULL_GO_TO_END(pBuf); SEncoder coder = {0}; @@ -337,7 +337,6 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, uint64_t st = taosGetTimestampMs(); int totalRows = 0; int32_t totalMetaRows = 0; - int32_t totalAutoMetaRows = 0; while (1) { int32_t savedEpoch = atomic_load_32(&pHandle->epoch); if (savedEpoch > pRequest->epoch) { @@ -348,7 +347,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, } if (tqFetchLog(pTq, pHandle, &fetchVer, pRequest->reqId) < 0) { - if (totalMetaRows > 0 || totalAutoMetaRows > 0) { + if (totalMetaRows > 0) { SEND_BATCH_META_RSP } SEND_DATA_RSP @@ -360,9 +359,6 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, // process meta if (pHead->msgType != TDMT_VND_SUBMIT) { - if (totalAutoMetaRows > 0){ - SEND_BATCH_META_RSP - } if (totalRows > 0) { SEND_DATA_RSP } @@ -402,7 +398,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, continue; } - if (totalMetaRows > 0) { + if (totalMetaRows > 0 && pHandle->fetchMeta != ONLY_META) { SEND_BATCH_META_RSP } @@ -415,10 +411,10 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, TQ_ERR_GO_TO_END(tqTaosxScanLog(pTq, pHandle, submit, &taosxRsp, &totalRows, pRequest)); - if (pHandle->fetchMeta == ONLY_META){ + if (pHandle->fetchMeta == ONLY_META && taosArrayGetSize(taosxRsp.createTableReq) > 0){ int32_t len = 0; void *pBuf = NULL; - code = buildBatchCreateContent(&taosxRsp, &pBuf, &len); + code = buildCreateTbBatchReqBinary(&taosxRsp, &pBuf, &len); if (code == 0){ code = buildBatchMeta(&btMetaRsp, TDMT_VND_CREATE_TABLE, len, pBuf); } @@ -429,8 +425,10 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, if (code != 0){ continue; } - totalAutoMetaRows ++; - if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || (taosGetTimestampMs() - st > pRequest->timeout)) { + totalMetaRows++; + if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || + (taosGetTimestampMs() - st > pRequest->timeout) || + (!pRequest->enableBatchMeta && !pRequest->useSnapshot)) { SEND_BATCH_META_RSP } continue; diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 0d14722aaf..b56dabe7cf 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -455,7 +455,6 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts5466.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_td33504.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts-5473.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts-5776.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts5906.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/td-32187.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/td-33225.py diff --git a/tests/parallel_test/cases_tdengine.task b/tests/parallel_test/cases_tdengine.task index e52fe68957..18c50322ad 100644 --- a/tests/parallel_test/cases_tdengine.task +++ b/tests/parallel_test/cases_tdengine.task @@ -298,7 +298,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_taosx.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts5466.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts-5473.py +,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_c_test.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/td-32187.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/td-33225.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts4563.py diff --git a/tests/system-test/7-tmq/tmq_ts-5473.py b/tests/system-test/7-tmq/tmq_c_test.py similarity index 81% rename from tests/system-test/7-tmq/tmq_ts-5473.py rename to tests/system-test/7-tmq/tmq_c_test.py index ad08fa559c..a2ed4aa708 100644 --- a/tests/system-test/7-tmq/tmq_ts-5473.py +++ b/tests/system-test/7-tmq/tmq_c_test.py @@ -29,6 +29,14 @@ class TDTestCase: tdLog.info(cmdStr) os.system(cmdStr) + cmdStr = '%s/build/bin/tmq_ts5776'%(buildPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + cmdStr = '%s/build/bin/tmq_td33798'%(buildPath) + tdLog.info(cmdStr) + os.system(cmdStr) + return def stop(self): diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index 845e7229a8..053b29c013 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -677,34 +677,34 @@ class TDTestCase: tdSql.execute(f'drop database d1') def run(self): - self.consume_TS_5067_Test() - self.consumeTest() - self.consume_ts_4544() - self.consume_ts_4551() - self.consume_TS_4540_Test() - self.consume_td_31283() + # self.consume_TS_5067_Test() + # self.consumeTest() + # self.consume_ts_4544() + # self.consume_ts_4551() + # self.consume_TS_4540_Test() + # self.consume_td_31283() tdSql.prepare() self.checkWal1VgroupOnlyMeta() - self.checkWal1Vgroup() - self.checkSnapshot1Vgroup() - - self.checkWal1VgroupTable() - self.checkSnapshot1VgroupTable() - - self.checkWalMultiVgroups() - self.checkWalMultiVgroupsRawData() - self.checkSnapshotMultiVgroups() - - self.checkWalMultiVgroupsWithDropTable() - - self.checkSnapshotMultiVgroupsWithDropTable() - - self.checkSnapshot1VgroupBtmeta() - self.checkSnapshot1VgroupTableBtmeta() - self.checkSnapshotMultiVgroupsBtmeta() - self.checkSnapshotMultiVgroupsWithDropTableBtmeta() + # self.checkWal1Vgroup() + # self.checkSnapshot1Vgroup() + # + # self.checkWal1VgroupTable() + # self.checkSnapshot1VgroupTable() + # + # self.checkWalMultiVgroups() + # self.checkWalMultiVgroupsRawData() + # self.checkSnapshotMultiVgroups() + # + # self.checkWalMultiVgroupsWithDropTable() + # + # self.checkSnapshotMultiVgroupsWithDropTable() + # + # self.checkSnapshot1VgroupBtmeta() + # self.checkSnapshot1VgroupTableBtmeta() + # self.checkSnapshotMultiVgroupsBtmeta() + # self.checkSnapshotMultiVgroupsWithDropTableBtmeta() def stop(self): tdSql.close() diff --git a/tests/system-test/7-tmq/tmq_ts-5776.py b/tests/system-test/7-tmq/tmq_ts-5776.py deleted file mode 100644 index 738d69701f..0000000000 --- a/tests/system-test/7-tmq/tmq_ts-5776.py +++ /dev/null @@ -1,39 +0,0 @@ - -import taos -import sys -import time -import socket -import os -import threading - -from util.log import * -from util.sql import * -from util.cases import * -from util.dnodes import * -from util.common import * -from taos.tmq import * -sys.path.append("./7-tmq") -from tmqCommon import * - -class TDTestCase: - updatecfgDict = {'debugFlag': 135, 'asynclog': 0} - def init(self, conn, logSql, replicaVar=1): - self.replicaVar = int(replicaVar) - tdLog.debug(f"start to excute {__file__}") - tdSql.init(conn.cursor()) - #tdSql.init(conn.cursor(), logSql) # output sql.txt file - - def run(self): - buildPath = tdCom.getBuildPath() - cmdStr = '%s/build/bin/tmq_ts5776'%(buildPath) - tdLog.info(cmdStr) - os.system(cmdStr) - - return - - def stop(self): - tdSql.close() - tdLog.success(f"{__file__} successfully executed") - -tdCases.addLinux(__file__, TDTestCase()) -tdCases.addWindows(__file__, TDTestCase()) diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt index d73f91aad3..1b2716b8e5 100644 --- a/utils/test/c/CMakeLists.txt +++ b/utils/test/c/CMakeLists.txt @@ -8,6 +8,7 @@ add_executable(tmq_td32526 tmq_td32526.c) add_executable(tmq_td32187 tmq_td32187.c) add_executable(tmq_ts5776 tmq_ts5776.c) add_executable(tmq_td32471 tmq_td32471.c) +add_executable(tmq_td33798 tmq_td33798.c) add_executable(tmq_write_raw_test tmq_write_raw_test.c) add_executable(write_raw_block_test write_raw_block_test.c) add_executable(sml_test sml_test.c) @@ -81,6 +82,13 @@ target_link_libraries( PUBLIC common PUBLIC os ) +target_link_libraries( + tmq_td33798 + PUBLIC ${TAOS_LIB} + PUBLIC util + PUBLIC common + PUBLIC os +) target_link_libraries( tmq_td32526 PUBLIC ${TAOS_LIB} diff --git a/utils/test/c/tmq_td33798.c b/utils/test/c/tmq_td33798.c new file mode 100644 index 0000000000..a029b17b61 --- /dev/null +++ b/utils/test/c/tmq_td33798.c @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include "cJSON.h" +#include "taos.h" +#include "tmsg.h" +#include "types.h" + +bool batchMeta = false; +int32_t consumeIndex = 0; +static TAOS* use_db() { + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + if (pConn == NULL) { + return NULL; + } + + TAOS_RES* pRes = taos_query(pConn, "use db_taosx"); + if (taos_errno(pRes) != 0) { + printf("error in use db_taosx, reason:%s\n", taos_errstr(pRes)); + return NULL; + } + taos_free_result(pRes); + return pConn; +} + +void checkBatchMeta(TAOS_RES* msg){ + char* result = tmq_get_json_meta(msg); + printf("meta result: %s\n", result); + switch (consumeIndex) { + case 0: + ASSERT(strcmp(result, "{\"tmq_meta_version\":\"1.0\",\"metas\":[{\"type\":\"create\",\"tableType\":\"super\",\"tableName\":\"st1\",\"columns\":[{\"name\":\"ts\",\"type\":9,\"isPrimarykey\":false,\"encode\":\"delta-i\",\"compress\":\"lz4\",\"level\":\"medium\"},{\"name\":\"c1\",\"type\":4,\"isPrimarykey\":false,\"encode\":\"simple8b\",\"compress\":\"lz4\",\"level\":\"medium\"},{\"name\":\"c2\",\"type\":6,\"isPrimarykey\":false,\"encode\":\"delta-d\",\"compress\":\"lz4\",\"level\":\"medium\"},{\"name\":\"c3\",\"type\":8,\"length\":16,\"isPrimarykey\":false,\"encode\":\"disabled\",\"compress\":\"zstd\",\"level\":\"medium\"}],\"tags\":[{\"name\":\"t1\",\"type\":4},{\"name\":\"t3\",\"type\":10,\"length\":8},{\"name\":\"t4\",\"type\":1}]},{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct0\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]},{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct1\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]},{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct11\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]},{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct10\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]},{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct2\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[{\"tableName\":\"ct2\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}]},{\"tableName\":\"ct3\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}]}]}]}") == 0); + break; + default: + ASSERT(0); + break; + } + + tmq_free_json_meta(result); +} + +void checkNonBatchMeta(TAOS_RES* msg){ + char* result = tmq_get_json_meta(msg); + printf("meta result: %s\n", result); + switch (consumeIndex) { + case 0: + ASSERT(strcmp(result, "{\"type\":\"create\",\"tableType\":\"super\",\"tableName\":\"st1\",\"columns\":[{\"name\":\"ts\",\"type\":9,\"isPrimarykey\":false,\"encode\":\"delta-i\",\"compress\":\"lz4\",\"level\":\"medium\"},{\"name\":\"c1\",\"type\":4,\"isPrimarykey\":false,\"encode\":\"simple8b\",\"compress\":\"lz4\",\"level\":\"medium\"},{\"name\":\"c2\",\"type\":6,\"isPrimarykey\":false,\"encode\":\"delta-d\",\"compress\":\"lz4\",\"level\":\"medium\"},{\"name\":\"c3\",\"type\":8,\"length\":16,\"isPrimarykey\":false,\"encode\":\"disabled\",\"compress\":\"zstd\",\"level\":\"medium\"}],\"tags\":[{\"name\":\"t1\",\"type\":4},{\"name\":\"t3\",\"type\":10,\"length\":8},{\"name\":\"t4\",\"type\":1}]}") == 0); + break; + case 1: + ASSERT(strcmp(result, "{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct0\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]}") == 0); + break; + case 2: + ASSERT(strcmp(result, "{\"tmq_meta_version\":\"1.0\",\"metas\":[{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct1\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]}]}") == 0); + break; + case 3: + ASSERT(strcmp(result, "{\"tmq_meta_version\":\"1.0\",\"metas\":[{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct11\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]}]}") == 0); + break; + case 4: + ASSERT(strcmp(result, "{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct10\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[]}") == 0); + break; + case 5: + ASSERT(strcmp(result, "{\"tmq_meta_version\":\"1.0\",\"metas\":[{\"type\":\"create\",\"tableType\":\"child\",\"tableName\":\"ct2\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}],\"createList\":[{\"tableName\":\"ct2\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}]},{\"tableName\":\"ct3\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}]}]}]}") == 0); + break; + default: + ASSERT(0); + break; + } + + tmq_free_json_meta(result); +} + +static void msg_process(TAOS_RES* msg) { + printf("-----------topic-------------: %s\n", tmq_get_topic_name(msg)); + printf("db: %s\n", tmq_get_db_name(msg)); + printf("vg: %d\n", tmq_get_vgroup_id(msg)); + TAOS* pConn = use_db(); + ASSERT (tmq_get_res_type(msg) == TMQ_RES_TABLE_META); + if (batchMeta){ + checkBatchMeta(msg); + } else { + checkNonBatchMeta(msg); + } + taos_close(pConn); +} + +int buildDatabase(TAOS* pConn, TAOS_RES* pRes) { + pRes = taos_query(pConn, + "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 " + "nchar(8), t4 bool)"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table if not exists ct0 using st1 tags(1000, \"ttt\", true)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table tu1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct1 using st1 tags(1000, \"ttt\", true) values(1626006833400, 1, 2, 'a')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct0, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct1 values(1626006833600, 3, 4, 'b')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct11 using st1 tags(1000, \"ttt\", true) values(1626006833400, 1, 2, 'a')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct0, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table if not exists ct10 using st1 tags(1000, \"ttt\", true)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table tu1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + taosSsleep(1); + pRes = taos_query(pConn, "insert into ct1 using st1 tags(1000, \"ttt\", true) values(1626006833400, 1, 2, 'a') ct2 using st1 tags(1000, \"ttt\", true) values(1626006833400, 1, 2, 'a') ct3 using st1 tags(1000, \"ttt\", true) values(1626006833400, 1, 2, 'a')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct0, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + + pRes = taos_query(pConn, "insert into ct1 values(1626006833600, 3, 4, 'b')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + return 0; +} + +int32_t init_env() { + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + if (pConn == NULL) { + return -1; + } + + TAOS_RES* pRes = taos_query(pConn, "drop database if exists db_taosx"); + if (taos_errno(pRes) != 0) { + printf("error in drop db_taosx, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create database if not exists db_taosx vgroups 1 wal_retention_period 3600"); + if (taos_errno(pRes) != 0) { + printf("error in create db_taosx, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop topic if exists topic_db"); + if (taos_errno(pRes) != 0) { + printf("error in drop topic, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop database if exists abc1"); + if (taos_errno(pRes) != 0) { + printf("error in drop db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1 wal_retention_period 3600"); + if (taos_errno(pRes) != 0) { + printf("error in create db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "use abc1"); + if (taos_errno(pRes) != 0) { + printf("error in use db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + buildDatabase(pConn, pRes); + + taos_close(pConn); + return 0; +} + +int32_t create_topic() { + printf("create topic\n"); + TAOS_RES* pRes; + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + if (pConn == NULL) { + return -1; + } + + pRes = taos_query(pConn, "create topic topic_db only meta as database abc1"); + if (taos_errno(pRes) != 0) { + printf("failed to create topic topic_db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + taos_close(pConn); + return 0; +} + +void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) { + printf("commit %d tmq %p param %p\n", code, tmq, param); +} + +tmq_t* build_consumer() { + tmq_conf_t* conf = tmq_conf_new(); + tmq_conf_set(conf, "group.id", batchMeta ? "batch" : "nonbatch"); + tmq_conf_set(conf, "client.id", "my app 1"); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "msg.with.table.name", "true"); + tmq_conf_set(conf, "enable.auto.commit", "true"); + tmq_conf_set(conf, "auto.offset.reset", "earliest"); + tmq_conf_set(conf, "msg.consume.excluded", "1"); + if (batchMeta) { + tmq_conf_set(conf, "msg.enable.batchmeta", "1"); + } + + tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); + tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); + assert(tmq); + tmq_conf_destroy(conf); + return tmq; +} + +tmq_list_t* build_topic_list() { + tmq_list_t* topic_list = tmq_list_new(); + tmq_list_append(topic_list, "topic_db"); + return topic_list; +} + +void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) { + int32_t code; + + if ((code = tmq_subscribe(tmq, topics))) { + fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code)); + printf("subscribe err\n"); + return; + } + while (1) { + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 5000); + if (tmqmessage) { + msg_process(tmqmessage); + consumeIndex++; + taos_free_result(tmqmessage); + } else { + break; + } + } + + code = tmq_consumer_close(tmq); + if (code) + fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code)); + else + fprintf(stderr, "%% Consumer closed\n"); +} + +int main(int argc, char* argv[]) { + if (init_env() < 0) { + return -1; + } + create_topic(); + + tmq_list_t* topic_list = build_topic_list(); + tmq_t* tmq = build_consumer(); + basic_consume_loop(tmq, topic_list); + + batchMeta = true; + consumeIndex = 0; + tmq = build_consumer(); + basic_consume_loop(tmq, topic_list); + + tmq_list_destroy(topic_list); +} From b5e673f727a8b11374e594d6ffb4ac5bf3e3aad1 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 21 Feb 2025 19:05:18 +0800 Subject: [PATCH 03/22] feat:[TD-33798]modify metadata logic for tmq --- tests/parallel_test/cases.task | 1 - tests/system-test/7-tmq/tmq_taosx.py | 48 ++++++++++++++-------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 6215d7d433..696693c051 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -470,7 +470,6 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_taosx.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts5466.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_td33504.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts-5473.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_ts5906.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/td-32187.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/td-33225.py diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index 053b29c013..845e7229a8 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -677,34 +677,34 @@ class TDTestCase: tdSql.execute(f'drop database d1') def run(self): - # self.consume_TS_5067_Test() - # self.consumeTest() - # self.consume_ts_4544() - # self.consume_ts_4551() - # self.consume_TS_4540_Test() - # self.consume_td_31283() + self.consume_TS_5067_Test() + self.consumeTest() + self.consume_ts_4544() + self.consume_ts_4551() + self.consume_TS_4540_Test() + self.consume_td_31283() tdSql.prepare() self.checkWal1VgroupOnlyMeta() - # self.checkWal1Vgroup() - # self.checkSnapshot1Vgroup() - # - # self.checkWal1VgroupTable() - # self.checkSnapshot1VgroupTable() - # - # self.checkWalMultiVgroups() - # self.checkWalMultiVgroupsRawData() - # self.checkSnapshotMultiVgroups() - # - # self.checkWalMultiVgroupsWithDropTable() - # - # self.checkSnapshotMultiVgroupsWithDropTable() - # - # self.checkSnapshot1VgroupBtmeta() - # self.checkSnapshot1VgroupTableBtmeta() - # self.checkSnapshotMultiVgroupsBtmeta() - # self.checkSnapshotMultiVgroupsWithDropTableBtmeta() + self.checkWal1Vgroup() + self.checkSnapshot1Vgroup() + + self.checkWal1VgroupTable() + self.checkSnapshot1VgroupTable() + + self.checkWalMultiVgroups() + self.checkWalMultiVgroupsRawData() + self.checkSnapshotMultiVgroups() + + self.checkWalMultiVgroupsWithDropTable() + + self.checkSnapshotMultiVgroupsWithDropTable() + + self.checkSnapshot1VgroupBtmeta() + self.checkSnapshot1VgroupTableBtmeta() + self.checkSnapshotMultiVgroupsBtmeta() + self.checkSnapshotMultiVgroupsWithDropTableBtmeta() def stop(self): tdSql.close() From e87541efaadc655ae55be51ad8f1bcecff39a85d Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 24 Feb 2025 16:18:27 +0800 Subject: [PATCH 04/22] feat:[TD-33798]modify metadata logic for tmq --- source/dnode/vnode/src/tq/tqUtil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 7dc9a88164..bc8b8504c4 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -389,7 +389,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, code = buildBatchMeta(&btMetaRsp, pHead->msgType, pHead->bodyLen, pHead->body); fetchVer++; if (code != 0){ - continue; + goto END; } totalMetaRows++; if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || (taosGetTimestampMs() - st > pRequest->timeout)) { @@ -423,7 +423,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, taosxRsp.createTableReq = NULL; fetchVer++; if (code != 0){ - continue; + goto END; } totalMetaRows++; if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || From 33f4a4926daebb391d7cfa0ee9bd365edfba0ec8 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 25 Feb 2025 15:20:41 +0800 Subject: [PATCH 05/22] modify taos CopyRight from 2023 to 2025 --- tools/shell/src/shellArguments.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index ba210850eb..93381b4f51 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -443,7 +443,7 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) { shellInitArgs(argc, argv); shell.info.clientVersion = "Welcome to the %s Command Line Interface, Client Version:%s\r\n" - "Copyright (c) 2023 by %s, all rights reserved.\r\n\r\n"; + "Copyright (c) 2025 by %s, all rights reserved.\r\n\r\n"; #ifdef CUS_NAME strcpy(shell.info.cusName, CUS_NAME); #else From 1ed9efee23b282e71fb669a2151909863bcc4bd5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 24 Feb 2025 10:59:49 +0800 Subject: [PATCH 06/22] fix: add some ut --- include/os/osSysinfo.h | 2 + source/os/src/osRand.c | 2 +- source/os/src/osSignal.c | 2 + source/os/src/osString.c | 4 +- source/os/src/osSysinfo.c | 5 +- source/os/test/CMakeLists.txt | 7 - source/os/test/osSignalTests.cpp | 40 -- source/os/test/osStringTests.cpp | 943 ++++++++++++++++++------------- source/os/test/osTests.cpp | 369 +++++++++++- source/os/test/osThreadTests.cpp | 40 +- 10 files changed, 938 insertions(+), 476 deletions(-) delete mode 100644 source/os/test/osSignalTests.cpp diff --git a/include/os/osSysinfo.h b/include/os/osSysinfo.h index 1f4dfe3809..5e1b889580 100644 --- a/include/os/osSysinfo.h +++ b/include/os/osSysinfo.h @@ -47,8 +47,10 @@ int32_t taosGetProcMemory(int64_t *usedKB); int32_t taosGetSysMemory(int64_t *usedKB); int32_t taosGetSysAvailMemory(int64_t *availSize); int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize); +int32_t taosGetProcIO(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes); int32_t taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes); void taosSetDefaultProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes); +int32_t taosGetCardInfo(int64_t *receive_bytes, int64_t *transmit_bytes); int32_t taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes); void taosSetDefaultCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes); diff --git a/source/os/src/osRand.c b/source/os/src/osRand.c index 0bf67f96a0..d13342ca28 100644 --- a/source/os/src/osRand.c +++ b/source/os/src/osRand.c @@ -87,7 +87,7 @@ void taosRandStr(char* str, int32_t size) { void taosRandStr2(char* str, int32_t size) { const char* set = "abcdefghijklmnopqrstuvwxyz0123456789@"; - int32_t len = strlen(set); + int32_t len = 37; for (int32_t i = 0; i < size; ++i) { str[i] = set[taosRand() % len]; diff --git a/source/os/src/osSignal.c b/source/os/src/osSignal.c index f341f5422d..238093e418 100644 --- a/source/os/src/osSignal.c +++ b/source/os/src/osSignal.c @@ -114,6 +114,7 @@ int32_t taosDflSignal(int32_t signum) { return 0; } +#if 0 int32_t taosKillChildOnParentStopped() { #ifndef _TD_DARWIN_64 int32_t code = prctl(PR_SET_PDEATHSIG, SIGKILL); @@ -126,5 +127,6 @@ int32_t taosKillChildOnParentStopped() { #endif return 0; } +#endif #endif diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 1d07b64c70..24fd8ca034 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -294,6 +294,7 @@ int32_t tasoUcs4Compare(TdUcs4 *f1_ucs4, TdUcs4 *f2_ucs4, int32_t bytes) { //#endif } +#if 0 int32_t tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) { if (target_ucs4 == NULL || source_ucs4 == NULL || len_ucs4 <= 0) { return TSDB_CODE_INVALID_PARA; @@ -307,11 +308,12 @@ int32_t tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) return TSDB_CODE_SUCCESS; } +#endif iconv_t taosAcquireConv(int32_t *idx, ConvType type, void* charsetCxt) { if(idx == NULL) { terrno = TSDB_CODE_INVALID_PARA; - return (iconv_t)-1; + return (iconv_t)NULL; } if (charsetCxt == NULL){ charsetCxt = tsCharsetCxt; diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 6cb0e00b82..dccce2d987 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -147,7 +147,6 @@ static void taosGetProcIOnfos() { #endif static int32_t taosGetSysCpuInfo(SysCpuInfo *cpuInfo) { - OS_PARAM_CHECK(cpuInfo); int32_t code = 0; #ifdef WINDOWS FILETIME pre_idleTime = {0}; @@ -200,7 +199,6 @@ static int32_t taosGetSysCpuInfo(SysCpuInfo *cpuInfo) { } static int32_t taosGetProcCpuInfo(ProcCpuInfo *cpuInfo) { - OS_PARAM_CHECK(cpuInfo); int32_t code = 0; #ifdef WINDOWS @@ -541,7 +539,6 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) { // Returns the container's CPU quota if successful, otherwise returns the physical CPU cores static int32_t taosCntrGetCpuCores(float *numOfCores) { - OS_PARAM_CHECK(numOfCores); #ifdef WINDOWS return TSDB_CODE_UNSUPPORT_OS; #elif defined(_TD_DARWIN_64) @@ -1092,6 +1089,7 @@ void taosSetDefaultCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes if (transmit_bytes) *transmit_bytes = 0; } +#if 0 void taosKillSystem() { #ifdef WINDOWS printf("function taosKillSystem, exit!"); @@ -1105,6 +1103,7 @@ void taosKillSystem() { (void)kill(tsProcId, 2); #endif } +#endif #define UUIDLEN (36) int32_t taosGetSystemUUIDLimit36(char *uid, int32_t uidlen) { diff --git a/source/os/test/CMakeLists.txt b/source/os/test/CMakeLists.txt index 2ba6b73e29..a26fc88916 100644 --- a/source/os/test/CMakeLists.txt +++ b/source/os/test/CMakeLists.txt @@ -61,13 +61,6 @@ add_test( COMMAND osSemaphoreTests ) -add_executable(osSignalTests "osSignalTests.cpp") -target_link_libraries(osSignalTests os util gtest_main) -add_test( - NAME osSignalTests - COMMAND osSignalTests -) - add_executable(osSleepTests "osSleepTests.cpp") target_link_libraries(osSleepTests os util gtest_main) add_test( diff --git a/source/os/test/osSignalTests.cpp b/source/os/test/osSignalTests.cpp deleted file mode 100644 index f4cc6e9e58..0000000000 --- a/source/os/test/osSignalTests.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#include -#include - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wwrite-strings" -#pragma GCC diagnostic ignored "-Wunused-function" -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wsign-compare" -#pragma GCC diagnostic ignored "-Wsign-compare" -#pragma GCC diagnostic ignored "-Wformat" -#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" -#pragma GCC diagnostic ignored "-Wpointer-arith" - -#include "os.h" -#include "tlog.h" - -TEST(osSignalTests, taosSetSignal) { - // Set up SIGINT handler using taosSetSignal - //taosSetSignal(SIGINT, sigint_handler); - - // Print PID for testing purposes - // printf("PID: %d\n", getpid()); - - // Wait for signal to be received -} diff --git a/source/os/test/osStringTests.cpp b/source/os/test/osStringTests.cpp index 36f5207346..4e71b4b884 100644 --- a/source/os/test/osStringTests.cpp +++ b/source/os/test/osStringTests.cpp @@ -33,8 +33,8 @@ #ifdef WINDOWS TEST(osStringTests, strsepNormalInput) { char str[] = "This is a test string."; - char * ptr = str; - char * tok = NULL; + char* ptr = str; + char* tok = NULL; const char delim[] = " "; while ((tok = strsep(&ptr, delim)) != NULL) { @@ -59,9 +59,9 @@ TEST(osStringTests, strsepEmptyInput) { } TEST(osStringTests, strsepNullInput) { - char * str = NULL; - char * ptr = str; - char * tok = NULL; + char* str = NULL; + char* ptr = str; + char* tok = NULL; const char delim[] = " "; while ((tok = strsep(&ptr, delim)) != NULL) { @@ -75,7 +75,7 @@ TEST(osStringTests, strsepNullInput) { TEST(osStringTests, strndupNormalInput) { const char s[] = "This is a test string."; int size = strlen(s) + 1; - char * s2 = taosStrndup(s, size); + char* s2 = taosStrndup(s, size); EXPECT_STREQ(s, s2); @@ -114,523 +114,674 @@ TEST(osStringTests, osUcs4lenTests2) { } TEST(osStringTests, ostsnprintfTests) { - char buffer[50] = {0}; - int64_t ret; + char buffer[50] = {0}; + int64_t ret; - ret = tsnprintf(buffer, sizeof(buffer), "Hello, %s!", "World"); - EXPECT_EQ(ret, 13); - EXPECT_STREQ(buffer, "Hello, World!"); + ret = tsnprintf(buffer, sizeof(buffer), "Hello, %s!", "World"); + EXPECT_EQ(ret, 13); + EXPECT_STREQ(buffer, "Hello, World!"); - memset(buffer, 0, sizeof(buffer)); - ret = tsnprintf(buffer, 10, "Hello, %s!", "World"); - EXPECT_EQ(ret, 9); - EXPECT_EQ(strncmp(buffer, "Hello, Wo", 9), 0); + memset(buffer, 0, sizeof(buffer)); + ret = tsnprintf(buffer, 10, "Hello, %s!", "World"); + EXPECT_EQ(ret, 9); + EXPECT_EQ(strncmp(buffer, "Hello, Wo", 9), 0); - memset(buffer, 0, sizeof(buffer)); - ret = tsnprintf(buffer, 10, "Hello%s", "World"); - EXPECT_EQ(ret, 9); - EXPECT_EQ(strncmp(buffer, "HelloWorl", 9), 0); + memset(buffer, 0, sizeof(buffer)); + ret = tsnprintf(buffer, 10, "Hello%s", "World"); + EXPECT_EQ(ret, 9); + EXPECT_EQ(strncmp(buffer, "HelloWorl", 9), 0); - memset(buffer, 0, sizeof(buffer)); - ret = tsnprintf(buffer, 0, "Hello, %s!", "World"); - EXPECT_EQ(ret, 0); + memset(buffer, 0, sizeof(buffer)); + ret = tsnprintf(buffer, 0, "Hello, %s!", "World"); + EXPECT_EQ(ret, 0); - memset(buffer, 0, sizeof(buffer)); - ret = tsnprintf(buffer, SIZE_MAX + 1, "Hello, %s!", "World"); - EXPECT_EQ(ret, 0); + memset(buffer, 0, sizeof(buffer)); + ret = tsnprintf(buffer, SIZE_MAX + 1, "Hello, %s!", "World"); + EXPECT_EQ(ret, 0); - memset(buffer, 0, sizeof(buffer)); - ret = tsnprintf(buffer, sizeof(buffer), ""); - EXPECT_EQ(ret, 0); - EXPECT_STREQ(buffer, ""); + memset(buffer, 0, sizeof(buffer)); + ret = tsnprintf(buffer, sizeof(buffer), ""); + EXPECT_EQ(ret, 0); + EXPECT_STREQ(buffer, ""); - memset(buffer, 0, sizeof(buffer)); - ret = tsnprintf(buffer, sizeof(buffer), "Number: %d", 42); - EXPECT_EQ(ret, 10); - EXPECT_STREQ(buffer, "Number: 42"); + memset(buffer, 0, sizeof(buffer)); + ret = tsnprintf(buffer, sizeof(buffer), "Number: %d", 42); + EXPECT_EQ(ret, 10); + EXPECT_STREQ(buffer, "Number: 42"); - memset(buffer, 0, sizeof(buffer)); - ret = tsnprintf(buffer, sizeof(buffer), "Float: %.2f", 3.14); - EXPECT_EQ(ret, 11); - EXPECT_STREQ(buffer, "Float: 3.14"); + memset(buffer, 0, sizeof(buffer)); + ret = tsnprintf(buffer, sizeof(buffer), "Float: %.2f", 3.14); + EXPECT_EQ(ret, 11); + EXPECT_STREQ(buffer, "Float: 3.14"); } TEST(osStringTests, osStr2Int64) { - int64_t val; - int32_t result; + int64_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2int64(NULL, &val); - assert(result == TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2int64(NULL, &val); + assert(result == TSDB_CODE_INVALID_PARA); - result = taosStr2int64("123", NULL); - ASSERT_NE(result, 0); + result = taosStr2int64("123", NULL); + ASSERT_NE(result, 0); - // 测试无效输入 - result = taosStr2int64("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2int64("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2int64("", &val); - ASSERT_NE(result, 0); + result = taosStr2int64("", &val); + ASSERT_NE(result, 0); - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%lld", LLONG_MAX); - result = taosStr2int64(large_num, &val); - assert(result == 0); - assert(val == LLONG_MAX); + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%lld", LLONG_MAX); + result = taosStr2int64(large_num, &val); + assert(result == 0); + assert(val == LLONG_MAX); - snprintf(large_num, sizeof(large_num), "%lld", LLONG_MIN); - result = taosStr2int64(large_num, &val); - assert(result == 0); - assert(val == LLONG_MIN); + snprintf(large_num, sizeof(large_num), "%lld", LLONG_MIN); + result = taosStr2int64(large_num, &val); + assert(result == 0); + assert(val == LLONG_MIN); - result = taosStr2int64("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2int64("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2int64("abc123", &val); - ASSERT_NE(result, 0); - // 测试有效的整数字符串 - result = taosStr2int64("12345", &val); - assert(result == 0); - assert(val == 12345); + result = taosStr2int64("abc123", &val); + ASSERT_NE(result, 0); + // 测试有效的整数字符串 + result = taosStr2int64("12345", &val); + assert(result == 0); + assert(val == 12345); - result = taosStr2int64("-12345", &val); - assert(result == 0); - assert(val == -12345); + result = taosStr2int64("-12345", &val); + assert(result == 0); + assert(val == -12345); - result = taosStr2int64("0", &val); - assert(result == 0); - assert(val == 0); + result = taosStr2int64("0", &val); + assert(result == 0); + assert(val == 0); - // 测试带空格的字符串 - result = taosStr2int64(" 12345", &val); - assert(result == 0); - assert(val == 12345); + // 测试带空格的字符串 + result = taosStr2int64(" 12345", &val); + assert(result == 0); + assert(val == 12345); - result = taosStr2int64("12345 ", &val); - assert(result == 0); - assert(val == 12345); + result = taosStr2int64("12345 ", &val); + assert(result == 0); + assert(val == 12345); } TEST(osStringTests, osStr2int32) { - int32_t val; - int32_t result; + int32_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2int32(NULL, &val); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2int32(NULL, &val); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - result = taosStr2int32("123", NULL); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + result = taosStr2int32("123", NULL); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - // 测试无效输入 - result = taosStr2int32("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2int32("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2int32("", &val); - ASSERT_NE(result, 0); + result = taosStr2int32("", &val); + ASSERT_NE(result, 0); - // 测试超出范围的值 - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%d", INT_MAX); - result = taosStr2int32(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, INT_MAX); + // 测试超出范围的值 + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%d", INT_MAX); + result = taosStr2int32(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, INT_MAX); - snprintf(large_num, sizeof(large_num), "%d", INT_MIN); - result = taosStr2int32(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, INT_MIN); + snprintf(large_num, sizeof(large_num), "%d", INT_MIN); + result = taosStr2int32(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, INT_MIN); - // 测试大于 INT32 范围的值 - snprintf(large_num, sizeof(large_num), "%lld", (long long)INT_MAX + 1); - result = taosStr2int32(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + // 测试大于 INT32 范围的值 + snprintf(large_num, sizeof(large_num), "%lld", (long long)INT_MAX + 1); + result = taosStr2int32(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - snprintf(large_num, sizeof(large_num), "%lld", (long long)INT_MIN - 1); - result = taosStr2int32(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + snprintf(large_num, sizeof(large_num), "%lld", (long long)INT_MIN - 1); + result = taosStr2int32(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - - result = taosStr2int32("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2int32("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2int32("abc123", &val); - ASSERT_NE(result, 0); + result = taosStr2int32("abc123", &val); + ASSERT_NE(result, 0); - // 测试有效的整数字符串 - result = taosStr2int32("12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + // 测试有效的整数字符串 + result = taosStr2int32("12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2int32("-12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, -12345); + result = taosStr2int32("-12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, -12345); - result = taosStr2int32("0", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 0); + result = taosStr2int32("0", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 0); - // 测试带空格的字符串 - result = taosStr2int32(" 12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + // 测试带空格的字符串 + result = taosStr2int32(" 12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2int32("12345 ", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2int32("12345 ", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); } TEST(osStringTests, taosStr2int16) { - int16_t val; - int32_t result; + int16_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2int16(NULL, &val); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2int16(NULL, &val); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - result = taosStr2int16("123", NULL); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + result = taosStr2int16("123", NULL); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - // 测试无效输入 - result = taosStr2int16("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2int16("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2int16("", &val); - ASSERT_NE(result, 0); + result = taosStr2int16("", &val); + ASSERT_NE(result, 0); - // 测试超出范围的值 - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%d", INT16_MAX); - result = taosStr2int16(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, INT16_MAX); + // 测试超出范围的值 + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%d", INT16_MAX); + result = taosStr2int16(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, INT16_MAX); - snprintf(large_num, sizeof(large_num), "%d", INT16_MIN); - result = taosStr2int16(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, INT16_MIN); + snprintf(large_num, sizeof(large_num), "%d", INT16_MIN); + result = taosStr2int16(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, INT16_MIN); - // 测试大于 INT16 范围的值 - snprintf(large_num, sizeof(large_num), "%lld", (long long)INT16_MAX + 1); - result = taosStr2int16(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + // 测试大于 INT16 范围的值 + snprintf(large_num, sizeof(large_num), "%lld", (long long)INT16_MAX + 1); + result = taosStr2int16(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - snprintf(large_num, sizeof(large_num), "%lld", (long long)INT16_MIN - 1); - result = taosStr2int16(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + snprintf(large_num, sizeof(large_num), "%lld", (long long)INT16_MIN - 1); + result = taosStr2int16(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - result = taosStr2int16("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2int16("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2int16("abc123", &val); - ASSERT_NE(result, 0); - // 测试有效的整数字符串 - result = taosStr2int16("12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2int16("abc123", &val); + ASSERT_NE(result, 0); + // 测试有效的整数字符串 + result = taosStr2int16("12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2int16("-12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, -12345); + result = taosStr2int16("-12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, -12345); - result = taosStr2int16("0", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 0); + result = taosStr2int16("0", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 0); - // 测试带空格的字符串 - result = taosStr2int16(" 12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + // 测试带空格的字符串 + result = taosStr2int16(" 12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2int16("12345 ", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2int16("12345 ", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); } - TEST(osStringTests, taosStr2int8) { - int8_t val; - int32_t result; + int8_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2int8(NULL, &val); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2int8(NULL, &val); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - result = taosStr2int8("123", NULL); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + result = taosStr2int8("123", NULL); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - // 测试无效输入 - result = taosStr2int8("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2int8("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2int8("", &val); - ASSERT_NE(result, 0); + result = taosStr2int8("", &val); + ASSERT_NE(result, 0); - // 测试超出范围的值 - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%d", INT8_MAX); - result = taosStr2int8(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, INT8_MAX); + // 测试超出范围的值 + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%d", INT8_MAX); + result = taosStr2int8(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, INT8_MAX); - snprintf(large_num, sizeof(large_num), "%d", INT8_MIN); - result = taosStr2int8(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, INT8_MIN); + snprintf(large_num, sizeof(large_num), "%d", INT8_MIN); + result = taosStr2int8(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, INT8_MIN); - // 测试大于 INT8 范围的值 - snprintf(large_num, sizeof(large_num), "%lld", (long long)INT8_MAX + 1); - result = taosStr2int8(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + // 测试大于 INT8 范围的值 + snprintf(large_num, sizeof(large_num), "%lld", (long long)INT8_MAX + 1); + result = taosStr2int8(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - snprintf(large_num, sizeof(large_num), "%lld", (long long)INT8_MIN - 1); - result = taosStr2int8(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + snprintf(large_num, sizeof(large_num), "%lld", (long long)INT8_MIN - 1); + result = taosStr2int8(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - result = taosStr2int8("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2int8("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2int8("abc123", &val); - ASSERT_NE(result, 0); - - // 测试有效的整数字符串 - result = taosStr2int8("123", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2int8("abc123", &val); + ASSERT_NE(result, 0); - result = taosStr2int8("-123", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, -123); + // 测试有效的整数字符串 + result = taosStr2int8("123", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2int8("0", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 0); + result = taosStr2int8("-123", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, -123); - // 测试带空格的字符串 - result = taosStr2int8(" 123", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2int8("0", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 0); - result = taosStr2int8("123 ", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + // 测试带空格的字符串 + result = taosStr2int8(" 123", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); + + result = taosStr2int8("123 ", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); } TEST(osStringTests, osStr2Uint64) { - uint64_t val; - int32_t result; + uint64_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2Uint64(NULL, &val); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2Uint64(NULL, &val); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - result = taosStr2Uint64("123", NULL); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + result = taosStr2Uint64("123", NULL); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - // 测试无效输入 - result = taosStr2Uint64("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2Uint64("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2Uint64("", &val); - ASSERT_NE(result, 0); + result = taosStr2Uint64("", &val); + ASSERT_NE(result, 0); - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%llu", ULLONG_MAX); - result = taosStr2Uint64(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, ULLONG_MAX); + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%llu", ULLONG_MAX); + result = taosStr2Uint64(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, ULLONG_MAX); - result = taosStr2Uint64("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2Uint64("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2Uint64("abc123", &val); - ASSERT_NE(result, 0); - // 测试有效的整数字符串 - result = taosStr2Uint64("12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2Uint64("abc123", &val); + ASSERT_NE(result, 0); + // 测试有效的整数字符串 + result = taosStr2Uint64("12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2Uint64("0", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 0); + result = taosStr2Uint64("0", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 0); - // 测试带空格的字符串 - result = taosStr2Uint64(" 12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); - - result = taosStr2Uint64("12345 ", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + // 测试带空格的字符串 + result = taosStr2Uint64(" 12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); + result = taosStr2Uint64("12345 ", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); } TEST(osStringTests, taosStr2Uint32) { - uint32_t val; - int32_t result; + uint32_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2Uint32(NULL, &val); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2Uint32(NULL, &val); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - result = taosStr2Uint32("123", NULL); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + result = taosStr2Uint32("123", NULL); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - // 测试无效输入 - result = taosStr2Uint32("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2Uint32("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2Uint32("", &val); - ASSERT_NE(result, 0); + result = taosStr2Uint32("", &val); + ASSERT_NE(result, 0); - // 测试超出范围的值 - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%u", UINT32_MAX); - result = taosStr2Uint32(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, UINT32_MAX); + // 测试超出范围的值 + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%u", UINT32_MAX); + result = taosStr2Uint32(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, UINT32_MAX); - // 测试大于 UINT32 范围的值 - snprintf(large_num, sizeof(large_num), "%llu", (unsigned long long)UINT32_MAX + 1); - result = taosStr2Uint32(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + // 测试大于 UINT32 范围的值 + snprintf(large_num, sizeof(large_num), "%llu", (unsigned long long)UINT32_MAX + 1); + result = taosStr2Uint32(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - result = taosStr2Uint32("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2Uint32("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2Uint32("abc123", &val); - ASSERT_NE(result, 0); - // 测试有效的整数字符串 - result = taosStr2Uint32("12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2Uint32("abc123", &val); + ASSERT_NE(result, 0); + // 测试有效的整数字符串 + result = taosStr2Uint32("12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2Uint32("0", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 0); + result = taosStr2Uint32("0", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 0); - // 测试带空格的字符串 - result = taosStr2Uint32(" 12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + // 测试带空格的字符串 + result = taosStr2Uint32(" 12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2Uint32("12345 ", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2Uint32("12345 ", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); } TEST(osStringTests, taosStr2Uint16) { - uint16_t val; - int32_t result; + uint16_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2Uint16(NULL, &val); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2Uint16(NULL, &val); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - result = taosStr2Uint16("123", NULL); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + result = taosStr2Uint16("123", NULL); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - // 测试无效输入 - result = taosStr2Uint16("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2Uint16("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2Uint16("", &val); - ASSERT_NE(result, 0); + result = taosStr2Uint16("", &val); + ASSERT_NE(result, 0); - // 测试超出范围的值 - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%u", UINT16_MAX); - result = taosStr2Uint16(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, UINT16_MAX); + // 测试超出范围的值 + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%u", UINT16_MAX); + result = taosStr2Uint16(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, UINT16_MAX); - // 测试大于 UINT16 范围的值 - snprintf(large_num, sizeof(large_num), "%llu", (unsigned long long)UINT16_MAX + 1); - result = taosStr2Uint16(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + // 测试大于 UINT16 范围的值 + snprintf(large_num, sizeof(large_num), "%llu", (unsigned long long)UINT16_MAX + 1); + result = taosStr2Uint16(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - result = taosStr2Uint16("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2Uint16("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2Uint16("abc123", &val); - ASSERT_NE(result, 0); - // 测试有效的整数字符串 - result = taosStr2Uint16("12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2Uint16("abc123", &val); + ASSERT_NE(result, 0); + // 测试有效的整数字符串 + result = taosStr2Uint16("12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2Uint16("0", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 0); + result = taosStr2Uint16("0", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 0); - // 测试带空格的字符串 - result = taosStr2Uint16(" 12345", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + // 测试带空格的字符串 + result = taosStr2Uint16(" 12345", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); - result = taosStr2Uint16("12345 ", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 12345); + result = taosStr2Uint16("12345 ", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 12345); } TEST(osStringTests, taosStr2Uint8) { - uint8_t val; - int32_t result; + uint8_t val; + int32_t result; - // 测试空指针输入 - result = taosStr2Uint8(NULL, &val); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + // 测试空指针输入 + result = taosStr2Uint8(NULL, &val); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - result = taosStr2Uint8("123", NULL); - ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); + result = taosStr2Uint8("123", NULL); + ASSERT_EQ(result, TSDB_CODE_INVALID_PARA); - // 测试无效输入 - result = taosStr2Uint8("abc", &val); - ASSERT_NE(result, 0); + // 测试无效输入 + result = taosStr2Uint8("abc", &val); + ASSERT_NE(result, 0); - result = taosStr2Uint8("", &val); - ASSERT_NE(result, 0); + result = taosStr2Uint8("", &val); + ASSERT_NE(result, 0); - // 测试超出范围的值 - char large_num[50]; - snprintf(large_num, sizeof(large_num), "%u", UINT8_MAX); - result = taosStr2Uint8(large_num, &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, UINT8_MAX); + // 测试超出范围的值 + char large_num[50]; + snprintf(large_num, sizeof(large_num), "%u", UINT8_MAX); + result = taosStr2Uint8(large_num, &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, UINT8_MAX); - // 测试大于 UINT8 范围的值 - snprintf(large_num, sizeof(large_num), "%llu", (unsigned long long)UINT8_MAX + 1); - result = taosStr2Uint8(large_num, &val); - ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); + // 测试大于 UINT8 范围的值 + snprintf(large_num, sizeof(large_num), "%llu", (unsigned long long)UINT8_MAX + 1); + result = taosStr2Uint8(large_num, &val); + ASSERT_EQ(result, TAOS_SYSTEM_ERROR(ERANGE)); - result = taosStr2Uint8("123abc", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2Uint8("123abc", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2Uint8("abc123", &val); - ASSERT_NE(result, 0); - // 测试有效的整数字符串 - result = taosStr2Uint8("123", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2Uint8("abc123", &val); + ASSERT_NE(result, 0); + // 测试有效的整数字符串 + result = taosStr2Uint8("123", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2Uint8("0", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 0); + result = taosStr2Uint8("0", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 0); - // 测试带空格的字符串 - result = taosStr2Uint8(" 123", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + // 测试带空格的字符串 + result = taosStr2Uint8(" 123", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); - result = taosStr2Uint8("123 ", &val); - ASSERT_EQ(result, 0); - ASSERT_EQ(val, 123); + result = taosStr2Uint8("123 ", &val); + ASSERT_EQ(result, 0); + ASSERT_EQ(val, 123); } +TEST(osStringTests, strint2) { + const char* ret = tstrdup(NULL); + EXPECT_EQ(ret, nullptr); + + ret = taosStrndupi(NULL, 0); + EXPECT_EQ(ret, nullptr); + + char buf[12] = "12345"; + ret = tstrndup(buf, 4); + EXPECT_NE(ret, nullptr); + + int64_t val = 0; + int32_t ret32 = taosStr2int64(NULL, &val); + EXPECT_NE(ret32, 0); + ret32 = taosStr2int64(buf, NULL); + EXPECT_NE(ret32, 0); + + TdUcs4 p1, p2; + int32_t val32 = 0; + ret32 = tasoUcs4Compare(&p1, NULL, val32); + EXPECT_NE(ret32, 0); + ret32 = tasoUcs4Compare(NULL, &p2, val32); + EXPECT_NE(ret32, 0); + + void* retptr = taosAcquireConv(NULL, M2C, NULL); + EXPECT_EQ(retptr, nullptr); + + ret32 = taosUcs4ToMbs(NULL, 0, NULL, NULL); + EXPECT_EQ(ret32, 0); + ret32 = taosUcs4ToMbs(NULL, -1, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosUcs4ToMbs(NULL, 1, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosUcs4ToMbs(&p1, 1, NULL, NULL); + EXPECT_NE(ret32, 0); + + bool retb = taosValidateEncodec(NULL); + EXPECT_FALSE(retb); + + ret32 = taosUcs4len(NULL); + EXPECT_EQ(ret32, 0); + + unsigned char src[24] = "1234"; + char dst[24] = {0}; + int32_t len = 5; + int32_t bufSize = 24; + ret32 = taosHexEncode(NULL, NULL, len, -1); + EXPECT_NE(ret32, 0); + ret32 = taosHexEncode(src, NULL, len, -1); + EXPECT_NE(ret32, 0); + ret32 = taosHexEncode(src, dst, len, -1); + EXPECT_NE(ret32, 0); + ret32 = taosHexEncode(src, dst, len, bufSize); + EXPECT_EQ(ret32, 0); + + char dst2[24] = {0}; + ret32 = taosHexDecode(NULL, NULL, 0); + EXPECT_NE(ret32, 0); + ret32 = taosHexDecode(NULL, dst2, 0); + EXPECT_NE(ret32, 0); + ret32 = taosHexDecode(dst, NULL, 0); + EXPECT_NE(ret32, 0); + ret32 = taosHexDecode(dst, dst2, 24); + EXPECT_EQ(ret32, 0); + EXPECT_STREQ((char*)src, dst2); +} + +TEST(osStringTests, wchartest) { + char src[24] = "1234"; + TdWchar dst[24] = {0}; + + int32_t ret32 = taosWcharsWidth(NULL, 0); + EXPECT_LT(ret32, 0); + ret32 = taosWcharsWidth(dst, 0); + EXPECT_LT(ret32, 0); + + ret32 = taosMbToWchar(NULL, NULL, 0); + EXPECT_LT(ret32, 0); + ret32 = taosMbToWchar(dst, NULL, 0); + EXPECT_LT(ret32, 0); + ret32 = taosMbToWchar(dst, src, 0); + EXPECT_LT(ret32, 0); + ret32 = taosMbToWchar(dst, src, 4); + EXPECT_GT(ret32, 0); + ret32 = taosWcharsWidth(dst, ret32); + EXPECT_GT(ret32, 0); + + ret32 = taosMbsToWchars(NULL, NULL, 0); + EXPECT_LT(ret32, 0); + ret32 = taosMbsToWchars(dst, NULL, 0); + EXPECT_LT(ret32, 0); + ret32 = taosMbsToWchars(dst, src, 0); + EXPECT_LT(ret32, 0); + ret32 = taosMbsToWchars(dst, src, 4); + EXPECT_GT(ret32, 0); + ret32 = taosWcharsWidth(dst, ret32); + EXPECT_GT(ret32, 0); + + ret32 = taosWcharsWidth(NULL, dst[0]); + EXPECT_NE(ret32, 0); + ret32 = taosWcharToMb(src, dst[0]); + EXPECT_NE(ret32, 0); +} + +TEST(osStringTests, strtransform) { + char src[12] = "12"; + + void* retptr = taosStrCaseStr(NULL, NULL); + EXPECT_EQ(retptr, nullptr); + retptr = taosStrCaseStr(src, NULL); + EXPECT_NE(retptr, nullptr); + + int64_t ret64 = taosStr2Int64(NULL, NULL, 0); + EXPECT_EQ(ret64, 0); + uint64_t retu64 = taosStr2UInt64(NULL, NULL, 0); + EXPECT_EQ(retu64, 0); + int32_t ret32 = taosStr2Int32(NULL, NULL, 0); + EXPECT_EQ(ret32, 0); + uint32_t retu32 = taosStr2UInt32(NULL, NULL, 0); + EXPECT_EQ(retu32, 0); + ret32 = taosStr2Int16(NULL, NULL, 0); + EXPECT_EQ(ret32, 0); + ret32 = taosStr2UInt16(NULL, NULL, 0); + EXPECT_EQ(ret32, 0); + ret32 = taosStr2Int8(NULL, NULL, 0); + EXPECT_EQ(ret32, 0); + ret32 = taosStr2UInt8(NULL, NULL, 0); + EXPECT_EQ(ret32, 0); + + double retd = taosStr2Double(NULL, NULL); + EXPECT_EQ((int32_t)retd, 0); + float retf = taosStr2Float(NULL, NULL); + EXPECT_EQ((int32_t)retf, 0); + + bool retb = isValidateHex(NULL, 0); + EXPECT_FALSE(retb); + + char z[12] = {0}; + ret32 = taosHex2Ascii(NULL, 0, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosHex2Ascii(z, 0, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosHex2Ascii(z, 0, (void**)&z, NULL); + EXPECT_NE(ret32, 0); + + ret64 = tsnprintf(NULL, 0, NULL); + EXPECT_EQ(ret64, 0); + ret64 = tsnprintf(z, 4, NULL); + EXPECT_EQ(ret64, 0); + ret64 = tsnprintf(z, 0, "ab"); + EXPECT_EQ(ret64, 0); + ret64 = tsnprintf(z, 1, "ab"); + EXPECT_EQ(ret64, 0); +} diff --git a/source/os/test/osTests.cpp b/source/os/test/osTests.cpp index 2c20348608..f4e7eff323 100644 --- a/source/os/test/osTests.cpp +++ b/source/os/test/osTests.cpp @@ -14,8 +14,8 @@ */ #include -#include #include +#include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wwrite-strings" @@ -36,6 +36,230 @@ #include +TEST(osTest, locale) { + char *ret = taosCharsetReplace(NULL); + EXPECT_EQ(ret, nullptr); + + ret = taosCharsetReplace("utf8"); + EXPECT_NE(ret, nullptr); + + ret = taosCharsetReplace("utf-8"); + EXPECT_NE(ret, nullptr); + + taosGetSystemLocale(NULL, ""); + taosGetSystemLocale("", NULL); +} + +TEST(osTest, memory) { + int32_t ret = taosMemoryDbgInitRestore(); + EXPECT_EQ(ret, 0); + + int64_t ret64 = taosMemSize(NULL); + EXPECT_EQ(ret64, 0); +} + +TEST(osTest, rand2) { + char str[128] = {0}; + taosRandStr2(str, 100); +} + +TEST(osTest, socket2) { + int32_t ret32 = taosCloseSocket(NULL); + EXPECT_NE(ret32, 0); + + ret32 = taosSetSockOpt(NULL, 0, 0, NULL, 0); + EXPECT_NE(ret32, 0); + +#if defined(LINUX) + struct in_addr ipInt; + ipInt.s_addr = htonl(0x7F000001); + char buf[128] = {0}; + taosInetNtop(ipInt, buf, 32); +#endif + + ret32 = taosGetIpv4FromFqdn("localhost", NULL); + EXPECT_NE(ret32, 0); + uint32_t ip = 0; + ret32 = taosGetIpv4FromFqdn(NULL, &ip); + EXPECT_NE(ret32, 0); + + taosInetNtoa(NULL, ip); + ret32 = taosInetAddr(NULL); + EXPECT_EQ(ret32, 0); + + ret32 = taosWinSocketInit(); + EXPECT_EQ(ret32, 0); +} + +TEST(osTest, time2) { + taosGetLocalTimezoneOffset(); + + char buf[12] = {0}; + char fmt[12] = {0}; + void *retptr = taosStrpTime(NULL, fmt, NULL); + EXPECT_EQ(retptr, nullptr); + retptr = taosStrpTime(buf, NULL, NULL); + EXPECT_EQ(retptr, nullptr); + + size_t ret = taosStrfTime(NULL, 0, fmt, NULL); + EXPECT_EQ(ret, 0); + ret = taosStrfTime(buf, 0, NULL, NULL); + EXPECT_EQ(ret, 0); + + time_t tp = {0}; + struct tm *retptr2 = taosGmTimeR(&tp, NULL); + EXPECT_EQ(retptr2, nullptr); + retptr2 = taosGmTimeR(NULL, NULL); + EXPECT_EQ(retptr2, nullptr); + + time_t rett = taosTimeGm(NULL); + EXPECT_EQ(rett, -1); + + timezone_t tz = {0}; + retptr2 = taosLocalTime(&tp, NULL, NULL, 0, tz); + EXPECT_EQ(retptr2, nullptr); + retptr2 = taosLocalTime(NULL, NULL, NULL, 0, tz); + EXPECT_EQ(retptr2, nullptr); +} + +TEST(osTest, system) { +#if defined(LINUX) + taosSetConsoleEcho(false); + taosSetConsoleEcho(true); + + taosGetOldTerminalMode(); + taosCloseCmd(NULL); + + TdCmdPtr ptr = taosOpenCmd(NULL); + EXPECT_EQ(ptr, nullptr); + taosCloseCmd(&ptr); + + ptr = taosOpenCmd("echo 'hello world'"); + ASSERT_NE(ptr, nullptr); + + char buf[256] = {0}; + int64_t ret64 = taosGetsCmd(NULL, 0, NULL); + EXPECT_LE(ret64, 0); + ret64 = taosGetsCmd(ptr, 0, NULL); + EXPECT_LE(ret64, 0); + ret64 = taosGetsCmd(ptr, 255, buf); + EXPECT_GT(ret64, 0); + taosCloseCmd(&ptr); + + ptr = taosOpenCmd("echoxxx 'hello world'"); + ASSERT_NE(ptr, nullptr); + ret64 = taosGetsCmd(ptr, 255, buf); + EXPECT_LE(ret64, 0); + taosCloseCmd(&ptr); + + ret64 = taosGetLineCmd(NULL, NULL); + EXPECT_LE(ret64, 0); + ret64 = taosGetLineCmd(ptr, NULL); + EXPECT_LE(ret64, 0); + + ptr = taosOpenCmd("echo 'hello world'"); + ASSERT_NE(ptr, nullptr); + char *ptrBuf = NULL; + ret64 = taosGetLineCmd(ptr, &ptrBuf); + EXPECT_GE(ret64, 0); + taosCloseCmd(&ptr); + + ptr = taosOpenCmd("echoxxx 'hello world'"); + ASSERT_NE(ptr, nullptr); + ret64 = taosGetLineCmd(ptr, &ptrBuf); + EXPECT_LE(ret64, 0); + taosCloseCmd(&ptr); + + int32_t ret32 = taosEOFCmd(NULL); + EXPECT_EQ(ret32, 0); + +#endif +} + +TEST(osTest, sysinfo) { +#if defined(LINUX) + + int32_t ret32 = 0; + + ret32 = taosGetEmail(NULL, 0); + EXPECT_NE(ret32, 0); + + ret32 = taosGetOsReleaseName(NULL, NULL, NULL, 0); + EXPECT_NE(ret32, 0); + + char buf[128] = {0}; + float numOfCores = 0; + ret32 = taosGetCpuInfo(buf, 0, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetCpuInfo(NULL, 0, &numOfCores); + EXPECT_NE(ret32, 0); + + + ret32 = taosGetCpuCores(NULL, false); + EXPECT_NE(ret32, 0); + ret32 = taosGetTotalMemory(NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetProcMemory(NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetSysMemory(NULL); + EXPECT_NE(ret32, 0); + + ret32 = taosGetDiskSize(buf, NULL); + EXPECT_NE(ret32, 0); + SDiskSize disksize = {0}; + ret32 = taosGetDiskSize(NULL, &disksize); + EXPECT_NE(ret32, 0); + + int64_t tmp = 0; + ret32 = taosGetProcIO(NULL, NULL, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetProcIO(&tmp, NULL, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetProcIO(&tmp, &tmp, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetProcIO(&tmp, &tmp, &tmp, NULL); + EXPECT_NE(ret32, 0); + + ret32 = taosGetProcIODelta(NULL, NULL, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetProcIODelta(&tmp, NULL, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetProcIODelta(&tmp, &tmp, NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetProcIODelta(&tmp, &tmp, &tmp, NULL); + EXPECT_NE(ret32, 0); + + taosGetProcIODelta(NULL, NULL, NULL, NULL); + taosGetProcIODelta(&tmp, &tmp, &tmp, &tmp); + + ret32 = taosGetCardInfo(NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetCardInfo(&tmp, NULL); + EXPECT_NE(ret32, 0); + + ret32 = taosGetCardInfoDelta(NULL, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetCardInfoDelta(&tmp, NULL); + EXPECT_NE(ret32, 0); + + taosGetCardInfoDelta(NULL, NULL); + taosGetCardInfoDelta(&tmp, &tmp); + + ret32 = taosGetSystemUUIDLimit36(NULL, 0); + EXPECT_NE(ret32, 0); + + ret32 = taosGetSystemUUIDLen(NULL, 0); + EXPECT_NE(ret32, 0); + ret32 = taosGetSystemUUIDLen(buf, -1); + EXPECT_NE(ret32, 0); + + taosSetCoreDump(false); + + ret32 = taosGetlocalhostname(NULL, 0); + EXPECT_NE(ret32, 0); +#endif +} + TEST(osTest, osFQDNSuccess) { char fqdn[TD_FQDN_LEN]; char ipString[INET_ADDRSTRLEN]; @@ -47,8 +271,8 @@ TEST(osTest, osFQDNSuccess) { struct in_addr addr; addr.s_addr = htonl(ipv4); (void)snprintf(ipString, INET_ADDRSTRLEN, "%u.%u.%u.%u", (unsigned int)(addr.s_addr >> 24) & 0xFF, - (unsigned int)(addr.s_addr >> 16) & 0xFF, (unsigned int)(addr.s_addr >> 8) & 0xFF, - (unsigned int)(addr.s_addr) & 0xFF); + (unsigned int)(addr.s_addr >> 16) & 0xFF, (unsigned int)(addr.s_addr >> 8) & 0xFF, + (unsigned int)(addr.s_addr) & 0xFF); (void)printf("fqdn:%s ip:%s\n", fqdn, ipString); } @@ -56,7 +280,7 @@ TEST(osTest, osFQDNFailed) { char fqdn[1024] = "fqdn_test_not_found"; char ipString[24]; uint32_t ipv4 = 0; - int32_t code = taosGetIpv4FromFqdn(fqdn, &ipv4); + int32_t code = taosGetIpv4FromFqdn(fqdn, &ipv4); ASSERT_NE(code, 0); terrno = TSDB_CODE_RPC_FQDN_ERROR; @@ -79,7 +303,7 @@ TEST(osTest, osSystem) { } void fileOperateOnFree(void *param) { - char * fname = (char *)param; + char *fname = (char *)param; TdFilePtr pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE); (void)printf("On free thread open file\n"); ASSERT_NE(pFile, nullptr); @@ -101,7 +325,7 @@ void *fileOperateOnFreeThread(void *param) { return NULL; } void fileOperateOnBusy(void *param) { - char * fname = (char *)param; + char *fname = (char *)param; TdFilePtr pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE); (void)printf("On busy thread open file\n"); if (pFile == NULL) return; @@ -165,9 +389,9 @@ TEST(osTest, osFile) { (void)taosThreadJoin(thread2, NULL); taosThreadClear(&thread2); - //int ret = taosRemoveFile(fname); - //ASSERT_EQ(ret, 0); - //printf("remove file success"); + // int ret = taosRemoveFile(fname); + // ASSERT_EQ(ret, 0); + // printf("remove file success"); } #ifndef OSFILE_PERFORMANCE_TEST @@ -178,18 +402,109 @@ TEST(osTest, osFile) { #define TESTTIMES 1000 char *getRandomWord() { - static char words[][MAX_WORD_LENGTH] = { - "Lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit", - "sed", "do", "eiusmod", "tempor", "incididunt", "ut", "labore", "et", "dolore", "magna", - "aliqua", "Ut", "enim", "ad", "minim", "veniam", "quis", "nostrud", "exercitation", "ullamco", - "Why", "do", "programmers", "prefer", "using", "dark", "mode?", "Because", "light", "attracts", - "bugs", "and", "they", "want", "to", "code", "in", "peace,", "like", "a", "ninja", "in", "the", "shadows." - "aliqua", "Ut", "enim", "ad", "minim", "veniam", "quis", "nostrud", "exercitation", "ullamco", - "laboris", "nisi", "ut", "aliquip", "ex", "ea", "commodo", "consequat", "Duis", "aute", "irure", - "dolor", "in", "reprehenderit", "in", "voluptate", "velit", "esse", "cillum", "dolore", "eu", - "fugiat", "nulla", "pariatur", "Excepteur", "sint", "occaecat", "cupidatat", "non", "proident", - "sunt", "in", "culpa", "qui", "officia", "deserunt", "mollit", "anim", "id", "est", "laborum" - }; + static char words[][MAX_WORD_LENGTH] = {"Lorem", + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit", + "sed", + "do", + "eiusmod", + "tempor", + "incididunt", + "ut", + "labore", + "et", + "dolore", + "magna", + "aliqua", + "Ut", + "enim", + "ad", + "minim", + "veniam", + "quis", + "nostrud", + "exercitation", + "ullamco", + "Why", + "do", + "programmers", + "prefer", + "using", + "dark", + "mode?", + "Because", + "light", + "attracts", + "bugs", + "and", + "they", + "want", + "to", + "code", + "in", + "peace,", + "like", + "a", + "ninja", + "in", + "the", + "shadows." + "aliqua", + "Ut", + "enim", + "ad", + "minim", + "veniam", + "quis", + "nostrud", + "exercitation", + "ullamco", + "laboris", + "nisi", + "ut", + "aliquip", + "ex", + "ea", + "commodo", + "consequat", + "Duis", + "aute", + "irure", + "dolor", + "in", + "reprehenderit", + "in", + "voluptate", + "velit", + "esse", + "cillum", + "dolore", + "eu", + "fugiat", + "nulla", + "pariatur", + "Excepteur", + "sint", + "occaecat", + "cupidatat", + "non", + "proident", + "sunt", + "in", + "culpa", + "qui", + "officia", + "deserunt", + "mollit", + "anim", + "id", + "est", + "laborum"}; return words[taosRand() % MAX_WORDS]; } @@ -197,7 +512,7 @@ char *getRandomWord() { int64_t fillBufferWithRandomWords(char *buffer, int64_t maxBufferSize) { int64_t len = 0; while (len < maxBufferSize) { - char * word = getRandomWord(); + char *word = getRandomWord(); size_t wordLen = strlen(word); if (len + wordLen + 1 < maxBufferSize) { @@ -246,11 +561,11 @@ TEST(osTest, osFilePerformance) { int64_t OpenForWriteCloseFileCost; int64_t OpenForReadCloseFileCost; - char * buffer; - char * writeBuffer = (char *)taosMemoryCalloc(1, MAX_TEST_FILE_SIZE); - char * readBuffer = (char *)taosMemoryCalloc(1, MAX_TEST_FILE_SIZE); + char *buffer; + char *writeBuffer = (char *)taosMemoryCalloc(1, MAX_TEST_FILE_SIZE); + char *readBuffer = (char *)taosMemoryCalloc(1, MAX_TEST_FILE_SIZE); int64_t size = fillBufferWithRandomWords(writeBuffer, MAX_TEST_FILE_SIZE); - char * fname = "./osFilePerformanceTest.txt"; + char *fname = "./osFilePerformanceTest.txt"; TdFilePtr pOutFD = taosCreateFile(fname, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC); ASSERT_NE(pOutFD, nullptr); @@ -342,6 +657,6 @@ TEST(osTest, osFilePerformance) { (void)printf("Test OpenForRead & Close file %d times, cost: %" PRId64 "us\n", TESTTIMES, OpenForReadCloseFileCost); } -#endif // OSFILE_PERFORMANCE_TEST +#endif // OSFILE_PERFORMANCE_TEST #pragma GCC diagnostic pop diff --git a/source/os/test/osThreadTests.cpp b/source/os/test/osThreadTests.cpp index 20964c86bc..1f70c1abba 100644 --- a/source/os/test/osThreadTests.cpp +++ b/source/os/test/osThreadTests.cpp @@ -110,7 +110,7 @@ TEST(osThreadTests, thread) { taosMsleep(300); (void)taosThreadCancel(tid1); - + reti = taosThreadCreate(&tid2, NULL, funcPtr501, NULL); EXPECT_EQ(reti, 0); taosMsleep(1000); @@ -498,4 +498,42 @@ TEST(osThreadTests, spinlock) { TEST(osThreadTests, others) { taosThreadTestCancel(); taosThreadClear(NULL); + + TdThread tid1 = {0}; + TdThread tid2 = {0}; + TdThread *thread = &tid1; + taosResetPthread(NULL); + taosResetPthread(thread); + + bool retb = taosComparePthread(tid1, tid2); + EXPECT_TRUE(retb); + + int32_t ret32 = taosGetAppName(NULL, NULL); + EXPECT_NE(ret32, 0); + + char name[32] = {0}; + int32_t pid; + ret32 = taosGetPIdByName(name, NULL); + EXPECT_NE(ret32, 0); + ret32 = taosGetPIdByName(NULL, &pid); + EXPECT_NE(ret32, 0); + + ret32 = tsem_timewait(NULL, 124); + EXPECT_NE(ret32, 0); + ret32 = tsem_wait(NULL); + EXPECT_NE(ret32, 0); + ret32 = tsem2_init(NULL, 0, 0); + EXPECT_NE(ret32, 0); + ret32 = tsem_post(NULL); + EXPECT_NE(ret32, 0); + ret32 = tsem_destroy(NULL); + EXPECT_NE(ret32, 0); + ret32 = tsem2_post(NULL); + EXPECT_NE(ret32, 0); + ret32 = tsem2_destroy(NULL); + EXPECT_NE(ret32, 0); + ret32 = tsem2_wait(NULL); + EXPECT_NE(ret32, 0); + ret32 = tsem2_timewait(NULL, 128); + EXPECT_NE(ret32, 0); } \ No newline at end of file From 4c3e6fbd19e188fc2d4d8c81393bd95ce5c3b9dd Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Tue, 25 Feb 2025 16:39:05 +0800 Subject: [PATCH 07/22] fix: os unitest --- source/os/test/CMakeLists.txt | 84 ++++++++++++++++------------------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/source/os/test/CMakeLists.txt b/source/os/test/CMakeLists.txt index a26fc88916..4b7cb3f7b9 100644 --- a/source/os/test/CMakeLists.txt +++ b/source/os/test/CMakeLists.txt @@ -15,36 +15,47 @@ ENDIF() INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc) if(TD_LINUX) -add_executable(osAtomicTests "osAtomicTests.cpp") -target_link_libraries(osAtomicTests os util gtest_main) -add_test( - NAME osAtomicTests - COMMAND osAtomicTests -) -endif() + add_executable(osAtomicTests "osAtomicTests.cpp") + target_link_libraries(osAtomicTests os util gtest_main) + add_test( + NAME osAtomicTests + COMMAND osAtomicTests + ) -if(TD_LINUX) -add_executable(osDirTests "osDirTests.cpp") -target_link_libraries(osDirTests os util gtest_main) -add_test( - NAME osDirTests - COMMAND osDirTests -) -add_executable(osFileTests "osFileTests.cpp") -target_link_libraries(osFileTests os util gtest_main) -add_test( - NAME osFileTests - COMMAND osFileTests -) -endif() + add_executable(osDirTests "osDirTests.cpp") + target_link_libraries(osDirTests os util gtest_main) + add_test( + NAME osDirTests + COMMAND osDirTests + ) -if(TD_LINUX) -add_executable(osEnvTests "osEnvTests.cpp") -target_link_libraries(osEnvTests os util gtest_main) -add_test( - NAME osEnvTests - COMMAND osEnvTests -) + add_executable(osFileTests "osFileTests.cpp") + target_link_libraries(osFileTests os util gtest_main) + add_test( + NAME osFileTests + COMMAND osFileTests + ) + + add_executable(osEnvTests "osEnvTests.cpp") + target_link_libraries(osEnvTests os util gtest_main) + add_test( + NAME osEnvTests + COMMAND osEnvTests + ) + + add_executable(osTests "osTests.cpp") + target_link_libraries(osTests os util gtest_main) + add_test( + NAME osTests + COMMAND osTests + ) + + add_executable(osThreadTests "osThreadTests.cpp") + target_link_libraries(osThreadTests os util gtest_main) + add_test( + NAME osThreadTests + COMMAND osThreadTests + ) endif() add_executable(osMathTests "osMathTests.cpp") @@ -75,13 +86,6 @@ add_test( COMMAND osStringTests ) -add_executable(osTests "osTests.cpp") -target_link_libraries(osTests os util gtest_main) -add_test( - NAME osTests - COMMAND osTests -) - add_executable(osSystemTests "osSystemTests.cpp") target_link_libraries(osSystemTests os util gtest_main) add_test( @@ -89,19 +93,9 @@ add_test( COMMAND osSystemTests ) -if(TD_LINUX) -add_executable(osThreadTests "osThreadTests.cpp") -target_link_libraries(osThreadTests os util gtest_main) -add_test( - NAME osThreadTests - COMMAND osThreadTests -) -endif() - add_executable(osTimeTests "osTimeTests.cpp") target_link_libraries(osTimeTests os util gtest_main) add_test( NAME osTimeTests COMMAND osTimeTests ) - From 7a75444a02f02237a281565c9e6ec45a92b42b13 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 10:56:19 +0800 Subject: [PATCH 08/22] enh: add log level to each log entry --- include/libs/function/taosudf.h | 8 ++-- include/libs/qcom/query.h | 52 +++++------------------- include/util/tlog.h | 17 ++++---- source/client/inc/clientLog.h | 14 +++---- source/client/jni/jniCommon.h | 8 ++-- source/client/src/clientTmq.c | 6 +-- source/dnode/mgmt/node_util/inc/dmUtil.h | 8 ++-- source/dnode/mnode/impl/inc/mndInt.h | 8 ++-- source/dnode/mnode/sdb/inc/sdb.h | 8 ++-- source/dnode/snode/src/snode.c | 6 +-- source/dnode/vnode/src/inc/meta.h | 12 +++--- source/dnode/vnode/src/inc/sma.h | 12 +++--- source/dnode/vnode/src/inc/tq.h | 12 +++--- source/dnode/vnode/src/inc/tsdb.h | 12 +++--- source/dnode/vnode/src/inc/vnd.h | 12 +++--- source/libs/azure/inc/azInt.h | 12 +++--- source/libs/function/inc/fnLog.h | 12 +++--- source/libs/index/inc/indexInt.h | 12 +++--- source/libs/nodes/src/nodesUtilFuncs.c | 3 +- source/libs/stream/inc/streamInt.h | 12 +++--- source/libs/sync/inc/syncUtil.h | 52 ++++++++++++------------ source/libs/tdb/src/inc/tdbOs.h | 12 +++--- source/libs/tfs/inc/tfsInt.h | 12 +++--- source/libs/transport/inc/transLog.h | 8 ++-- source/libs/wal/inc/walInt.h | 8 ++-- source/util/src/ttimer.c | 44 ++++---------------- utils/tsim/inc/simInt.h | 44 ++++---------------- 27 files changed, 170 insertions(+), 256 deletions(-) diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h index fd6b42f61e..ece98ac243 100644 --- a/include/libs/function/taosudf.h +++ b/include/libs/function/taosudf.h @@ -347,10 +347,10 @@ typedef int32_t (*TScriptCloseFunc)(); extern int32_t udfDebugFlag; #define udfFatal(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF FATAL ", 1, 255, __VA_ARGS__); }} #define udfError(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF ERROR ", 1, 255, __VA_ARGS__); }} - #define udfWarn(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF WARN ", 2, 255, __VA_ARGS__); }} - #define udfInfo(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF ", 2, 255, __VA_ARGS__); }} - #define udfDebug(...) { if (udfDebugFlag & 4) { taosPrintLog("UDF ", 4, udfDebugFlag, __VA_ARGS__); }} - #define udfTrace(...) { if (udfDebugFlag & 8) { taosPrintLog("UDF ", 8, udfDebugFlag, __VA_ARGS__); }} + #define udfWarn(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF WARN ", 2, 255, __VA_ARGS__); }} + #define udfInfo(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF INFO ", 2, 255, __VA_ARGS__); }} + #define udfDebug(...) { if (udfDebugFlag & 4) { taosPrintLog("UDF DEBUG ", 4, udfDebugFlag, __VA_ARGS__); }} + #define udfTrace(...) { if (udfDebugFlag & 8) { taosPrintLog("UDF TRACE ", 8, udfDebugFlag, __VA_ARGS__); }} #endif // clang-format on diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index a17e67279c..065c7f92e8 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -409,48 +409,16 @@ void* getTaskPoolWorkerCb(); #define IS_AUDIT_CTB_NAME(_ctbname) \ ((*(_ctbname) == 't') && (0 == strncmp(_ctbname, TSDB_AUDIT_CTB_OPERATION, TSDB_AUDIT_CTB_OPERATION_LEN))) -#define qFatal(...) \ - do { \ - if (qDebugFlag & DEBUG_FATAL) { \ - taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ - } \ - } while (0) -#define qError(...) \ - do { \ - if (qDebugFlag & DEBUG_ERROR) { \ - taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ - } \ - } while (0) -#define qWarn(...) \ - do { \ - if (qDebugFlag & DEBUG_WARN) { \ - taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ - } \ - } while (0) -#define qInfo(...) \ - do { \ - if (qDebugFlag & DEBUG_INFO) { \ - taosPrintLog("QRY ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ - } \ - } while (0) -#define qDebug(...) \ - do { \ - if (qDebugFlag & DEBUG_DEBUG) { \ - taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ - } \ - } while (0) -#define qTrace(...) \ - do { \ - if (qDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \ - } \ - } while (0) -#define qDebugL(...) \ - do { \ - if (qDebugFlag & DEBUG_DEBUG) { \ - taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ - } \ - } while (0) +// clang-format off +#define qFatal(...) { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} +#define qError(...) { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} +#define qWarn(...) { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} +#define qInfo(...) { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} +#define qDebug(...) { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} +#define qTrace(...) { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY TRACE ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); }} +#define qDebugL(...){ if (qDebugFlag & DEBUG_DEBUG) { taosPrintLongString("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} +#define qInfoL(...) { if (qDebugFlag & DEBUG_INFO) { taosPrintLongString("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} +// clang-format on #define QRY_ERR_RET(c) \ do { \ diff --git a/include/util/tlog.h b/include/util/tlog.h index 60ddc29288..07b11bb16e 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -128,18 +128,19 @@ bool reportThreadSetQuit(); void writeCrashLogToFile(int signum, void *sigInfo, char *nodeType, int64_t clusterId, int64_t startTime); // clang-format off -#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} -#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} -#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} -#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }} -#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", DEBUG_TRACE, uDebugFlag, __VA_ARGS__); }} -#define uDebugL(...){ if (uDebugFlag & DEBUG_DEBUG) { taosPrintLongString("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }} -#define uInfoL(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLongString("UTL ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL DEBUG ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }} +#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL TRACE ", DEBUG_TRACE, uDebugFlag, __VA_ARGS__); }} +#define uDebugL(...){ if (uDebugFlag & DEBUG_DEBUG) { taosPrintLongString("UTL DEBUG ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }} +#define uInfoL(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLongString("UTL INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define pError(...) { taosPrintLog("APP ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); } -#define pPrint(...) { taosPrintLog("APP ", DEBUG_INFO, 255, __VA_ARGS__); } +#define pPrint(...) { taosPrintLog("APP INFO ", DEBUG_INFO, 255, __VA_ARGS__); } // clang-format on + // #define BUF_PAGE_DEBUG #ifdef __cplusplus } diff --git a/source/client/inc/clientLog.h b/source/client/inc/clientLog.h index 1a6d47d4f9..4e6c7bd3a6 100644 --- a/source/client/inc/clientLog.h +++ b/source/client/inc/clientLog.h @@ -25,14 +25,14 @@ extern "C" { // clang-format off #define tscFatal(...) do { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", DEBUG_FATAL, cDebugFlag, __VA_ARGS__); }} while(0) #define tscError(...) do { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", DEBUG_ERROR, cDebugFlag, __VA_ARGS__); }} while(0) +#define tscWarn(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0) +#define tscInfo(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC INFO ", DEBUG_INFO, cDebugFlag, __VA_ARGS__); }} while(0) +#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC DEBUG ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0) +#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC TRACE ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0) +#define tscPerf(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC PERF ", 0, cDebugFlag, __VA_ARGS__); }} while(0) #define tscErrorL(...) do { if (cDebugFlag & DEBUG_ERROR) { taosPrintLongString("TSC ERROR ", DEBUG_ERROR, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscWarn(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscWarnL(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLongString("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscInfo(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", DEBUG_INFO, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0) -#define tscPerf(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", 0, cDebugFlag, __VA_ARGS__); }} while(0) +#define tscWarnL(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLongString("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0) +#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC DEBUG ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0) #define tscLog(...) do { taosPrintLog("TSC ", 0, DEBUG_FILE, __VA_ARGS__); } while(0) #define tscLogL(...) do { taosPrintLongString("TSC ", 0, DEBUG_FILE, __VA_ARGS__); } while(0) // clang-format on diff --git a/source/client/jni/jniCommon.h b/source/client/jni/jniCommon.h index d620487ad2..f636a11aef 100644 --- a/source/client/jni/jniCommon.h +++ b/source/client/jni/jniCommon.h @@ -37,25 +37,25 @@ #define jniWarn(...) \ { \ if (jniDebugFlag & DEBUG_WARN) { \ - taosPrintLog("JNI WARN ", DEBUG_WARN, jniDebugFlag, __VA_ARGS__); \ + taosPrintLog("JNI WARN ", DEBUG_WARN, jniDebugFlag, __VA_ARGS__); \ } \ } #define jniInfo(...) \ { \ if (jniDebugFlag & DEBUG_INFO) { \ - taosPrintLog("JNI ", DEBUG_INFO, jniDebugFlag, __VA_ARGS__); \ + taosPrintLog("JNI INFO ", DEBUG_INFO, jniDebugFlag, __VA_ARGS__); \ } \ } #define jniDebug(...) \ { \ if (jniDebugFlag & DEBUG_DEBUG) { \ - taosPrintLog("JNI ", DEBUG_DEBUG, jniDebugFlag, __VA_ARGS__); \ + taosPrintLog("JNI DEBUG ", DEBUG_DEBUG, jniDebugFlag, __VA_ARGS__); \ } \ } #define jniTrace(...) \ { \ if (jniDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("JNI ", DEBUG_TRACE, jniDebugFlag, __VA_ARGS__); \ + taosPrintLog("JNI TRACE ", DEBUG_TRACE, jniDebugFlag, __VA_ARGS__); \ } \ } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 4adc738d35..a11f351a1e 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -24,9 +24,9 @@ #include "tref.h" #include "ttimer.h" -#define tqErrorC(...) do { if (cDebugFlag & DEBUG_ERROR || tqClientDebugFlag & DEBUG_ERROR) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) -#define tqInfoC(...) do { if (cDebugFlag & DEBUG_INFO || tqClientDebugFlag & DEBUG_INFO) { taosPrintLog("TQ ", DEBUG_INFO, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) -#define tqDebugC(...) do { if (cDebugFlag & DEBUG_DEBUG || tqClientDebugFlag & DEBUG_DEBUG) { taosPrintLog("TQ ", DEBUG_DEBUG, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) +#define tqErrorC(...) do { if (cDebugFlag & DEBUG_ERROR || tqClientDebugFlag & DEBUG_ERROR) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) +#define tqInfoC(...) do { if (cDebugFlag & DEBUG_INFO || tqClientDebugFlag & DEBUG_INFO) { taosPrintLog("TQ INFO ", DEBUG_INFO, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) +#define tqDebugC(...) do { if (cDebugFlag & DEBUG_DEBUG || tqClientDebugFlag & DEBUG_DEBUG) { taosPrintLog("TQ DEBUG ", DEBUG_DEBUG, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) #define EMPTY_BLOCK_POLL_IDLE_DURATION 10 #define DEFAULT_AUTO_COMMIT_INTERVAL 5000 diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index de20f807e9..1c96b0c239 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -48,10 +48,10 @@ extern "C" { #define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} #define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} -#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} -#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", DEBUG_INFO, 255, __VA_ARGS__); }} -#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }} -#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }} +#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND DEBUG ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }} +#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND TRACE ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }} #define encryptDebug(...) { \ if (toLogFile) { \ diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index 982a541bb3..ad95f719b2 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -37,10 +37,10 @@ extern "C" { // clang-format off #define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} #define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} -#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} -#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", DEBUG_INFO, 255, __VA_ARGS__); }} -#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }} -#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} +#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND DEBUG ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }} +#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND TRACE ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} #define mGFatal(param, ...) { if (mDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mFatal(param ",QID:%s", __VA_ARGS__, buf);}} #define mGError(param, ...) { if (mDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mError(param ",QID:%s", __VA_ARGS__, buf);}} diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 114a5ca59b..1994f06a20 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -31,10 +31,10 @@ extern "C" { // clang-format off #define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} #define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} -#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} -#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", DEBUG_INFO, 255, __VA_ARGS__); }} -#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }} -#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} +#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND DEBUG ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }} +#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND TRACE ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} // clang-format on #define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \ diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index 6eee8c510b..fe1b333108 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -20,9 +20,9 @@ #include "tuuid.h" // clang-format off -#define sndError(...) do { if (sndDebugFlag & DEBUG_ERROR) {taosPrintLog("SND ERROR ", DEBUG_ERROR, sndDebugFlag, __VA_ARGS__);}} while (0) -#define sndInfo(...) do { if (sndDebugFlag & DEBUG_INFO) { taosPrintLog("SND INFO ", DEBUG_INFO, sndDebugFlag, __VA_ARGS__);}} while (0) -#define sndDebug(...) do { if (sndDebugFlag & DEBUG_DEBUG) { taosPrintLog("SND ", DEBUG_DEBUG, sndDebugFlag, __VA_ARGS__);}} while (0) +#define sndError(...) do { if (sndDebugFlag & DEBUG_ERROR) { taosPrintLog("SND ERROR ", DEBUG_ERROR, sndDebugFlag, __VA_ARGS__);}} while (0) +#define sndInfo(...) do { if (sndDebugFlag & DEBUG_INFO) { taosPrintLog("SND INFO ", DEBUG_INFO, sndDebugFlag, __VA_ARGS__);}} while (0) +#define sndDebug(...) do { if (sndDebugFlag & DEBUG_DEBUG) { taosPrintLog("SND DEBUG ", DEBUG_DEBUG, sndDebugFlag, __VA_ARGS__);}} while (0) // clang-format on int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProcessVer) { diff --git a/source/dnode/vnode/src/inc/meta.h b/source/dnode/vnode/src/inc/meta.h index c05953c67d..147da7436d 100644 --- a/source/dnode/vnode/src/inc/meta.h +++ b/source/dnode/vnode/src/inc/meta.h @@ -30,12 +30,12 @@ typedef struct SMetaCache SMetaCache; // metaDebug ================== // clang-format off -#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("MTA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) -#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("MTA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("MTA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) -#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("MTA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("MTA ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0) -#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("MTA ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0) +#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("MTA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) +#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("MTA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("MTA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("MTA INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("MTA DEBUG ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0) +#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("MTA TRACE ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0) // clang-format on // metaOpen ================== diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h index 243f51ca0a..182290f77e 100644 --- a/source/dnode/vnode/src/inc/sma.h +++ b/source/dnode/vnode/src/inc/sma.h @@ -24,12 +24,12 @@ extern "C" { // smaDebug ================ // clang-format off -#define smaFatal(...) do { if (smaDebugFlag & DEBUG_FATAL) { taosPrintLog("SMA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) -#define smaError(...) do { if (smaDebugFlag & DEBUG_ERROR) { taosPrintLog("SMA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define smaWarn(...) do { if (smaDebugFlag & DEBUG_WARN) { taosPrintLog("SMA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) -#define smaInfo(...) do { if (smaDebugFlag & DEBUG_INFO) { taosPrintLog("SMA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define smaDebug(...) do { if (smaDebugFlag & DEBUG_DEBUG) { taosPrintLog("SMA ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) -#define smaTrace(...) do { if (smaDebugFlag & DEBUG_TRACE) { taosPrintLog("SMA ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) +#define smaFatal(...) do { if (smaDebugFlag & DEBUG_FATAL) { taosPrintLog("SMA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) +#define smaError(...) do { if (smaDebugFlag & DEBUG_ERROR) { taosPrintLog("SMA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define smaWarn(...) do { if (smaDebugFlag & DEBUG_WARN) { taosPrintLog("SMA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define smaInfo(...) do { if (smaDebugFlag & DEBUG_INFO) { taosPrintLog("SMA INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define smaDebug(...) do { if (smaDebugFlag & DEBUG_DEBUG) { taosPrintLog("SMA DEBUG ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) +#define smaTrace(...) do { if (smaDebugFlag & DEBUG_TRACE) { taosPrintLog("SMA TRACE ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) // clang-format on #define RSMA_TASK_INFO_HASH_SLOT (8) diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index cd66e82687..be0df15447 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -33,12 +33,12 @@ extern "C" { // tqDebug =================== // clang-format off -#define tqFatal(...) do { if (tqDebugFlag & DEBUG_FATAL) { taosPrintLog("TQ FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) -#define tqError(...) do { if (tqDebugFlag & DEBUG_ERROR) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define tqWarn(...) do { if (tqDebugFlag & DEBUG_WARN) { taosPrintLog("TQ WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) -#define tqInfo(...) do { if (tqDebugFlag & DEBUG_INFO) { taosPrintLog("TQ ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define tqDebug(...) do { if (tqDebugFlag & DEBUG_DEBUG) { taosPrintLog("TQ ", DEBUG_DEBUG, tqDebugFlag, __VA_ARGS__); }} while(0) -#define tqTrace(...) do { if (tqDebugFlag & DEBUG_TRACE) { taosPrintLog("TQ ", DEBUG_TRACE, tqDebugFlag, __VA_ARGS__); }} while(0) +#define tqFatal(...) do { if (tqDebugFlag & DEBUG_FATAL) { taosPrintLog("TQ FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) +#define tqError(...) do { if (tqDebugFlag & DEBUG_ERROR) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define tqWarn(...) do { if (tqDebugFlag & DEBUG_WARN) { taosPrintLog("TQ WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define tqInfo(...) do { if (tqDebugFlag & DEBUG_INFO) { taosPrintLog("TQ INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define tqDebug(...) do { if (tqDebugFlag & DEBUG_DEBUG) { taosPrintLog("TQ DEBUG ", DEBUG_DEBUG, tqDebugFlag, __VA_ARGS__); }} while(0) +#define tqTrace(...) do { if (tqDebugFlag & DEBUG_TRACE) { taosPrintLog("TQ TRACE ", DEBUG_TRACE, tqDebugFlag, __VA_ARGS__); }} while(0) // clang-format on #define IS_OFFSET_RESET_TYPE(_t) ((_t) < 0) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 753f7cb726..1778b7cda8 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -28,12 +28,12 @@ extern "C" { // tsdbDebug ================ // clang-format off -#define tsdbFatal(...) do { if (tsdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TSD FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) -#define tsdbError(...) do { if (tsdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TSD ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define tsdbWarn(...) do { if (tsdbDebugFlag & DEBUG_WARN) { taosPrintLog("TSD WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) -#define tsdbInfo(...) do { if (tsdbDebugFlag & DEBUG_INFO) { taosPrintLog("TSD ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define tsdbDebug(...) do { if (tsdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSD ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) -#define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TSD ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) +#define tsdbFatal(...) do { if (tsdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TSD FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) +#define tsdbError(...) do { if (tsdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TSD ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define tsdbWarn(...) do { if (tsdbDebugFlag & DEBUG_WARN) { taosPrintLog("TSD WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define tsdbInfo(...) do { if (tsdbDebugFlag & DEBUG_INFO) { taosPrintLog("TSD INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define tsdbDebug(...) do { if (tsdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSD DEBUG ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) +#define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TSD TRACE ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) // clang-format on typedef struct TSDBROW TSDBROW; diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 7da3dcbe5a..db48f8cfa3 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -25,12 +25,12 @@ extern "C" { #endif // clang-format off -#define vFatal(...) do { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) -#define vError(...) do { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define vWarn(...) do { if (vDebugFlag & DEBUG_WARN) { taosPrintLog("VND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) -#define vInfo(...) do { if (vDebugFlag & DEBUG_INFO) { taosPrintLog("VND ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define vDebug(...) do { if (vDebugFlag & DEBUG_DEBUG) { taosPrintLog("VND ", DEBUG_DEBUG, vDebugFlag, __VA_ARGS__); }} while(0) -#define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0) +#define vFatal(...) do { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) +#define vError(...) do { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define vWarn(...) do { if (vDebugFlag & DEBUG_WARN) { taosPrintLog("VND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define vInfo(...) do { if (vDebugFlag & DEBUG_INFO) { taosPrintLog("VND INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define vDebug(...) do { if (vDebugFlag & DEBUG_DEBUG) { taosPrintLog("VND DEBUG ", DEBUG_DEBUG, vDebugFlag, __VA_ARGS__); }} while(0) +#define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND TRACE ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0) #define vGTrace(param, ...) do { if (vDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vTrace(param ",QID:%s", __VA_ARGS__, buf);}} while(0) #define vGFatal(param, ...) do { if (vDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vFatal(param ",QID:%s", __VA_ARGS__, buf);}} while(0) diff --git a/source/libs/azure/inc/azInt.h b/source/libs/azure/inc/azInt.h index 3538e925c7..e3ea685ebb 100644 --- a/source/libs/azure/inc/azInt.h +++ b/source/libs/azure/inc/azInt.h @@ -27,12 +27,12 @@ extern "C" { #endif // clang-format off -#define azFatal(...) { if (azDebugFlag & DEBUG_FATAL) { taosPrintLog("AZR FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} -#define azError(...) { if (azDebugFlag & DEBUG_ERROR) { taosPrintLog("AZR ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} -#define azWarn(...) { if (azDebugFlag & DEBUG_WARN) { taosPrintLog("AZR WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} -#define azInfo(...) { if (azDebugFlag & DEBUG_INFO) { taosPrintLog("AZR ", DEBUG_INFO, 255, __VA_ARGS__); }} -#define azDebug(...) { if (azDebugFlag & DEBUG_DEBUG) { taosPrintLog("AZR ", DEBUG_DEBUG, azDebugFlag, __VA_ARGS__); }} -#define azTrace(...) { if (azDebugFlag & DEBUG_TRACE) { taosPrintLog("AZR ", DEBUG_TRACE, azDebugFlag, __VA_ARGS__); }} +#define azFatal(...) { if (azDebugFlag & DEBUG_FATAL) { taosPrintLog("AZR FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} +#define azError(...) { if (azDebugFlag & DEBUG_ERROR) { taosPrintLog("AZR ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} +#define azWarn(...) { if (azDebugFlag & DEBUG_WARN) { taosPrintLog("AZR WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define azInfo(...) { if (azDebugFlag & DEBUG_INFO) { taosPrintLog("AZR INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define azDebug(...) { if (azDebugFlag & DEBUG_DEBUG) { taosPrintLog("AZR DEBUG ", DEBUG_DEBUG, azDebugFlag, __VA_ARGS__); }} +#define azTrace(...) { if (azDebugFlag & DEBUG_TRACE) { taosPrintLog("AZR TRACE ", DEBUG_TRACE, azDebugFlag, __VA_ARGS__); }} // clang-format on #ifdef __cplusplus diff --git a/source/libs/function/inc/fnLog.h b/source/libs/function/inc/fnLog.h index 150d145f50..b2c3937363 100644 --- a/source/libs/function/inc/fnLog.h +++ b/source/libs/function/inc/fnLog.h @@ -22,12 +22,12 @@ extern "C" { #endif // clang-format off -#define fnFatal(...) { if (udfDebugFlag & DEBUG_FATAL) { taosPrintLog("UDF FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} -#define fnError(...) { if (udfDebugFlag & DEBUG_ERROR) { taosPrintLog("UDF ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} -#define fnWarn(...) { if (udfDebugFlag & DEBUG_WARN) { taosPrintLog("UDF WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} -#define fnInfo(...) { if (udfDebugFlag & DEBUG_INFO) { taosPrintLog("UDF ", DEBUG_INFO, 255, __VA_ARGS__); }} -#define fnDebug(...) { if (udfDebugFlag & DEBUG_DEBUG) { taosPrintLog("UDF ", DEBUG_DEBUG, udfDebugFlag, __VA_ARGS__); }} -#define fnTrace(...) { if (udfDebugFlag & DEBUG_TRACE) { taosPrintLog("UDF ", DEBUG_TRACE, udfDebugFlag, __VA_ARGS__); }} +#define fnFatal(...) { if (udfDebugFlag & DEBUG_FATAL) { taosPrintLog("UDF FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} +#define fnError(...) { if (udfDebugFlag & DEBUG_ERROR) { taosPrintLog("UDF ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} +#define fnWarn(...) { if (udfDebugFlag & DEBUG_WARN) { taosPrintLog("UDF WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define fnInfo(...) { if (udfDebugFlag & DEBUG_INFO) { taosPrintLog("UDF INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define fnDebug(...) { if (udfDebugFlag & DEBUG_DEBUG) { taosPrintLog("UDF DEBUG ", DEBUG_DEBUG, udfDebugFlag, __VA_ARGS__); }} +#define fnTrace(...) { if (udfDebugFlag & DEBUG_TRACE) { taosPrintLog("UDF TRACE ", DEBUG_TRACE, udfDebugFlag, __VA_ARGS__); }} // clang-format on #ifdef __cplusplus diff --git a/source/libs/index/inc/indexInt.h b/source/libs/index/inc/indexInt.h index 4e7c0a0ef7..19ff27cd64 100644 --- a/source/libs/index/inc/indexInt.h +++ b/source/libs/index/inc/indexInt.h @@ -32,12 +32,12 @@ extern "C" { #endif // clang-format off -#define indexFatal(...) do { if (idxDebugFlag & DEBUG_FATAL) { taosPrintLog("IDX FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while (0) -#define indexError(...) do { if (idxDebugFlag & DEBUG_ERROR) { taosPrintLog("IDX ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while (0) -#define indexWarn(...) do { if (idxDebugFlag & DEBUG_WARN) { taosPrintLog("IDX WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while (0) -#define indexInfo(...) do { if (idxDebugFlag & DEBUG_INFO) { taosPrintLog("IDX ", DEBUG_INFO, 255, __VA_ARGS__); } } while (0) -#define indexDebug(...) do { if (idxDebugFlag & DEBUG_DEBUG) { taosPrintLog("IDX ", DEBUG_DEBUG, idxDebugFlag, __VA_ARGS__);} } while (0) -#define indexTrace(...) do { if (idxDebugFlag & DEBUG_TRACE) { taosPrintLog("IDX", DEBUG_TRACE, idxDebugFlag, __VA_ARGS__);} } while (0) +#define indexFatal(...) do { if (idxDebugFlag & DEBUG_FATAL) { taosPrintLog("IDX FATAL ", DEBUG_FATAL, 255, __VA_ARGS__);}} while (0) +#define indexError(...) do { if (idxDebugFlag & DEBUG_ERROR) { taosPrintLog("IDX ERROR ", DEBUG_ERROR, 255, __VA_ARGS__);}} while (0) +#define indexWarn(...) do { if (idxDebugFlag & DEBUG_WARN) { taosPrintLog("IDX WARN ", DEBUG_WARN, 255, __VA_ARGS__);}} while (0) +#define indexInfo(...) do { if (idxDebugFlag & DEBUG_INFO) { taosPrintLog("IDX INFO ", DEBUG_INFO, 255, __VA_ARGS__);}} while (0) +#define indexDebug(...) do { if (idxDebugFlag & DEBUG_DEBUG) { taosPrintLog("IDX DEBUG ", DEBUG_DEBUG, idxDebugFlag, __VA_ARGS__);}} while (0) +#define indexTrace(...) do { if (idxDebugFlag & DEBUG_TRACE) { taosPrintLog("IDX TRACE ", DEBUG_TRACE, idxDebugFlag, __VA_ARGS__);}} while (0) // clang-format on extern void* indexQhandle; diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 9473e75642..899e1134b1 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -970,8 +970,9 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) { default: break; } - if (TSDB_CODE_SUCCESS != code) + if (TSDB_CODE_SUCCESS != code) { nodesError("nodesMakeNode unknown node = %s", nodesNodeName(type)); + } else *ppNodeOut = pNode; return code; diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index d9778a6a05..bc47cd4ce1 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -41,12 +41,12 @@ extern "C" { #define STREAM_TASK_QUEUE_CAPACITY_IN_SIZE (10) // clang-format off -#define stFatal(...) do { if (stDebugFlag & DEBUG_FATAL) { taosPrintLog("STM FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) -#define stError(...) do { if (stDebugFlag & DEBUG_ERROR) { taosPrintLog("STM ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define stWarn(...) do { if (stDebugFlag & DEBUG_WARN) { taosPrintLog("STM WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) -#define stInfo(...) do { if (stDebugFlag & DEBUG_INFO) { taosPrintLog("STM ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define stDebug(...) do { if (stDebugFlag & DEBUG_DEBUG) { taosPrintLog("STM ", DEBUG_DEBUG, stDebugFlag, __VA_ARGS__); }} while(0) -#define stTrace(...) do { if (stDebugFlag & DEBUG_TRACE) { taosPrintLog("STM ", DEBUG_TRACE, stDebugFlag, __VA_ARGS__); }} while(0) +#define stFatal(...) do { if (stDebugFlag & DEBUG_FATAL) { taosPrintLog("STM FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) +#define stError(...) do { if (stDebugFlag & DEBUG_ERROR) { taosPrintLog("STM ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define stWarn(...) do { if (stDebugFlag & DEBUG_WARN) { taosPrintLog("STM WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define stInfo(...) do { if (stDebugFlag & DEBUG_INFO) { taosPrintLog("STM INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define stDebug(...) do { if (stDebugFlag & DEBUG_DEBUG) { taosPrintLog("STM DEBUG ", DEBUG_DEBUG, stDebugFlag, __VA_ARGS__); }} while(0) +#define stTrace(...) do { if (stDebugFlag & DEBUG_TRACE) { taosPrintLog("STM TRACE ", DEBUG_TRACE, stDebugFlag, __VA_ARGS__); }} while(0) // clang-format on typedef struct SStreamTmrInfo { diff --git a/source/libs/sync/inc/syncUtil.h b/source/libs/sync/inc/syncUtil.h index 7b71491f47..7c4f9b2781 100644 --- a/source/libs/sync/inc/syncUtil.h +++ b/source/libs/sync/inc/syncUtil.h @@ -27,45 +27,45 @@ extern "C" { #define sFatal(...) if (sDebugFlag & DEBUG_FATAL) { taosPrintLog("SYN FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); } #define sError(...) if (sDebugFlag & DEBUG_ERROR) { taosPrintLog("SYN ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); } -#define sWarn(...) if (sDebugFlag & DEBUG_WARN) { taosPrintLog("SYN WARN ", DEBUG_WARN, 255, __VA_ARGS__); } -#define sInfo(...) if (sDebugFlag & DEBUG_INFO) { taosPrintLog("SYN ", DEBUG_INFO, 255, __VA_ARGS__); } -#define sDebug(...) if (sDebugFlag & DEBUG_DEBUG) { taosPrintLog("SYN ", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__); } -#define sTrace(...) if (sDebugFlag & DEBUG_TRACE) { taosPrintLog("SYN ", DEBUG_TRACE, sDebugFlag, __VA_ARGS__); } +#define sWarn(...) if (sDebugFlag & DEBUG_WARN) { taosPrintLog("SYN WARN ", DEBUG_WARN, 255, __VA_ARGS__); } +#define sInfo(...) if (sDebugFlag & DEBUG_INFO) { taosPrintLog("SYN INFO ", DEBUG_INFO, 255, __VA_ARGS__); } +#define sDebug(...) if (sDebugFlag & DEBUG_DEBUG) { taosPrintLog("SYN DEBUG ", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__); } +#define sTrace(...) if (sDebugFlag & DEBUG_TRACE) { taosPrintLog("SYN TRACE ", DEBUG_TRACE, sDebugFlag, __VA_ARGS__); } #define sGTrace(param, ...) do { if (sDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sTrace(param ", QID:%s", __VA_ARGS__, buf);}} while(0) #define sGFatal(param, ...) do { if (sDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sFatal(param ", QID:%s", __VA_ARGS__, buf);}} while(0) -#define sGError(param, ...) do { if (sDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf);sError(param ", QID:%s", __VA_ARGS__, buf);}} while(0) -#define sGWarn(param, ...) do { if (sDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sWarn(param ", QID:%s", __VA_ARGS__, buf);}} while(0) -#define sGInfo(param, ...) do { if (sDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sInfo(param ", QID:%s", __VA_ARGS__, buf);}} while(0) -#define sGDebug(param, ...) do { if (sDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sDebug(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define sGError(param, ...) do { if (sDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf);sError(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define sGWarn(param, ...) do { if (sDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sWarn(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define sGInfo(param, ...) do { if (sDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sInfo(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define sGDebug(param, ...) do { if (sDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); sDebug(param ", QID:%s", __VA_ARGS__, buf);}} while(0) #define sLFatal(...) if (sDebugFlag & DEBUG_FATAL) { taosPrintLongString("SYN FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); } #define sLError(...) if (sDebugFlag & DEBUG_ERROR) { taosPrintLongString("SYN ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); } -#define sLWarn(...) if (sDebugFlag & DEBUG_WARN) { taosPrintLongString("SYN WARN ", DEBUG_WARN, 255, __VA_ARGS__); } -#define sLInfo(...) if (sDebugFlag & DEBUG_INFO) { taosPrintLongString("SYN ", DEBUG_INFO, 255, __VA_ARGS__); } -#define sLDebug(...) if (sDebugFlag & DEBUG_DEBUG) { taosPrintLongString("SYN ", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__); } -#define sLTrace(...) if (sDebugFlag & DEBUG_TRACE) { taosPrintLongString("SYN ", DEBUG_TRACE, sDebugFlag, __VA_ARGS__); } +#define sLWarn(...) if (sDebugFlag & DEBUG_WARN) { taosPrintLongString("SYN WARN ", DEBUG_WARN, 255, __VA_ARGS__); } +#define sLInfo(...) if (sDebugFlag & DEBUG_INFO) { taosPrintLongString("SYN INFO ", DEBUG_INFO, 255, __VA_ARGS__); } +#define sLDebug(...) if (sDebugFlag & DEBUG_DEBUG) { taosPrintLongString("SYN DEBUG ", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__); } +#define sLTrace(...) if (sDebugFlag & DEBUG_TRACE) { taosPrintLongString("SYN TRACE ", DEBUG_TRACE, sDebugFlag, __VA_ARGS__); } -#define sNFatal(pNode, ...) if (sDebugFlag & DEBUG_FATAL) { syncPrintNodeLog("SYN FATAL ", DEBUG_FATAL, 255, true, pNode, __VA_ARGS__); } -#define sNError(pNode, ...) if (sDebugFlag & DEBUG_ERROR) { syncPrintNodeLog("SYN ERROR ", DEBUG_ERROR, 255, true, pNode, __VA_ARGS__); } -#define sNWarn(pNode, ...) if (sDebugFlag & DEBUG_WARN) { syncPrintNodeLog("SYN WARN ", DEBUG_WARN, 255, true, pNode, __VA_ARGS__); } -#define sNInfo(pNode, ...) if (sDebugFlag & DEBUG_INFO) { syncPrintNodeLog("SYN ", DEBUG_INFO, 255, true, pNode, __VA_ARGS__); } -#define sNDebug(pNode, ...) if (sDebugFlag & DEBUG_DEBUG) { syncPrintNodeLog("SYN ", DEBUG_DEBUG, sDebugFlag, false, pNode, __VA_ARGS__); } -#define sNTrace(pNode, ...) if (sDebugFlag & DEBUG_TRACE) { syncPrintNodeLog("SYN ", DEBUG_TRACE, sDebugFlag, false, pNode, __VA_ARGS__); } +#define sNFatal(pNode, ...) if (sDebugFlag & DEBUG_FATAL) { syncPrintNodeLog("SYN FATAL ", DEBUG_FATAL, 255, true, pNode, __VA_ARGS__); } +#define sNError(pNode, ...) if (sDebugFlag & DEBUG_ERROR) { syncPrintNodeLog("SYN ERROR ", DEBUG_ERROR, 255, true, pNode, __VA_ARGS__); } +#define sNWarn(pNode, ...) if (sDebugFlag & DEBUG_WARN) { syncPrintNodeLog("SYN WARN ", DEBUG_WARN, 255, true, pNode, __VA_ARGS__); } +#define sNInfo(pNode, ...) if (sDebugFlag & DEBUG_INFO) { syncPrintNodeLog("SYN INFO ", DEBUG_INFO, 255, true, pNode, __VA_ARGS__); } +#define sNDebug(pNode, ...) if (sDebugFlag & DEBUG_DEBUG) { syncPrintNodeLog("SYN DEBUG ", DEBUG_DEBUG, sDebugFlag, false, pNode, __VA_ARGS__); } +#define sNTrace(pNode, ...) if (sDebugFlag & DEBUG_TRACE) { syncPrintNodeLog("SYN TRACE ", DEBUG_TRACE, sDebugFlag, false, pNode, __VA_ARGS__); } #define sSFatal(pSender, ...) if (sDebugFlag & DEBUG_FATAL) { syncPrintSnapshotSenderLog("SYN FATAL ", DEBUG_FATAL, 255, pSender, __VA_ARGS__); } #define sSError(pSender, ...) if (sDebugFlag & DEBUG_ERROR) { syncPrintSnapshotSenderLog("SYN ERROR ", DEBUG_ERROR, 255, pSender, __VA_ARGS__); } -#define sSWarn(pSender, ...) if (sDebugFlag & DEBUG_WARN) { syncPrintSnapshotSenderLog("SYN WARN ", DEBUG_WARN, 255, pSender, __VA_ARGS__); } -#define sSInfo(pSender, ...) if (sDebugFlag & DEBUG_INFO) { syncPrintSnapshotSenderLog("SYN ", DEBUG_INFO, 255, pSender, __VA_ARGS__); } -#define sSDebug(pSender, ...) if (sDebugFlag & DEBUG_DEBUG) { syncPrintSnapshotSenderLog("SYN ", DEBUG_DEBUG, sDebugFlag, pSender, __VA_ARGS__); } -#define sSTrace(pSender, ...) if (sDebugFlag & DEBUG_TRACE) { syncPrintSnapshotSenderLog("SYN ", DEBUG_TRACE, sDebugFlag, pSender, __VA_ARGS__); } +#define sSWarn(pSender, ...) if (sDebugFlag & DEBUG_WARN) { syncPrintSnapshotSenderLog("SYN WARN ", DEBUG_WARN, 255, pSender, __VA_ARGS__); } +#define sSInfo(pSender, ...) if (sDebugFlag & DEBUG_INFO) { syncPrintSnapshotSenderLog("SYN INFO ", DEBUG_INFO, 255, pSender, __VA_ARGS__); } +#define sSDebug(pSender, ...) if (sDebugFlag & DEBUG_DEBUG) { syncPrintSnapshotSenderLog("SYN DEBUG ", DEBUG_DEBUG, sDebugFlag, pSender, __VA_ARGS__); } +#define sSTrace(pSender, ...) if (sDebugFlag & DEBUG_TRACE) { syncPrintSnapshotSenderLog("SYN TRACE ", DEBUG_TRACE, sDebugFlag, pSender, __VA_ARGS__); } #define sRFatal(pReceiver, ...) if (sDebugFlag & DEBUG_FATAL) { syncPrintSnapshotReceiverLog("SYN FATAL ", DEBUG_FATAL, 255, pReceiver, __VA_ARGS__); } #define sRError(pReceiver, ...) if (sDebugFlag & DEBUG_ERROR) { syncPrintSnapshotReceiverLog("SYN ERROR ", DEBUG_ERROR, 255, pReceiver, __VA_ARGS__); } -#define sRWarn(pReceiver, ...) if (sDebugFlag & DEBUG_WARN) { syncPrintSnapshotReceiverLog("SYN WARN ", DEBUG_WARN, 255, pReceiver, __VA_ARGS__); } -#define sRInfo(pReceiver, ...) if (sDebugFlag & DEBUG_INFO) { syncPrintSnapshotReceiverLog("SYN ", DEBUG_INFO, 255, pReceiver, __VA_ARGS__); } -#define sRDebug(pReceiver, ...) if (sDebugFlag & DEBUG_DEBUG) { syncPrintSnapshotReceiverLog("SYN ", DEBUG_DEBUG, sDebugFlag, pReceiver, __VA_ARGS__); } -#define sRTrace(pReceiver, ...) if (sDebugFlag & DEBUG_TRACE) { syncPrintSnapshotReceiverLog("SYN ", DEBUG_TRACE, sDebugFlag, pReceiver, __VA_ARGS__); } +#define sRWarn(pReceiver, ...) if (sDebugFlag & DEBUG_WARN) { syncPrintSnapshotReceiverLog("SYN WARN ", DEBUG_WARN, 255, pReceiver, __VA_ARGS__); } +#define sRInfo(pReceiver, ...) if (sDebugFlag & DEBUG_INFO) { syncPrintSnapshotReceiverLog("SYN INFO ", DEBUG_INFO, 255, pReceiver, __VA_ARGS__); } +#define sRDebug(pReceiver, ...) if (sDebugFlag & DEBUG_DEBUG) { syncPrintSnapshotReceiverLog("SYN DEBUG ", DEBUG_DEBUG, sDebugFlag, pReceiver, __VA_ARGS__); } +#define sRTrace(pReceiver, ...) if (sDebugFlag & DEBUG_TRACE) { syncPrintSnapshotReceiverLog("SYN TRACE ", DEBUG_TRACE, sDebugFlag, pReceiver, __VA_ARGS__); } // clang-format on diff --git a/source/libs/tdb/src/inc/tdbOs.h b/source/libs/tdb/src/inc/tdbOs.h index cd2d4ce57a..c7c282a7d8 100644 --- a/source/libs/tdb/src/inc/tdbOs.h +++ b/source/libs/tdb/src/inc/tdbOs.h @@ -30,12 +30,12 @@ extern "C" { // clang-format off extern int32_t tdbDebugFlag; -#define tdbFatal(...) do { if (tdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TDB FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) -#define tdbError(...) do { if (tdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TDB ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define tdbWarn(...) do { if (tdbDebugFlag & DEBUG_WARN) { taosPrintLog("TDB WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) -#define tdbInfo(...) do { if (tdbDebugFlag & DEBUG_INFO) { taosPrintLog("TDB ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define tdbDebug(...) do { if (tdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TDB ", DEBUG_DEBUG, tdbDebugFlag, __VA_ARGS__); }} while(0) -#define tdbTrace(...) do { if (tdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TDB ", DEBUG_TRACE, tdbDebugFlag, __VA_ARGS__); }} while(0) +#define tdbFatal(...) do { if (tdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TDB FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0) +#define tdbError(...) do { if (tdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TDB ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define tdbWarn(...) do { if (tdbDebugFlag & DEBUG_WARN) { taosPrintLog("TDB WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define tdbInfo(...) do { if (tdbDebugFlag & DEBUG_INFO) { taosPrintLog("TDB INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define tdbDebug(...) do { if (tdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TDB DEBUG ", DEBUG_DEBUG, tdbDebugFlag, __VA_ARGS__); }} while(0) +#define tdbTrace(...) do { if (tdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TDB TRACE ", DEBUG_TRACE, tdbDebugFlag, __VA_ARGS__); }} while(0) // clang-format on // For memory ----------------- diff --git a/source/libs/tfs/inc/tfsInt.h b/source/libs/tfs/inc/tfsInt.h index 9b4b29963e..11ee4bdf43 100644 --- a/source/libs/tfs/inc/tfsInt.h +++ b/source/libs/tfs/inc/tfsInt.h @@ -31,12 +31,12 @@ extern "C" { // For debug purpose // clang-format off -#define fFatal(...) { if (fsDebugFlag & DEBUG_FATAL) { taosPrintLog("TFS FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} -#define fError(...) { if (fsDebugFlag & DEBUG_ERROR) { taosPrintLog("TFS ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} -#define fWarn(...) { if (fsDebugFlag & DEBUG_WARN) { taosPrintLog("TFS WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} -#define fInfo(...) { if (fsDebugFlag & DEBUG_INFO) { taosPrintLog("TFS ", DEBUG_INFO, 255, __VA_ARGS__); }} -#define fDebug(...) { if (fsDebugFlag & DEBUG_DEBUG) { taosPrintLog("TFS ", DEBUG_DEBUG, fsDebugFlag, __VA_ARGS__); }} -#define fTrace(...) { if (fsDebugFlag & DEBUG_TRACE) { taosPrintLog("TFS ", DEBUG_TRACE, fsDebugFlag, __VA_ARGS__); }} +#define fFatal(...) { if (fsDebugFlag & DEBUG_FATAL) { taosPrintLog("TFS FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} +#define fError(...) { if (fsDebugFlag & DEBUG_ERROR) { taosPrintLog("TFS ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} +#define fWarn(...) { if (fsDebugFlag & DEBUG_WARN) { taosPrintLog("TFS WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define fInfo(...) { if (fsDebugFlag & DEBUG_INFO) { taosPrintLog("TFS INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define fDebug(...) { if (fsDebugFlag & DEBUG_DEBUG) { taosPrintLog("TFS DEBUG ", DEBUG_DEBUG, fsDebugFlag, __VA_ARGS__); }} +#define fTrace(...) { if (fsDebugFlag & DEBUG_TRACE) { taosPrintLog("TFS TRACE ", DEBUG_TRACE, fsDebugFlag, __VA_ARGS__); }} // clang-format on typedef struct { diff --git a/source/libs/transport/inc/transLog.h b/source/libs/transport/inc/transLog.h index ec71bbefae..8b8cc3ae72 100644 --- a/source/libs/transport/inc/transLog.h +++ b/source/libs/transport/inc/transLog.h @@ -26,10 +26,10 @@ extern "C" { #define tFatal(...) { if (rpcDebugFlag & DEBUG_FATAL) { taosPrintLog("RPC FATAL ", DEBUG_FATAL, rpcDebugFlag, __VA_ARGS__); }} #define tError(...) { if (rpcDebugFlag & DEBUG_ERROR ){ taosPrintLog("RPC ERROR ", DEBUG_ERROR, rpcDebugFlag, __VA_ARGS__); }} -#define tWarn(...) { if (rpcDebugFlag & DEBUG_WARN) { taosPrintLog("RPC WARN ", DEBUG_WARN, rpcDebugFlag, __VA_ARGS__); }} -#define tInfo(...) { if (rpcDebugFlag & DEBUG_INFO) { taosPrintLog("RPC ", DEBUG_INFO, rpcDebugFlag, __VA_ARGS__); }} -#define tDebug(...) { if (rpcDebugFlag & DEBUG_DEBUG) { taosPrintLog("RPC ", DEBUG_DEBUG, rpcDebugFlag, __VA_ARGS__); }} -#define tTrace(...) { if (rpcDebugFlag & DEBUG_TRACE) { taosPrintLog("RPC ", DEBUG_TRACE, rpcDebugFlag, __VA_ARGS__); }} +#define tWarn(...) { if (rpcDebugFlag & DEBUG_WARN) { taosPrintLog("RPC WARN ", DEBUG_WARN, rpcDebugFlag, __VA_ARGS__); }} +#define tInfo(...) { if (rpcDebugFlag & DEBUG_INFO) { taosPrintLog("RPC INFO ", DEBUG_INFO, rpcDebugFlag, __VA_ARGS__); }} +#define tDebug(...) { if (rpcDebugFlag & DEBUG_DEBUG) { taosPrintLog("RPC DEBUG ", DEBUG_DEBUG, rpcDebugFlag, __VA_ARGS__); }} +#define tTrace(...) { if (rpcDebugFlag & DEBUG_TRACE) { taosPrintLog("RPC TRACE ", DEBUG_TRACE, rpcDebugFlag, __VA_ARGS__); }} #define tDump(x, y) { if (rpcDebugFlag & DEBUG_DUMP) { taosDumpData((unsigned char *)x, y); } } #define tGTrace(param, ...) do { if (rpcDebugFlag & DEBUG_TRACE){char buf[40] = {0}; TRACE_TO_STR(trace, buf); tTrace(param ",QID:%s", __VA_ARGS__, buf);}} while(0) diff --git a/source/libs/wal/inc/walInt.h b/source/libs/wal/inc/walInt.h index 3bc69a6393..304cb52870 100644 --- a/source/libs/wal/inc/walInt.h +++ b/source/libs/wal/inc/walInt.h @@ -30,10 +30,10 @@ extern "C" { // clang-format off #define wFatal(...) { if (wDebugFlag & DEBUG_FATAL) { taosPrintLog("WAL FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} #define wError(...) { if (wDebugFlag & DEBUG_ERROR) { taosPrintLog("WAL ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} -#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} -#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL ", DEBUG_INFO, 255, __VA_ARGS__); }} -#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL ", DEBUG_DEBUG, wDebugFlag, __VA_ARGS__); }} -#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); }} +#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL DEBUG ", DEBUG_DEBUG, wDebugFlag, __VA_ARGS__); }} +#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL TRACE ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); }} // clang-format on // meta section begin diff --git a/source/util/src/ttimer.c b/source/util/src/ttimer.c index ec300c5206..a6527ccbec 100644 --- a/source/util/src/ttimer.c +++ b/source/util/src/ttimer.c @@ -20,42 +20,14 @@ #include "tlog.h" #include "tsched.h" -#define tmrFatal(...) \ - { \ - if (tmrDebugFlag & DEBUG_FATAL) { \ - taosPrintLog("TMR FATAL ", DEBUG_FATAL, tmrDebugFlag, __VA_ARGS__); \ - } \ - } -#define tmrError(...) \ - { \ - if (tmrDebugFlag & DEBUG_ERROR) { \ - taosPrintLog("TMR ERROR ", DEBUG_ERROR, tmrDebugFlag, __VA_ARGS__); \ - } \ - } -#define tmrWarn(...) \ - { \ - if (tmrDebugFlag & DEBUG_WARN) { \ - taosPrintLog("TMR WARN ", DEBUG_WARN, tmrDebugFlag, __VA_ARGS__); \ - } \ - } -#define tmrInfo(...) \ - { \ - if (tmrDebugFlag & DEBUG_INFO) { \ - taosPrintLog("TMR ", DEBUG_INFO, tmrDebugFlag, __VA_ARGS__); \ - } \ - } -#define tmrDebug(...) \ - { \ - if (tmrDebugFlag & DEBUG_DEBUG) { \ - taosPrintLog("TMR ", DEBUG_DEBUG, tmrDebugFlag, __VA_ARGS__); \ - } \ - } -#define tmrTrace(...) \ - { \ - if (tmrDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("TMR ", DEBUG_TRACE, tmrDebugFlag, __VA_ARGS__); \ - } \ - } +// clang-format off +#define tmrFatal(...) { if (tmrDebugFlag & DEBUG_FATAL) { taosPrintLog("TMR FATAL ", DEBUG_FATAL, tmrDebugFlag, __VA_ARGS__); }} +#define tmrError(...) { if (tmrDebugFlag & DEBUG_ERROR) { taosPrintLog("TMR ERROR ", DEBUG_ERROR, tmrDebugFlag, __VA_ARGS__); }} +#define tmrWarn(...) { if (tmrDebugFlag & DEBUG_WARN) { taosPrintLog("TMR WARN ", DEBUG_WARN, tmrDebugFlag, __VA_ARGS__); }} +#define tmrInfo(...) { if (tmrDebugFlag & DEBUG_INFO) { taosPrintLog("TMR INFO ", DEBUG_INFO, tmrDebugFlag, __VA_ARGS__); }} +#define tmrDebug(...) { if (tmrDebugFlag & DEBUG_DEBUG) { taosPrintLog("TMR DEBUG ", DEBUG_DEBUG, tmrDebugFlag, __VA_ARGS__); }} +#define tmrTrace(...) { if (tmrDebugFlag & DEBUG_TRACE) { taosPrintLog("TMR TRACE ", DEBUG_TRACE, tmrDebugFlag, __VA_ARGS__); }} +// clang-format on #define TIMER_STATE_WAITING 0 #define TIMER_STATE_EXPIRED 1 diff --git a/utils/tsim/inc/simInt.h b/utils/tsim/inc/simInt.h index 0ad0bfdea8..c2a032ab68 100644 --- a/utils/tsim/inc/simInt.h +++ b/utils/tsim/inc/simInt.h @@ -59,42 +59,14 @@ extern "C" { #define FAILED_POSTFIX "" #endif -#define simFatal(...) \ - { \ - if (simDebugFlag & DEBUG_FATAL) { \ - taosPrintLog("SIM FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \ - } \ - } -#define simError(...) \ - { \ - if (simDebugFlag & DEBUG_ERROR) { \ - taosPrintLog("SIM ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \ - } \ - } -#define simWarn(...) \ - { \ - if (simDebugFlag & DEBUG_WARN) { \ - taosPrintLog("SIM WARN ", DEBUG_WARN, 255, __VA_ARGS__); \ - } \ - } -#define simInfo(...) \ - { \ - if (simDebugFlag & DEBUG_INFO) { \ - taosPrintLog("SIM ", DEBUG_INFO, 255, __VA_ARGS__); \ - } \ - } -#define simDebug(...) \ - { \ - if (simDebugFlag & DEBUG_DEBUG) { \ - taosPrintLog("SIM ", DEBUG_DEBUG, simDebugFlag, __VA_ARGS__); \ - } \ - } -#define simTrace(...) \ - { \ - if (simDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("SIM ", DEBUG_TRACE, simDebugFlag, __VA_ARGS__); \ - } \ - } +// clang-format off +#define simFatal(...) { if (simDebugFlag & DEBUG_FATAL) { taosPrintLog("SIM FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} +#define simError(...) { if (simDebugFlag & DEBUG_ERROR) { taosPrintLog("SIM ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} +#define simWarn(...) { if (simDebugFlag & DEBUG_WARN) { taosPrintLog("SIM WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} +#define simInfo(...) { if (simDebugFlag & DEBUG_INFO) { taosPrintLog("SIM INFO ", DEBUG_INFO, 255, __VA_ARGS__); }} +#define simDebug(...) { if (simDebugFlag & DEBUG_DEBUG) { taosPrintLog("SIM DEBUG ", DEBUG_DEBUG, simDebugFlag, __VA_ARGS__); }} +#define simTrace(...) { if (simDebugFlag & DEBUG_TRACE) { taosPrintLog("SIM TRACE ", DEBUG_TRACE, simDebugFlag, __VA_ARGS__); }} +// clang-format on enum { SIM_SCRIPT_TYPE_MAIN, SIM_SCRIPT_TYPE_BACKGROUND }; From 764145cead5c7c7d696a74215cea7669abc846f9 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 11:34:50 +0800 Subject: [PATCH 09/22] enh: adjust some logs --- source/libs/catalog/src/catalog.c | 2 +- source/libs/catalog/src/ctgCache.c | 28 ++++++++++++------------ source/libs/catalog/src/ctgRemote.c | 34 ++++++++++++++--------------- source/libs/catalog/src/ctgRent.c | 2 +- source/libs/catalog/src/ctgUtil.c | 12 +++++----- source/libs/qcom/src/querymsg.c | 2 +- source/libs/qworker/src/qworker.c | 4 ++-- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 0355babbf0..27c008278f 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -1001,7 +1001,7 @@ int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* vers ctgReleaseVgInfoToCache(pCtg, dbCache); - ctgDebug("Got db vgVersion from cache, dbFName:%s, vgVersion:%d", dbFName, *version); + ctgDebug("get db vgVersion from cache, dbFName:%s, vgVersion:%d", dbFName, *version); CTG_API_LEAVE(TSDB_CODE_SUCCESS); diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index c05f4704aa..761ec82dbf 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -244,7 +244,7 @@ int32_t ctgAcquireVgInfoFromCache(SCatalog *pCtg, const char *dbFName, SCtgDBCac CTG_CACHE_HIT_INC(CTG_CI_DB_VGROUP, 1); - ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName); + ctgDebug("get db vgInfo from cache, dbFName:%s", dbFName); return TSDB_CODE_SUCCESS; @@ -327,7 +327,7 @@ int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const cha CTG_CACHE_HIT_INC(CTG_CI_DB_VGROUP, 1); - ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName); + ctgDebug("get db vgInfo from cache, dbFName:%s", dbFName); tbCache = taosHashAcquire(dbCache->tbCache, tbName, strlen(tbName)); if (NULL == tbCache) { @@ -557,7 +557,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt (*pTableMeta)->schemaExt = NULL; } - ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", ctx->pName->tname, tbMeta->tableType, dbFName); + ctgDebug("get tb %s meta from cache, type:%d, dbFName:%s", ctx->pName->tname, tbMeta->tableType, dbFName); return TSDB_CODE_SUCCESS; } @@ -577,7 +577,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt taosHashRelease(dbCache->tbCache, tbCache); *pTb = NULL; - ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", ctx->pName->tname, + ctgDebug("get ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", ctx->pName->tname, ctx->tbInfo.tbType, dbFName); CTG_ERR_RET(ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, ctx->tbInfo.suid, &tbCache)); @@ -632,7 +632,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta ** ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgDebug("Got tb %s meta from cache, dbFName:%s", ctx->pName->tname, dbFName); + ctgDebug("get tb %s meta from cache, dbFName:%s", ctx->pName->tname, dbFName); return TSDB_CODE_SUCCESS; @@ -669,7 +669,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, *sver = tbMeta->sversion; *tver = tbMeta->tversion; - ctgDebug("Got tb %s ver from cache, dbFName:%s, tbType:%d, sver:%d, tver:%d, suid:0x%" PRIx64, pTableName->tname, + ctgDebug("get tb %s ver from cache, dbFName:%s, tbType:%d, sver:%d, tver:%d, suid:0x%" PRIx64, pTableName->tname, dbFName, *tbType, *sver, *tver, *suid); ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); @@ -684,7 +684,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, taosHashRelease(dbCache->tbCache, tbCache); } - ctgDebug("Got ctb %s ver from cache, will continue to get its stb ver, dbFName:%s", pTableName->tname, dbFName); + ctgDebug("get ctb %s ver from cache, will continue to get its stb ver, dbFName:%s", pTableName->tname, dbFName); CTG_ERR_RET(ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, *suid, &tbCache)); if (NULL == tbCache) { @@ -711,7 +711,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgDebug("Got tb %s sver %d tver %d from cache, type:%d, dbFName:%s", pTableName->tname, *sver, *tver, *tbType, + ctgDebug("get tb %s sver %d tver %d from cache, type:%d, dbFName:%s", pTableName->tname, *sver, *tver, *tbType, dbFName); return TSDB_CODE_SUCCESS; @@ -729,7 +729,7 @@ int32_t ctgReadTbTypeFromCache(SCatalog *pCtg, char *dbFName, char *tbName, int3 *tbType = tbCache->pMeta->tableType; ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgDebug("Got tb %s tbType %d from cache, dbFName:%s", tbName, *tbType, dbFName); + ctgDebug("get tb %s tbType %d from cache, dbFName:%s", tbName, *tbType, dbFName); return TSDB_CODE_SUCCESS; } @@ -835,7 +835,7 @@ int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool tbNotExist *inCache = true; - ctgDebug("Got user from cache, user:%s", pReq->user); + ctgDebug("get user from cache, user:%s", pReq->user); CTG_CACHE_HIT_INC(CTG_CI_USER, 1); SCtgAuthReq req = {0}; @@ -3517,7 +3517,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_UNLOCK(CTG_READ, &pCache->metaLock); taosHashRelease(dbCache->tbCache, pCache); - ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); + ctgDebug("get tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); res.pRes = pTableMeta; if (NULL == taosArrayPush(ctx->pResList, &res)) { @@ -3542,7 +3542,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_UNLOCK(CTG_READ, &pCache->metaLock); taosHashRelease(dbCache->tbCache, pCache); - ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); + ctgDebug("get tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); res.pRes = pTableMeta; if (NULL == taosArrayPush(ctx->pResList, &res)) { @@ -3564,7 +3564,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_UNLOCK(CTG_READ, &pCache->metaLock); taosHashRelease(dbCache->tbCache, pCache); - ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", pName->tname, + ctgDebug("get ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", pName->tname, nctx.tbInfo.tbType, dbFName); char *stName = taosHashAcquire(dbCache->stbCache, &pTableMeta->suid, sizeof(pTableMeta->suid)); @@ -3877,7 +3877,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC CTG_UNLOCK(CTG_READ, &pCache->viewLock); taosHashRelease(dbCache->viewCache, pCache); - ctgDebug("Got view %s meta from cache, dbFName:%s", pName->tname, dbFName); + ctgDebug("get view %s meta from cache, dbFName:%s", pName->tname, dbFName); res.pRes = pViewMeta; if (NULL == taosArrayPush(ctx->pResList, &res)) { diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index ec93b7dee2..98f60ec12c 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -148,7 +148,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got qnode list from mnode, listNum:%d", (int32_t)taosArrayGetSize(out)); + qDebug("get qnode list from mnode, listNum:%d", (int32_t)taosArrayGetSize(out)); break; } case TDMT_MND_DNODE_LIST: { @@ -163,7 +163,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got dnode list from mnode, listNum:%d", (int32_t)taosArrayGetSize(*(SArray**)out)); + qDebug("get dnode list from mnode, listNum:%d", (int32_t)taosArrayGetSize(*(SArray**)out)); break; } case TDMT_MND_USE_DB: { @@ -178,7 +178,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got db vgInfo from mnode, dbFName:%s", target); + qDebug("get db vgInfo from mnode, dbFName:%s", target); break; } case TDMT_MND_GET_DB_CFG: { @@ -193,7 +193,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got db cfg from mnode, dbFName:%s", target); + qDebug("get db cfg from mnode, dbFName:%s", target); break; } case TDMT_MND_GET_INDEX: { @@ -208,7 +208,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got index from mnode, indexName:%s", target); + qDebug("get index from mnode, indexName:%s", target); break; } case TDMT_MND_GET_TABLE_INDEX: { @@ -223,7 +223,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got table index from mnode, tbFName:%s", target); + qDebug("get table index from mnode, tbFName:%s", target); break; } case TDMT_MND_RETRIEVE_FUNC: { @@ -238,7 +238,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got udf from mnode, funcName:%s", target); + qDebug("get udf from mnode, funcName:%s", target); break; } case TDMT_MND_GET_USER_AUTH: { @@ -253,7 +253,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got user auth from mnode, user:%s", target); + qDebug("get user auth from mnode, user:%s", target); break; } case TDMT_MND_TABLE_META: { @@ -274,7 +274,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got table meta from mnode, tbFName:%s", target); + qDebug("get table meta from mnode, tbFName:%s", target); break; } case TDMT_VND_TABLE_META: { @@ -295,7 +295,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got table meta from vnode, tbFName:%s", target); + qDebug("get table meta from vnode, tbFName:%s", target); break; } case TDMT_VND_TABLE_NAME: { @@ -316,7 +316,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got table meta from vnode, tbFName:%s", target); + qDebug("get table meta from vnode, tbFName:%s", target); break; } case TDMT_VND_TABLE_CFG: { @@ -331,7 +331,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got table cfg from vnode, tbFName:%s", target); + qDebug("get table cfg from vnode, tbFName:%s", target); break; } case TDMT_MND_TABLE_CFG: { @@ -346,7 +346,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got stb cfg from mnode, tbFName:%s", target); + qDebug("get stb cfg from mnode, tbFName:%s", target); break; } case TDMT_MND_SERVER_VERSION: { @@ -361,7 +361,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got svr ver from mnode"); + qDebug("get svr ver from mnode"); break; } case TDMT_MND_VIEW_META: { @@ -380,7 +380,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got view-meta from mnode, viewFName:%s", target); + qDebug("get view-meta from mnode, viewFName:%s", target); break; } case TDMT_MND_GET_TSMA: @@ -398,7 +398,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, CTG_ERR_RET(code); } - qDebug("Got table tsma from mnode, tbFName:%s", target); + qDebug("get table tsma from mnode, tbFName:%s", target); break; } case TDMT_VND_GET_STREAM_PROGRESS: { @@ -414,7 +414,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, } default: if (TSDB_CODE_SUCCESS != rspCode) { - qError("Got error rsp, error:%s", tstrerror(rspCode)); + qError("get error rsp, error:%s", tstrerror(rspCode)); CTG_ERR_RET(rspCode); } diff --git a/source/libs/catalog/src/ctgRent.c b/source/libs/catalog/src/ctgRent.c index 7dff496eb0..bb077f2c84 100755 --- a/source/libs/catalog/src/ctgRent.c +++ b/source/libs/catalog/src/ctgRent.c @@ -194,7 +194,7 @@ int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_ *num = (uint32_t)metaNum; - qDebug("Got %d meta from rent, type:%d", (int32_t)metaNum, mgmt->type); + qDebug("get %d meta from rent, type:%d", (int32_t)metaNum, mgmt->type); _return: diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 0ade1be0d6..c96fef5798 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -1196,7 +1196,7 @@ int32_t ctgGenerateVgList(SCatalog* pCtg, SHashObj* vgHash, SArray** pList, cons *pList = vgList; - ctgDebug("Got vgList from cache, vgNum:%d", vgNum); + ctgDebug("get vgList from cache, vgNum:%d", vgNum); return TSDB_CODE_SUCCESS; @@ -1293,7 +1293,7 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SEpSet* pMgmtEps, SDBVgInfo* d *pVgroup = *vgInfo; - ctgDebug("Got tb %s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, + ctgDebug("get tb %s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, vgInfo->epSet.numOfEps, vgInfo->epSet.eps[vgInfo->epSet.inUse].fqdn, vgInfo->epSet.eps[vgInfo->epSet.inUse].port); @@ -1327,7 +1327,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR TAOS_MEMCPY(vgInfo, &mgmtInfo, sizeof(mgmtInfo)); - ctgDebug("Got tb hash vgroup, vgId:%d, epNum %d, current %s port %d", vgInfo->vgId, vgInfo->epSet.numOfEps, + ctgDebug("get tb hash vgroup, vgId:%d, epNum %d, current %s port %d", vgInfo->vgId, vgInfo->epSet.numOfEps, vgInfo->epSet.eps[vgInfo->epSet.inUse].fqdn, vgInfo->epSet.eps[vgInfo->epSet.inUse].port); if (update) { @@ -1376,7 +1376,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR TAOS_MEMCPY(vgInfo, pSrcVg, sizeof(*pSrcVg)); - ctgDebug("Got tb hash vgroup, vgId:%d, epNum %d, current %s port %d", vgInfo->vgId, vgInfo->epSet.numOfEps, + ctgDebug("get tb hash vgroup, vgId:%d, epNum %d, current %s port %d", vgInfo->vgId, vgInfo->epSet.numOfEps, vgInfo->epSet.eps[vgInfo->epSet.inUse].fqdn, vgInfo->epSet.eps[vgInfo->epSet.inUse].port); if (update) { @@ -1437,7 +1437,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR *pNewVg = *vgInfo; - ctgDebug("Got tb %s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, + ctgDebug("get tb %s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, vgInfo->epSet.numOfEps, vgInfo->epSet.eps[vgInfo->epSet.inUse].fqdn, vgInfo->epSet.eps[vgInfo->epSet.inUse].port); @@ -1496,7 +1496,7 @@ int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFNam vgId[i] = vgInfo->vgId; - ctgDebug("Got tb %s vgId:%d", tbFullName, vgInfo->vgId); + ctgDebug("get tb %s vgId:%d", tbFullName, vgInfo->vgId); } CTG_RET(code); diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index 0ee61726e3..268e4b8259 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -45,7 +45,7 @@ int32_t queryBuildUseDbOutput(SUseDbOutput *pOut, SUseDbRsp *usedbRsp) { pOut->dbVgroup->hashSuffix = usedbRsp->hashSuffix; pOut->dbVgroup->stateTs = usedbRsp->stateTs; - qDebug("Got %d vgroup for db %s, vgVersion:%d, stateTs:%" PRId64, usedbRsp->vgNum, usedbRsp->db, usedbRsp->vgVersion, + qDebug("get %d vgroup for db %s, vgVersion:%d, stateTs:%" PRId64, usedbRsp->vgNum, usedbRsp->db, usedbRsp->vgVersion, usedbRsp->stateTs); if (usedbRsp->vgNum <= 0) { diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 1df8dcda95..2b66db772a 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -339,8 +339,8 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, break; } - // Got data from sink - QW_TASK_DLOG("there are data in sink, dataLength:%" PRId64 "", len); + // get data from sink + QW_TASK_DLOG("there are data in sink, dataLength:%" PRId64, len); *dataLen += len + PAYLOAD_PREFIX_LEN; *pRawDataLen += rawLen + PAYLOAD_PREFIX_LEN; From e97b5cf4c1c26bc0f5ccf5474a9c3664b37cfe3c Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 14:26:40 +0800 Subject: [PATCH 10/22] enh: adjust log format --- source/client/src/clientEnv.c | 6 ++-- source/client/src/clientImpl.c | 42 +++++++++++----------- source/client/src/clientMain.c | 18 +++++----- source/client/src/clientRawBlockWrite.c | 2 +- source/client/src/clientTmq.c | 14 ++++---- source/dnode/mgmt/node_util/inc/dmUtil.h | 12 +++---- source/dnode/mnode/impl/inc/mndInt.h | 12 +++---- source/dnode/vnode/src/inc/vnd.h | 12 +++---- source/dnode/vnode/src/tq/tq.c | 6 ++-- source/dnode/vnode/src/tq/tqRead.c | 4 +-- source/dnode/vnode/src/tq/tqUtil.c | 4 +-- source/dnode/vnode/src/tqCommon/tqCommon.c | 2 +- source/libs/catalog/src/catalog.c | 2 +- source/libs/catalog/src/ctgAsync.c | 2 +- source/libs/catalog/src/ctgCache.c | 22 ++++++------ source/libs/catalog/src/ctgRemote.c | 2 +- source/libs/catalog/src/ctgUtil.c | 6 ++-- source/libs/nodes/inc/nodesUtil.h | 12 +++---- source/libs/parser/inc/parUtil.h | 12 +++---- source/libs/parser/src/parInsertSql.c | 4 +-- source/libs/qworker/inc/qwInt.h | 20 +++++------ source/libs/qworker/src/qwDbg.c | 2 +- source/libs/scheduler/inc/schInt.h | 14 ++++---- source/libs/scheduler/src/schJob.c | 2 +- source/libs/scheduler/src/schRemote.c | 4 +-- source/libs/scheduler/src/schTask.c | 8 ++--- source/libs/stream/src/streamCheckStatus.c | 2 +- source/libs/stream/src/streamDispatch.c | 2 +- source/libs/transport/inc/transLog.h | 12 +++---- source/libs/transport/src/transCli.c | 4 +-- 30 files changed, 133 insertions(+), 133 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 11bdb16eca..29d8e2614f 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -94,7 +94,7 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) { int32_t total = atomic_add_fetch_64((int64_t *)&pSummary->totalRequests, 1); int32_t currentInst = atomic_add_fetch_64((int64_t *)&pSummary->currentRequests, 1); tscDebug("0x%" PRIx64 " new Request from connObj:0x%" PRIx64 - ", current:%d, app current:%d, total:%d,QID:0x%" PRIx64, + ", current:%d, app current:%d, total:%d, QID:0x%" PRIx64, pRequest->self, pRequest->pTscObj->id, num, currentInst, total, pRequest->requestId); } @@ -255,7 +255,7 @@ static void deregisterRequest(SRequestObj *pRequest) { int32_t reqType = SLOW_LOG_TYPE_OTHERS; int64_t duration = taosGetTimestampUs() - pRequest->metric.start; - tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ",QID:0x%" PRIx64 + tscDebug("0x%" PRIx64 " free Request from connObj:0x%" PRIx64 ", QID:0x%" PRIx64 " elapsed:%.2f ms, " "current:%d, app current:%d", pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst); @@ -299,7 +299,7 @@ static void deregisterRequest(SRequestObj *pRequest) { checkSlowLogExceptDb(pRequest, pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogExceptDb)) { (void)atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1); if (pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogScope & reqType) { - taosPrintSlowLog("PID:%d, Conn:%u,QID:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s", + taosPrintSlowLog("PID:%d, Conn:%u, QID:0x%" PRIx64 ", Start:%" PRId64 "us, Duration:%" PRId64 "us, SQL:%s", taosGetPId(), pTscObj->connId, pRequest->requestId, pRequest->metric.start, duration, pRequest->sqlstr); if (pTscObj->pAppInfo->serverCfg.monitorParas.tsEnableMonitor) { diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c2a199e9c1..338290433e 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -245,7 +245,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, int32_t err = taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self, sizeof((*pRequest)->self)); if (err) { - tscError("%" PRId64 " failed to add to request container,QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", + tscError("%" PRId64 " failed to add to request container, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; @@ -256,7 +256,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) { if (TSDB_CODE_SUCCESS != nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) { - tscError("%" PRId64 " failed to create node allocator,QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, + tscError("%" PRId64 " failed to create node allocator, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; @@ -264,7 +264,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, } } - tscDebugL("0x%" PRIx64 " SQL: %s,QID:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); + tscDebugL("0x%" PRIx64 " SQL:%s, QID:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); return TSDB_CODE_SUCCESS; } @@ -381,10 +381,10 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; - tscError("0x%" PRIx64 " fetch results failed, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("0x%" PRIx64 " fetch results failed, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); } else { - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64, + tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed, pRequest->requestId); } @@ -1030,7 +1030,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { break; } default: - tscError("0x%" PRIx64 ", invalid exec result for request type %d,QID:0x%" PRIx64, pRequest->self, pRequest->type, + tscError("0x%" PRIx64 ", invalid exec result for request type %d, QID:0x%" PRIx64, pRequest->self, pRequest->type, pRequest->requestId); code = TSDB_CODE_APP_ERROR; } @@ -1075,7 +1075,7 @@ void returnToUser(SRequestObj* pRequest) { (void)releaseRequest(pRequest->relation.userRefId); return; } else { - tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, pRequest->relation.userRefId, pRequest->requestId); } } @@ -1146,7 +1146,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { SSDataBlock* pBlock = NULL; pRequest->code = createResultBlock(res, rowNum, &pBlock); if (TSDB_CODE_SUCCESS != pRequest->code) { - tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId, + tscError("0x%" PRIx64 ", create result block failed, QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId, tstrerror(pRequest->code)); returnToUser(pRequest); return; @@ -1157,7 +1157,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { continuePostSubQuery(pNextReq, pBlock); (void)releaseRequest(pRequest->relation.nextRefId); } else { - tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, pRequest->relation.nextRefId, pRequest->requestId); } @@ -1176,7 +1176,7 @@ void handlePostSubQuery(SSqlCallbackWrapper* pWrapper) { continuePostSubQuery(pNextReq, NULL); (void)releaseRequest(pRequest->relation.nextRefId); } else { - tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, pRequest->relation.nextRefId, pRequest->requestId); } } @@ -1208,14 +1208,14 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { } taosMemoryFree(pResult); - tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(code), + tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d,QID:0x%" PRIx64, pRequest->self, + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->retry, pRequest->requestId); if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) { - tscError("0x%" PRIx64 " remove meta failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId); + tscError("0x%" PRIx64 " remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); } restartAsyncQuery(pRequest, code); return; @@ -1224,7 +1224,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { tscDebug("schedulerExecCb request type %s", TMSG_INFO(pRequest->type)); if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) { if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) { - tscError("0x%" PRIx64 " remove meta failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId); + tscError("0x%" PRIx64 " remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); } } @@ -1322,7 +1322,7 @@ void launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) { int ret = removeMeta(pRequest->pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type)); if (TSDB_CODE_SUCCESS != ret) { - tscError("0x%" PRIx64 " remove meta failed,code:%d,QID:0x%" PRIx64, pRequest->self, ret, pRequest->requestId); + tscError("0x%" PRIx64 " remove meta failed,code:%d, QID:0x%" PRIx64, pRequest->self, ret, pRequest->requestId); } } @@ -1659,7 +1659,7 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta *pTscObj = NULL; return terrno; } else { - tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p,QID:0x%" PRIx64, (*pTscObj)->id, + tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, QID:0x%" PRIx64, (*pTscObj)->id, (*pTscObj)->connId, (*pTscObj)->pAppInfo->pTransporter, pRequest->requestId); destroyRequest(pRequest); } @@ -1789,7 +1789,7 @@ int32_t doProcessMsgFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) { char tbuf[40] = {0}; TRACE_TO_STR(trace, tbuf); - tscDebug("processMsgFromServer handle %p, message: %s, size:%d, code: %s,QID:%s", pMsg->info.handle, + tscDebug("processMsgFromServer handle %p, message: %s, size:%d, code: %s, QID:%s", pMsg->info.handle, TMSG_INFO(pMsg->msgType), pMsg->contLen, tstrerror(pMsg->code), tbuf); if (pSendInfo->requestObjRefId != 0) { @@ -2000,7 +2000,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) return NULL; } - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64, + tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId); STscObj* pTscObj = pRequest->pTscObj; @@ -3024,7 +3024,7 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { SReqResultInfo* pResultInfo = &pRequest->body.resInfo; - tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), + tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); pResultInfo->pData = pResult; @@ -3047,10 +3047,10 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4); if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; - tscError("0x%" PRIx64 " fetch results failed, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code), + tscError("0x%" PRIx64 " fetch results failed, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code), pRequest->requestId); } else { - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64, + tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed, pRequest->requestId); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 184f73c664..cf253a24ca 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -1157,7 +1157,7 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t SRequestObj *pRequest = pWrapper->pRequest; SQuery *pQuery = pRequest->pQuery; - qDebug("0x%" PRIx64 " start to semantic analysis,QID:0x%" PRIx64, pRequest->self, pRequest->requestId); + qDebug("0x%" PRIx64 " start to semantic analysis, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); int64_t analyseStart = taosGetTimestampUs(); pRequest->metric.ctgCostUs = analyseStart - pRequest->metric.ctgStart; @@ -1276,14 +1276,14 @@ void handleQueryAnslyseRes(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta pRequest->pQuery = NULL; if (NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64, + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); restartAsyncQuery(pRequest, code); return; } // return to app directly - tscError("0x%" PRIx64 " error occurs, code:%s, return to user app,QID:0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("0x%" PRIx64 " error occurs, code:%s, return to user app, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); pRequest->code = code; returnToUser(pRequest); @@ -1333,7 +1333,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c SQuery *pQuery = pRequest->pQuery; pRequest->metric.ctgCostUs += taosGetTimestampUs() - pRequest->metric.ctgStart; - qDebug("0x%" PRIx64 " start to continue parse,QID:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId, + qDebug("0x%" PRIx64 " start to continue parse, QID:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId, tstrerror(code)); if (code == TSDB_CODE_SUCCESS) { @@ -1346,7 +1346,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pWrapper->pRequest->self, code, + tscError("0x%" PRIx64 " error happens, code:%d - %s, QID:0x%" PRIx64, pWrapper->pRequest->self, code, tstrerror(code), pWrapper->pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1363,7 +1363,7 @@ void continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest) } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pWrapper->pRequest->self, code, + tscError("0x%" PRIx64 " error happens, code:%d - %s, QID:0x%" PRIx64, pWrapper->pRequest->self, code, tstrerror(code), pWrapper->pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1484,7 +1484,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), + tscError("0x%" PRIx64 " error happens, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1492,11 +1492,11 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { pRequest->pQuery = NULL; if (NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64, + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); code = refreshMeta(pRequest->pTscObj, pRequest); if (code != 0) { - tscWarn("0x%" PRIx64 " refresh meta failed, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), + tscWarn("0x%" PRIx64 " refresh meta failed, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); } pRequest->prevCode = code; diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index cf40e109e7..b43507c2a6 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -47,7 +47,7 @@ } \ } while (0) -#define LOG_ID_TAG "connId:0x%" PRIx64 ",QID:0x%" PRIx64 +#define LOG_ID_TAG "connId:0x%" PRIx64 ", QID:0x%" PRIx64 #define LOG_ID_VALUE *(int64_t*)taos, pRequest->requestId #define TMQ_META_VERSION "1.0" diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index a11f351a1e..5052681279 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1474,7 +1474,7 @@ static int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { pParam = NULL; SEpSet epSet = getEpSet_s(&pTmq->pTscObj->pAppInfo->mgmtEp); - tqDebugC("consumer:0x%" PRIx64 " ask ep from mnode,QID:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId); + tqDebugC("consumer:0x%" PRIx64 " ask ep from mnode, QID:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId); code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); END: @@ -2102,7 +2102,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { goto END; } rspType = ((SMqRspHead*)pMsg->pData)->mqMsgType; - tqDebugC("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, type %d(%s),QID:0x%" PRIx64, tmq->consumerId, vgId, rspType, tmqMsgTypeStr[rspType], requestId); + tqDebugC("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, type %d(%s), QID:0x%" PRIx64, tmq->consumerId, vgId, rspType, tmqMsgTypeStr[rspType], requestId); pRspWrapper->tmqRspType = rspType; pRspWrapper->pollRsp.reqId = requestId; @@ -2123,7 +2123,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { taosFreeQitem(pRspWrapper); tqErrorC("consumer:0x%" PRIx64 " put poll res into mqueue failed, code:%d", tmq->consumerId, code); } else { - tqDebugC("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d(%s), vgId:%d, total in queue:%d,QID:0x%" PRIx64, + tqDebugC("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d(%s), vgId:%d, total in queue:%d, QID:0x%" PRIx64, tmq ? tmq->consumerId : 0, rspType, tmqMsgTypeStr[rspType], vgId, taosQueueItemSize(tmq->mqueue), requestId); } } @@ -2297,7 +2297,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->offsetInfo.endOffset); code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, NULL, sendInfo); - tqDebugC("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s,QID:0x%" PRIx64, pTmq->consumerId, + tqDebugC("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s, QID:0x%" PRIx64, pTmq->consumerId, pTopic->topicName, pVg->vgId, code, pTmq->epoch, offsetFormatBuf, req.reqId); TSDB_CHECK_CODE(code, lino, END); @@ -2523,7 +2523,7 @@ static SMqRspObj* processMqRsp(tmq_t* tmq, SMqRspWrapper* pRspWrapper){ tFormatOffset(buf, TSDB_OFFSET_LEN, &pollRspWrapper->rspOffset); if (pollRspWrapper->dataRsp.blockNum == 0) { tqDebugC("consumer:0x%" PRIx64 " empty block received, vgId:%d, offset:%s, vg total:%" PRId64 - ", total:%" PRId64 ",QID:0x%" PRIx64, + ", total:%" PRId64 ", QID:0x%" PRIx64, tmq->consumerId, pVg->vgId, buf, pVg->numOfRows, tmq->totalRows, pollRspWrapper->reqId); pVg->emptyBlockReceiveTs = taosGetTimestampMs(); } else { @@ -2551,7 +2551,7 @@ static SMqRspObj* processMqRsp(tmq_t* tmq, SMqRspWrapper* pRspWrapper){ } } tqDebugC("consumer:0x%" PRIx64 " process poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64 - ", vg total:%" PRId64 ", total:%" PRId64 ",QID:0x%" PRIx64, + ", vg total:%" PRId64 ", total:%" PRId64 ", QID:0x%" PRIx64, tmq->consumerId, pVg->vgId, buf, pRspObj->dataRsp.blockNum, numOfRows, pVg->numOfRows, tmq->totalRows, pollRspWrapper->reqId); } @@ -3551,7 +3551,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pClientVg->offsetInfo.beginOffset); - tqInfoC("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s,QID:0x%" PRIx64, tmq->consumerId, + tqInfoC("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s, QID:0x%" PRIx64, tmq->consumerId, pTopic->topicName, pClientVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId); code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, NULL, sendInfo); if (code != 0) { diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 1c96b0c239..fc880ec055 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -83,12 +83,12 @@ extern "C" { }\ } -#define dGFatal(param, ...) {if (dDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dFatal(param ",QID:%s", __VA_ARGS__, buf);}} -#define dGError(param, ...) {if (dDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dError(param ",QID:%s", __VA_ARGS__, buf);}} -#define dGWarn(param, ...) {if (dDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dWarn(param ",QID:%s", __VA_ARGS__, buf);}} -#define dGInfo(param, ...) {if (dDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dInfo(param ",QID:%s", __VA_ARGS__, buf);}} -#define dGDebug(param, ...) {if (dDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dDebug(param ",QID:%s", __VA_ARGS__, buf);}} -#define dGTrace(param, ...) {if (dDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dTrace(param ",QID:%s", __VA_ARGS__, buf);}} +#define dGFatal(param, ...) {if (dDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dFatal(param ", QID:%s", __VA_ARGS__, buf);}} +#define dGError(param, ...) {if (dDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dError(param ", QID:%s", __VA_ARGS__, buf);}} +#define dGWarn(param, ...) {if (dDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dWarn(param ", QID:%s", __VA_ARGS__, buf);}} +#define dGInfo(param, ...) {if (dDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dInfo(param ", QID:%s", __VA_ARGS__, buf);}} +#define dGDebug(param, ...) {if (dDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dDebug(param ", QID:%s", __VA_ARGS__, buf);}} +#define dGTrace(param, ...) {if (dDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dTrace(param ", QID:%s", __VA_ARGS__, buf);}} // clang-format on diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index ad95f719b2..8c85536276 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -42,12 +42,12 @@ extern "C" { #define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND DEBUG ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }} #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND TRACE ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} -#define mGFatal(param, ...) { if (mDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mFatal(param ",QID:%s", __VA_ARGS__, buf);}} -#define mGError(param, ...) { if (mDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mError(param ",QID:%s", __VA_ARGS__, buf);}} -#define mGWarn(param, ...) { if (mDebugFlag & DEBUG_WARN){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mWarn (param ",QID:%s", __VA_ARGS__, buf);}} -#define mGInfo(param, ...) { if (mDebugFlag & DEBUG_INFO){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mInfo (param ",QID:%s", __VA_ARGS__, buf);}} -#define mGDebug(param, ...) { if (mDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mDebug(param ",QID:%s", __VA_ARGS__, buf);}} -#define mGTrace(param, ...) { if (mDebugFlag & DEBUG_TRACE){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mTrace(param ",QID:%s", __VA_ARGS__, buf);}} +#define mGFatal(param, ...) { if (mDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mFatal(param ", QID:%s", __VA_ARGS__, buf);}} +#define mGError(param, ...) { if (mDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mError(param ", QID:%s", __VA_ARGS__, buf);}} +#define mGWarn(param, ...) { if (mDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); mWarn (param ", QID:%s", __VA_ARGS__, buf);}} +#define mGInfo(param, ...) { if (mDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); mInfo (param ", QID:%s", __VA_ARGS__, buf);}} +#define mGDebug(param, ...) { if (mDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mDebug(param ", QID:%s", __VA_ARGS__, buf);}} +#define mGTrace(param, ...) { if (mDebugFlag & DEBUG_TRACE){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mTrace(param ", QID:%s", __VA_ARGS__, buf);}} // clang-format on #define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE) diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index db48f8cfa3..850d0b036e 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -32,12 +32,12 @@ extern "C" { #define vDebug(...) do { if (vDebugFlag & DEBUG_DEBUG) { taosPrintLog("VND DEBUG ", DEBUG_DEBUG, vDebugFlag, __VA_ARGS__); }} while(0) #define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND TRACE ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0) -#define vGTrace(param, ...) do { if (vDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vTrace(param ",QID:%s", __VA_ARGS__, buf);}} while(0) -#define vGFatal(param, ...) do { if (vDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vFatal(param ",QID:%s", __VA_ARGS__, buf);}} while(0) -#define vGError(param, ...) do { if (vDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vError(param ",QID:%s", __VA_ARGS__, buf);}} while(0) -#define vGWarn(param, ...) do { if (vDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vWarn(param ",QID:%s", __VA_ARGS__, buf);}} while(0) -#define vGInfo(param, ...) do { if (vDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vInfo(param ",QID:%s", __VA_ARGS__, buf);}} while(0) -#define vGDebug(param, ...) do { if (vDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vDebug(param ",QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGTrace(param, ...) do { if (vDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vTrace(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGFatal(param, ...) do { if (vDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vFatal(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGError(param, ...) do { if (vDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vError(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGWarn(param, ...) do { if (vDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vWarn(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGInfo(param, ...) do { if (vDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vInfo(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGDebug(param, ...) do { if (vDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vDebug(param ", QID:%s", __VA_ARGS__, buf);}} while(0) // clang-format on diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index b9de5dce52..5df4f852c2 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -202,7 +202,7 @@ void tqPushEmptyDataRsp(STqHandle* pHandle, int32_t vgId) { dataRsp.blockNum = 0; char buf[TSDB_OFFSET_LEN] = {0}; (void)tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.reqOffset); - tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s,QID:0x%" PRIx64, req.consumerId, vgId, buf, + tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s, QID:0x%" PRIx64, req.consumerId, vgId, buf, req.reqId); code = tqSendDataRsp(pHandle, pHandle->msg, &req, &dataRsp, TMQ_MSG_TYPE__POLL_DATA_RSP, vgId); @@ -225,7 +225,7 @@ int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* (void)tFormatOffset(buf1, TSDB_OFFSET_LEN, &(pRsp->reqOffset)); (void)tFormatOffset(buf2, TSDB_OFFSET_LEN, &(pRsp->rspOffset)); - tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) start to send rsp, block num:%d, req:%s, rsp:%s,QID:0x%" PRIx64, + tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) start to send rsp, block num:%d, req:%s, rsp:%s, QID:0x%" PRIx64, vgId, pReq->consumerId, pReq->epoch, pRsp->blockNum, buf1, buf2, pReq->reqId); return tqDoSendDataRsp(&pMsg->info, pRsp, pReq->epoch, pReq->consumerId, type, sver, ever); @@ -477,7 +477,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { char buf[TSDB_OFFSET_LEN] = {0}; (void)tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset); - tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s,QID:0x%" PRIx64, + tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, QID:0x%" PRIx64, consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId); code = tqExtractDataForMq(pTq, pHandle, &req, pMsg); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index ee705ed374..3cb03701f2 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -222,12 +222,12 @@ int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, uint64_t while (offset <= appliedVer) { if (walFetchHead(pHandle->pWalReader, offset) < 0) { tqDebug("tmq poll: consumer:0x%" PRIx64 ", (epoch %d) vgId:%d offset %" PRId64 - ", no more log to return,QID:0x%" PRIx64 " 0x%" PRIx64, + ", no more log to return, QID:0x%" PRIx64 " 0x%" PRIx64, pHandle->consumerId, pHandle->epoch, vgId, offset, reqId, id); goto END; } - tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s,QID:0x%" PRIx64 " 0x%" PRIx64, + tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s, QID:0x%" PRIx64 " 0x%" PRIx64, vgId, pHandle->consumerId, offset, TMSG_INFO(pHandle->pWalReader->pHead->head.msgType), reqId, id); if (pHandle->pWalReader->pHead->head.msgType == TDMT_VND_SUBMIT) { diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index bc8b8504c4..f92cd6d972 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -190,10 +190,10 @@ end: char buf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.rspOffset); if (code != 0){ - tqError("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s,QID:0x%" PRIx64 " error msg:%s, line:%d", + tqError("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, QID:0x%" PRIx64 " error msg:%s, line:%d", consumerId, pHandle->subKey, vgId, dataRsp.blockNum, buf, pRequest->reqId, tstrerror(code), lino); } else { - tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s,QID:0x%" PRIx64 " success", + tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, QID:0x%" PRIx64 " success", consumerId, pHandle->subKey, vgId, dataRsp.blockNum, buf, pRequest->reqId); } diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 0c4a3932b7..fe4b2ae8f1 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -461,7 +461,7 @@ int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { } // enqueue - tqDebug("s-task:%s (vgId:%d level:%d) recv retrieve req from task:0x%x(vgId:%d),QID:0x%" PRIx64, pTask->id.idStr, + tqDebug("s-task:%s (vgId:%d level:%d) recv retrieve req from task:0x%x(vgId:%d), QID:0x%" PRIx64, pTask->id.idStr, pTask->pMeta->vgId, pTask->info.taskLevel, req.srcTaskId, req.srcNodeId, req.reqId); // if task is in ck status, set current ck failed diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 27c008278f..b70c018110 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -917,7 +917,7 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) { if (ctg && (*ctg)) { *catalogHandle = *ctg; CTG_STAT_HIT_INC(CTG_CI_CLUSTER, 1); - qDebug("got catalog handle from cache, clusterId:0x%" PRIx64 ", CTG:%p", clusterId, *ctg); + qDebug("CTG:%p, get catalog handle from cache, clusterId:0x%" PRIx64, *ctg, clusterId); CTG_API_LEAVE(TSDB_CODE_SUCCESS); } diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 917d9feed6..03a2a342c7 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -873,7 +873,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const *job = taosMemoryCalloc(1, sizeof(SCtgJob)); if (NULL == *job) { - ctgError("failed to calloc, size:%d,QID:0x%" PRIx64, (int32_t)sizeof(SCtgJob), pConn->requestId); + ctgError("failed to calloc, size:%d, QID:0x%" PRIx64, (int32_t)sizeof(SCtgJob), pConn->requestId); CTG_ERR_RET(terrno); } diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 761ec82dbf..cf397df3fb 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -280,14 +280,14 @@ int32_t ctgAcquireTbMetaFromCache(SCatalog *pCtg, const char *dbFName, const cha CTG_LOCK(CTG_READ, &pCache->metaLock); if (NULL == pCache->pMeta) { - ctgDebug("tb %s meta not in cache, dbFName:%s", tbName, dbFName); + ctgDebug("tb:%s meta not in cache, dbFName:%s", tbName, dbFName); goto _return; } *pDb = dbCache; *pTb = pCache; - ctgDebug("tb %s meta got in cache, dbFName:%s", tbName, dbFName); + ctgDebug("tb:%s meta get in cache, dbFName:%s", tbName, dbFName); CTG_META_HIT_INC(pCache->pMeta->tableType); @@ -338,14 +338,14 @@ int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const cha CTG_LOCK(CTG_READ, &tbCache->metaLock); if (NULL == tbCache->pMeta) { - ctgDebug("tb %s meta not in cache, dbFName:%s", tbName, dbFName); + ctgDebug("tb:%s meta not in cache, dbFName:%s", tbName, dbFName); CTG_META_NHIT_INC(); goto _return; } *pTb = tbCache; - ctgDebug("tb %s meta got in cache, dbFName:%s", tbName, dbFName); + ctgDebug("tb:%s meta get in cache, dbFName:%s", tbName, dbFName); CTG_META_HIT_INC(tbCache->pMeta->tableType); @@ -557,7 +557,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt (*pTableMeta)->schemaExt = NULL; } - ctgDebug("get tb %s meta from cache, type:%d, dbFName:%s", ctx->pName->tname, tbMeta->tableType, dbFName); + ctgDebug("get tb:%s meta from cache, type:%d, dbFName:%s", ctx->pName->tname, tbMeta->tableType, dbFName); return TSDB_CODE_SUCCESS; } @@ -632,7 +632,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta ** ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgDebug("get tb %s meta from cache, dbFName:%s", ctx->pName->tname, dbFName); + ctgDebug("get tb:%s meta from cache, dbFName:%s", ctx->pName->tname, dbFName); return TSDB_CODE_SUCCESS; @@ -669,7 +669,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, *sver = tbMeta->sversion; *tver = tbMeta->tversion; - ctgDebug("get tb %s ver from cache, dbFName:%s, tbType:%d, sver:%d, tver:%d, suid:0x%" PRIx64, pTableName->tname, + ctgDebug("get tb:%s ver from cache, dbFName:%s, tbType:%d, sver:%d, tver:%d, suid:0x%" PRIx64, pTableName->tname, dbFName, *tbType, *sver, *tver, *suid); ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); @@ -711,7 +711,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgDebug("get tb %s sver %d tver %d from cache, type:%d, dbFName:%s", pTableName->tname, *sver, *tver, *tbType, + ctgDebug("get tb:%s sver %d tver %d from cache, type:%d, dbFName:%s", pTableName->tname, *sver, *tver, *tbType, dbFName); return TSDB_CODE_SUCCESS; @@ -729,7 +729,7 @@ int32_t ctgReadTbTypeFromCache(SCatalog *pCtg, char *dbFName, char *tbName, int3 *tbType = tbCache->pMeta->tableType; ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgDebug("get tb %s tbType %d from cache, dbFName:%s", tbName, *tbType, dbFName); + ctgDebug("get tb:%s tbType %d from cache, dbFName:%s", tbName, *tbType, dbFName); return TSDB_CODE_SUCCESS; } @@ -3517,7 +3517,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_UNLOCK(CTG_READ, &pCache->metaLock); taosHashRelease(dbCache->tbCache, pCache); - ctgDebug("get tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); + ctgDebug("get tb:%s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); res.pRes = pTableMeta; if (NULL == taosArrayPush(ctx->pResList, &res)) { @@ -3542,7 +3542,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_UNLOCK(CTG_READ, &pCache->metaLock); taosHashRelease(dbCache->tbCache, pCache); - ctgDebug("get tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); + ctgDebug("get tb:%s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName); res.pRes = pTableMeta; if (NULL == taosArrayPush(ctx->pResList, &res)) { diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 98f60ec12c..251f8b806c 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -562,7 +562,7 @@ int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob* pJob, CTG_ERR_JRET(code); } - ctgDebug("ctg req msg sent,QID:0x%" PRIx64 ", msg type:%d, %s", pJob->queryId, msgType, TMSG_INFO(msgType)); + ctgDebug("ctg req msg sent, QID:0x%" PRIx64 ", msg type:%d, %s", pJob->queryId, msgType, TMSG_INFO(msgType)); return TSDB_CODE_SUCCESS; _return: diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index c96fef5798..9fba087da3 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -1293,7 +1293,7 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SEpSet* pMgmtEps, SDBVgInfo* d *pVgroup = *vgInfo; - ctgDebug("get tb %s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, + ctgDebug("get tb:%s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, vgInfo->epSet.numOfEps, vgInfo->epSet.eps[vgInfo->epSet.inUse].fqdn, vgInfo->epSet.eps[vgInfo->epSet.inUse].port); @@ -1437,7 +1437,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SEpSet* pMgmgEpSet, SCtgTaskR *pNewVg = *vgInfo; - ctgDebug("get tb %s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, + ctgDebug("get tb:%s hash vgroup, vgId:%d, epNum %d, current %s port %d", tbFullName, vgInfo->vgId, vgInfo->epSet.numOfEps, vgInfo->epSet.eps[vgInfo->epSet.inUse].fqdn, vgInfo->epSet.eps[vgInfo->epSet.inUse].port); @@ -1496,7 +1496,7 @@ int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFNam vgId[i] = vgInfo->vgId; - ctgDebug("get tb %s vgId:%d", tbFullName, vgInfo->vgId); + ctgDebug("get tb:%s vgId:%d", tbFullName, vgInfo->vgId); } CTG_RET(code); diff --git a/source/libs/nodes/inc/nodesUtil.h b/source/libs/nodes/inc/nodesUtil.h index e092c18834..320a20c533 100644 --- a/source/libs/nodes/inc/nodesUtil.h +++ b/source/libs/nodes/inc/nodesUtil.h @@ -20,12 +20,12 @@ extern "C" { #endif -#define nodesFatal(...) qFatal("NODES: " __VA_ARGS__) -#define nodesError(...) qError("NODES: " __VA_ARGS__) -#define nodesWarn(...) qWarn("NODES: " __VA_ARGS__) -#define nodesInfo(...) qInfo("NODES: " __VA_ARGS__) -#define nodesDebug(...) qDebug("NODES: " __VA_ARGS__) -#define nodesTrace(...) qTrace("NODES: " __VA_ARGS__) +#define nodesFatal(...) qFatal("NODES:" __VA_ARGS__) +#define nodesError(...) qError("NODES:" __VA_ARGS__) +#define nodesWarn(...) qWarn ("NODES:" __VA_ARGS__) +#define nodesInfo(...) qInfo ("NODES:" __VA_ARGS__) +#define nodesDebug(...) qDebug("NODES:" __VA_ARGS__) +#define nodesTrace(...) qTrace("NODES:" __VA_ARGS__) #define NODES_ERR_RET(c) \ do { \ diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h index aec5fb4cd6..bbd977854d 100644 --- a/source/libs/parser/inc/parUtil.h +++ b/source/libs/parser/inc/parUtil.h @@ -26,12 +26,12 @@ extern "C" { #include "parToken.h" #include "query.h" -#define parserFatal(param, ...) qFatal("PARSER: " param, ##__VA_ARGS__) -#define parserError(param, ...) qError("PARSER: " param, ##__VA_ARGS__) -#define parserWarn(param, ...) qWarn("PARSER: " param, ##__VA_ARGS__) -#define parserInfo(param, ...) qInfo("PARSER: " param, ##__VA_ARGS__) -#define parserDebug(param, ...) qDebug("PARSER: " param, ##__VA_ARGS__) -#define parserTrace(param, ...) qTrace("PARSER: " param, ##__VA_ARGS__) +#define parserFatal(param, ...) qFatal("PARSER:" param, ##__VA_ARGS__) +#define parserError(param, ...) qError("PARSER:" param, ##__VA_ARGS__) +#define parserWarn(param, ...) qWarn ("PARSER:" param, ##__VA_ARGS__) +#define parserInfo(param, ...) qInfo ("PARSER:" param, ##__VA_ARGS__) +#define parserDebug(param, ...) qDebug("PARSER:" param, ##__VA_ARGS__) +#define parserTrace(param, ...) qTrace("PARSER:" param, ##__VA_ARGS__) #define ROWTS_PSEUDO_COLUMN_NAME "_rowts" #define C0_PSEUDO_COLUMN_NAME "_c0" diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 5ff6e4f555..70dc3011b0 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -3194,14 +3194,14 @@ static int32_t buildInsertCatalogReq(SInsertParseContext* pCxt, SVnodeModifyOpSt static int32_t setNextStageInfo(SInsertParseContext* pCxt, SQuery* pQuery, SCatalogReq* pCatalogReq) { SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; if (pCxt->missCache) { - parserDebug("0x%" PRIx64 " %d rows of %d tables have been inserted before cache miss", pCxt->pComCxt->requestId, + parserDebug("0x%" PRIx64 " %d rows of %d tables will insert before cache miss", pCxt->pComCxt->requestId, pStmt->totalRowsNum, pStmt->totalTbNum); pQuery->execStage = QUERY_EXEC_STAGE_PARSE; return buildInsertCatalogReq(pCxt, pStmt, pCatalogReq); } - parserDebug("0x%" PRIx64 " %d rows of %d tables have been inserted", pCxt->pComCxt->requestId, pStmt->totalRowsNum, + parserDebug("0x%" PRIx64 " %d rows of %d tables will insert", pCxt->pComCxt->requestId, pStmt->totalRowsNum, pStmt->totalTbNum); pQuery->execStage = QUERY_EXEC_STAGE_SCHEDULE; diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 6474a1ab30..1d46dc6c61 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -414,29 +414,29 @@ extern SQueryMgmt gQueryMgmt; #define QW_SCH_DLOG(param, ...) qDebug("QW:%p clientId:%" PRIx64 " " param, mgmt, clientId, __VA_ARGS__) #define QW_TASK_ELOG(param, ...) \ - qError("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) + qError("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) #define QW_TASK_WLOG(param, ...) \ - qWarn("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) + qWarn("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) #define QW_TASK_DLOG(param, ...) \ - qDebug("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) + qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) #define QW_TASK_DLOGL(param, ...) \ - qDebugL("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) + qDebugL("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, qId, sId, cId, tId, eId, __VA_ARGS__) #define QW_TASK_ELOG_E(param) \ - qError("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, sId, cId, tId, eId) + qError("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, qId, sId, cId, tId, eId) #define QW_TASK_WLOG_E(param) \ - qWarn("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, sId, cId, tId, eId) + qWarn("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, qId, sId, cId, tId, eId) #define QW_TASK_DLOG_E(param) \ - qDebug("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, sId, cId, tId, eId) + qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, qId, sId, cId, tId, eId) #define QW_SCH_TASK_ELOG(param, ...) \ - qError("QW:%p SID:%" PRId64 ",QID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, \ + qError("QW:%p, SID:%" PRId64 ", QID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, mgmt, sId, \ qId, cId, tId, eId, __VA_ARGS__) #define QW_SCH_TASK_WLOG(param, ...) \ - qWarn("QW:%p SID:%" PRId64 ",QID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, qId, \ + qWarn("QW:%p, SID:%" PRId64 ", QID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, mgmt, sId, qId, \ cId, tId, eId, __VA_ARGS__) #define QW_SCH_TASK_DLOG(param, ...) \ - qDebug("QW:%p SID:%" PRId64 ",QID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, \ + qDebug("QW:%p, SID:%" PRId64 ", QID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, mgmt, sId, \ qId, cId, tId, eId, __VA_ARGS__) #define QW_LOCK_DEBUG(...) \ diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c index f4015ea28d..2777425365 100644 --- a/source/libs/qworker/src/qwDbg.c +++ b/source/libs/qworker/src/qwDbg.c @@ -192,7 +192,7 @@ void qwDbgDumpJobsInfo(void) { int32_t sessionIdx = 0; SQWSessionInfo* pSession = (SQWSessionInfo*)taosHashIterate(pJob->pSessions, NULL); while (NULL != pSession) { - qDebug("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d the %dth remain session", + qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d the %dth remain session", pSession->qId, pSession->sId, pSession->cId, pSession->tId, pSession->eId, sessionIdx++); pSession = (SQWSessionInfo*)taosHashIterate(pJob->pSessions, pSession); diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index cdbeb2a2e0..ddae00bd18 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -462,23 +462,23 @@ extern SSchedulerMgmt schMgmt; (_task)->profile.endTs = us; \ } while (0) -#define SCH_JOB_ELOG(param, ...) qError("QID:0x%" PRIx64 ",SID:%" PRId64 " " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) -#define SCH_JOB_DLOG(param, ...) qDebug("QID:0x%" PRIx64 ",SID:%" PRId64 " " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) +#define SCH_JOB_ELOG(param, ...) qError("QID:0x%" PRIx64 ", SID:%" PRId64 " " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) +#define SCH_JOB_DLOG(param, ...) qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 " " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) #define SCH_TASK_ELOG(param, ...) \ - qError("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qError("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_DLOG(param, ...) \ - qDebug("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_TLOG(param, ...) \ - qTrace("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qTrace("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_DLOGL(param, ...) \ - qDebugL("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qDebugL("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_WLOG(param, ...) \ - qWarn("QID:0x%" PRIx64 ",SID:%" PRId64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qWarn("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_SET_ERRNO(_err) \ diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 25052d2c15..ce2930819e 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -1246,7 +1246,7 @@ int32_t schProcessOnCbBegin(SSchJob **job, SSchTask **task, uint64_t qId, int64_ (void)schAcquireJob(rId, &pJob); if (NULL == pJob) { - qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 "job no exist, may be dropped, refId:0x%" PRIx64, qId, tId, rId); + qWarn("QID:0x%" PRIx64 ", TID:0x%" PRIx64 "job no exist, may be dropped, refId:0x%" PRIx64, qId, tId, rId); SCH_ERR_RET(TSDB_CODE_QRY_JOB_NOT_EXIST); } diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index ec9913d6ac..b18decfff2 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -511,7 +511,7 @@ _return: int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; - qDebug("QID:0x%" PRIx64 ",SID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 " drop task rsp received, code:0x%x", + qDebug("QID:0x%" PRIx64 ", SID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 " drop task rsp received, code:0x%x", pParam->queryId, pParam->seriousId, pParam->clientId, pParam->taskId, code); // called if drop task rsp received code (void)rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT, 0); // ignore error @@ -528,7 +528,7 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { int32_t schHandleNotifyCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; - qDebug("QID:0x%" PRIx64 ",SID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 " task notify rsp received, code:0x%x", + qDebug("QID:0x%" PRIx64 ", SID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 " task notify rsp received, code:0x%x", pParam->queryId, pParam->seriousId, pParam->clientId, pParam->taskId, code); if (pMsg) { taosMemoryFreeClear(pMsg->pData); diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index 0e76e21aff..a4edda8d60 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -1014,7 +1014,7 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) { int32_t code = 0; - qDebug("QID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d task status in server: %s", pStatus->queryId, + qDebug("QID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d task status in server: %s", pStatus->queryId, pStatus->clientId, pStatus->taskId, pStatus->execId, jobTaskStatusStr(pStatus->status)); if (schProcessOnCbBegin(&pJob, &pTask, pStatus->queryId, pStatus->refId, pStatus->taskId)) { @@ -1061,13 +1061,13 @@ int32_t schHandleExplainRes(SArray *pExplainRes) { continue; } - qDebug("QID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ", begin to handle LOCAL explain rsp msg", + qDebug("QID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", begin to handle LOCAL explain rsp msg", localRsp->qId, localRsp->cId, localRsp->tId); pJob = NULL; (void)schAcquireJob(localRsp->rId, &pJob); if (NULL == pJob) { - qWarn("QID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 "job no exist, may be dropped, refId:0x%" PRIx64, + qWarn("QID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 " job no exist, may be dropped, refId:0x%" PRIx64, localRsp->qId, localRsp->cId, localRsp->tId, localRsp->rId); SCH_ERR_JRET(TSDB_CODE_QRY_JOB_NOT_EXIST); } @@ -1087,7 +1087,7 @@ int32_t schHandleExplainRes(SArray *pExplainRes) { (void)schReleaseJob(pJob->refId); - qDebug("QID:0x%" PRIx64 ",CID:0x%" PRIx64 ",TID:0x%" PRIx64 ", end to handle LOCAL explain rsp msg, code:%x", + qDebug("QID:0x%" PRIx64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", end to handle LOCAL explain rsp msg, code:%x", localRsp->qId, localRsp->cId, localRsp->tId, code); SCH_ERR_JRET(code); diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c index f880526541..ebb13654b7 100644 --- a/source/libs/stream/src/streamCheckStatus.c +++ b/source/libs/stream/src/streamCheckStatus.c @@ -471,7 +471,7 @@ int32_t streamTaskUpdateCheckInfo(STaskCheckInfo* pInfo, int32_t taskId, int32_t } streamMutexUnlock(&pInfo->checkInfoLock); - stError("s-task:%s unexpected check rsp msg, invalid downstream task:0x%x,QID:%" PRIx64 " discarded", id, taskId, + stError("s-task:%s unexpected check rsp msg, invalid downstream task:0x%x, QID:%" PRIx64 " discarded", id, taskId, reqId); return TSDB_CODE_FAILED; } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 41773ee42d..0aa9d6fbb4 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -134,7 +134,7 @@ int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* r stError("s-task:%s (child %d) failed to send retrieve req to task:0x%x (vgId:%d) QID:0x%" PRIx64 " code:%s", pTask->id.idStr, pTask->info.selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req->reqId, tstrerror(code)); } else { - stDebug("s-task:%s (child %d) send retrieve req to task:0x%x (vgId:%d),QID:0x%" PRIx64, pTask->id.idStr, + stDebug("s-task:%s (child %d) send retrieve req to task:0x%x (vgId:%d), QID:0x%" PRIx64, pTask->id.idStr, pTask->info.selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req->reqId); } } diff --git a/source/libs/transport/inc/transLog.h b/source/libs/transport/inc/transLog.h index 8b8cc3ae72..81306931cc 100644 --- a/source/libs/transport/inc/transLog.h +++ b/source/libs/transport/inc/transLog.h @@ -32,12 +32,12 @@ extern "C" { #define tTrace(...) { if (rpcDebugFlag & DEBUG_TRACE) { taosPrintLog("RPC TRACE ", DEBUG_TRACE, rpcDebugFlag, __VA_ARGS__); }} #define tDump(x, y) { if (rpcDebugFlag & DEBUG_DUMP) { taosDumpData((unsigned char *)x, y); } } -#define tGTrace(param, ...) do { if (rpcDebugFlag & DEBUG_TRACE){char buf[40] = {0}; TRACE_TO_STR(trace, buf); tTrace(param ",QID:%s", __VA_ARGS__, buf);}} while(0) -#define tGFatal(param, ...) do {if (rpcDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tFatal(param ",QID:%s", __VA_ARGS__, buf); }} while (0) -#define tGError(param, ...) do { if (rpcDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tError(param ",QID:%s", __VA_ARGS__, buf);} } while(0) -#define tGWarn(param, ...) do { if (rpcDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tWarn(param ",QID:%s", __VA_ARGS__, buf); }} while(0) -#define tGInfo(param, ...) do { if (rpcDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tInfo(param ",QID:%s", __VA_ARGS__, buf); }} while(0) -#define tGDebug(param,...) do {if (rpcDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tDebug(param ",QID:%s", __VA_ARGS__, buf); }} while(0) +#define tGTrace(param, ...) do { if (rpcDebugFlag & DEBUG_TRACE){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tTrace(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define tGFatal(param, ...) do {if (rpcDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tFatal(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define tGError(param, ...) do { if (rpcDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tError(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define tGWarn(param, ...) do { if (rpcDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tWarn(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define tGInfo(param, ...) do { if (rpcDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tInfo(param ", QID:%s", __VA_ARGS__, buf);}} while(0) +#define tGDebug(param,...) do {if (rpcDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tDebug(param ", QID:%s", __VA_ARGS__, buf);}} while(0) // clang-format on diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 3b84fc4574..4236d4e171 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -3765,7 +3765,7 @@ static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn) { if (pConn->heap != NULL) { p = pConn->heap; - tTrace("conn %p add to heap cache for key:%s,status:%d, refCnt:%d, add direct", pConn, pConn->dstAddr, + tTrace("conn %p add to heap cache for key:%s, status:%d, refCnt:%d, add direct", pConn, pConn->dstAddr, pConn->inHeap, pConn->reqRefCnt); } else { code = getOrCreateHeap(pConnHeapCacahe, pConn->dstAddr, &p); @@ -3781,7 +3781,7 @@ static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn) { } code = transHeapInsert(p, pConn); - tTrace("conn %p add to heap cache for key:%s,status:%d, refCnt:%d", pConn, pConn->dstAddr, pConn->inHeap, + tTrace("conn %p add to heap cache for key:%s, status:%d, refCnt:%d", pConn, pConn->dstAddr, pConn->inHeap, pConn->reqRefCnt); return code; } From 92f8f3690dd8e4635557f4e0534d54912b46094b Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 15:25:38 +0800 Subject: [PATCH 11/22] enh: adjust log format --- source/client/src/clientEnv.c | 8 ++--- source/client/src/clientImpl.c | 50 +++++++++++++++---------------- source/client/src/clientMain.c | 20 ++++++------- source/libs/catalog/src/catalog.c | 2 +- 4 files changed, 39 insertions(+), 41 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 29d8e2614f..a890c3d0ad 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -93,8 +93,7 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) { int32_t total = atomic_add_fetch_64((int64_t *)&pSummary->totalRequests, 1); int32_t currentInst = atomic_add_fetch_64((int64_t *)&pSummary->currentRequests, 1); - tscDebug("0x%" PRIx64 " new Request from connObj:0x%" PRIx64 - ", current:%d, app current:%d, total:%d, QID:0x%" PRIx64, + tscDebug("req:0x%" PRIx64 ", new from connObj:0x%" PRIx64 ", current:%d, app current:%d, total:%d, QID:0x%" PRIx64, pRequest->self, pRequest->pTscObj->id, num, currentInst, total, pRequest->requestId); } @@ -255,9 +254,8 @@ static void deregisterRequest(SRequestObj *pRequest) { int32_t reqType = SLOW_LOG_TYPE_OTHERS; int64_t duration = taosGetTimestampUs() - pRequest->metric.start; - tscDebug("0x%" PRIx64 " free Request from connObj:0x%" PRIx64 ", QID:0x%" PRIx64 - " elapsed:%.2f ms, " - "current:%d, app current:%d", + tscDebug("req:0x%" PRIx64 ", free from connObj:0x%" PRIx64 ", QID:0x%" PRIx64 + " elapsed:%.2f ms, current:%d, app current:%d", pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst); if (TSDB_CODE_SUCCESS == nodesSimAcquireAllocator(pRequest->allocatorRefId)) { diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 338290433e..82228d7547 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -227,7 +227,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, (*pRequest)->sqlstr = taosMemoryMalloc(sqlLen + 1); if ((*pRequest)->sqlstr == NULL) { - tscError("0x%" PRIx64 " failed to prepare sql string buffer, %s", (*pRequest)->self, sql); + tscError("req:0x%" PRIx64 ", failed to prepare sql string buffer, %s", (*pRequest)->self, sql); destroyRequest(*pRequest); *pRequest = NULL; return terrno; @@ -245,7 +245,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, int32_t err = taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self, sizeof((*pRequest)->self)); if (err) { - tscError("%" PRId64 " failed to add to request container, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", + tscError("req:0x%" PRId64 ", failed to add to request container, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; @@ -256,7 +256,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) { if (TSDB_CODE_SUCCESS != nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) { - tscError("%" PRId64 " failed to create node allocator, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, + tscError("req:0x%" PRId64 ", failed to create node allocator, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; @@ -264,7 +264,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, } } - tscDebugL("0x%" PRIx64 " SQL:%s, QID:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); + tscDebugL("req:0x%" PRIx64 ", SQL:%s, QID:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); return TSDB_CODE_SUCCESS; } @@ -381,10 +381,10 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; - tscError("0x%" PRIx64 " fetch results failed, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("req:0x%" PRIx64 ", fetch results failed, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); } else { - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, + tscDebug("req:0x%" PRIx64 ", fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed, pRequest->requestId); } @@ -1030,7 +1030,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { break; } default: - tscError("0x%" PRIx64 ", invalid exec result for request type %d, QID:0x%" PRIx64, pRequest->self, pRequest->type, + tscError("req:0x%" PRIx64 ", invalid exec result for request type %d, QID:0x%" PRIx64, pRequest->self, pRequest->type, pRequest->requestId); code = TSDB_CODE_APP_ERROR; } @@ -1075,7 +1075,7 @@ void returnToUser(SRequestObj* pRequest) { (void)releaseRequest(pRequest->relation.userRefId); return; } else { - tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, + tscError("req:0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, pRequest->relation.userRefId, pRequest->requestId); } } @@ -1146,7 +1146,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { SSDataBlock* pBlock = NULL; pRequest->code = createResultBlock(res, rowNum, &pBlock); if (TSDB_CODE_SUCCESS != pRequest->code) { - tscError("0x%" PRIx64 ", create result block failed, QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId, + tscError("req:0x%" PRIx64 ", create result block failed, QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId, tstrerror(pRequest->code)); returnToUser(pRequest); return; @@ -1157,7 +1157,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { continuePostSubQuery(pNextReq, pBlock); (void)releaseRequest(pRequest->relation.nextRefId); } else { - tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, + tscError("req:0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, pRequest->relation.nextRefId, pRequest->requestId); } @@ -1176,7 +1176,7 @@ void handlePostSubQuery(SSqlCallbackWrapper* pWrapper) { continuePostSubQuery(pNextReq, NULL); (void)releaseRequest(pRequest->relation.nextRefId); } else { - tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, + tscError("req:0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, QID:0x%" PRIx64, pRequest->self, pRequest->relation.nextRefId, pRequest->requestId); } } @@ -1208,14 +1208,14 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { } taosMemoryFree(pResult); - tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(code), + tscDebug("req:0x%" PRIx64 ", enter scheduler exec cb, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, + tscDebug("re:0x%" PRIx64 ", client retry to handle the error, code:%s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->retry, pRequest->requestId); if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) { - tscError("0x%" PRIx64 " remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); + tscError("req:0x%" PRIx64 ", remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); } restartAsyncQuery(pRequest, code); return; @@ -1224,7 +1224,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { tscDebug("schedulerExecCb request type %s", TMSG_INFO(pRequest->type)); if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) { if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) { - tscError("0x%" PRIx64 " remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); + tscError("req:0x%" PRIx64 ", remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); } } @@ -1322,7 +1322,7 @@ void launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) { int ret = removeMeta(pRequest->pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type)); if (TSDB_CODE_SUCCESS != ret) { - tscError("0x%" PRIx64 " remove meta failed,code:%d, QID:0x%" PRIx64, pRequest->self, ret, pRequest->requestId); + tscError("req:0x%" PRIx64 ", remove meta failed,code:%d, QID:0x%" PRIx64, pRequest->self, ret, pRequest->requestId); } } @@ -1370,7 +1370,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat code = qCreateQueryPlan(&cxt, &pDag, pMnodeList); } if (code) { - tscError("0x%" PRIx64 " failed to create query plan, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("req:0x%" PRIx64 ", failed to create query plan, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); } else { pRequest->body.subplanNum = pDag->numOfSubplans; @@ -1414,7 +1414,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat taosArrayDestroy(pNodeList); } else { qDestroyQueryPlan(pDag); - tscDebug("0x%" PRIx64 " plan not executed, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), + tscDebug("req:0x%" PRIx64 ", plan not executed, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1472,7 +1472,7 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM doRequestCallback(pRequest, 0); break; default: - tscError("0x%" PRIx64 " invalid execMode %d", pRequest->self, pQuery->execMode); + tscError("req:0x%" PRIx64 ", invalid execMode %d", pRequest->self, pQuery->execMode); doRequestCallback(pRequest, -1); break; } @@ -1796,7 +1796,7 @@ int32_t doProcessMsgFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) { SRequestObj* pRequest = (SRequestObj*)taosAcquireRef(clientReqRefPool, pSendInfo->requestObjRefId); if (pRequest) { if (pRequest->self != pSendInfo->requestObjRefId) { - tscError("doProcessMsgFromServer pRequest->self:%" PRId64 " != pSendInfo->requestObjRefId:%" PRId64, + tscError("doProcessMsgFromServer req:0x%" PRId64 " != pSendInfo->requestObjRefId:0x%" PRId64, pRequest->self, pSendInfo->requestObjRefId); if (TSDB_CODE_SUCCESS != taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId)) { @@ -2000,7 +2000,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) return NULL; } - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, + tscDebug("req:0x%" PRIx64 ", fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId); STscObj* pTscObj = pRequest->pTscObj; @@ -2952,7 +2952,7 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s return NULL; } - tscDebug("taos_query start with sql:%s", sql); + tscDebug("connObj:0x%" PRIx64 ", taos_query start with sql:%s", *(int64_t*)taos, sql); SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); if (NULL == param) { @@ -3024,7 +3024,7 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { SReqResultInfo* pResultInfo = &pRequest->body.resInfo; - tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), + tscDebug("req:0x%" PRIx64 ", enter scheduler fetch cb, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); pResultInfo->pData = pResult; @@ -3047,10 +3047,10 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4); if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; - tscError("0x%" PRIx64 " fetch results failed, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code), + tscError("req:0x%" PRIx64 ", fetch results failed, code:%s, QID:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code), pRequest->requestId); } else { - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, + tscDebug("req:0x%" PRIx64 ", fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, QID:0x%" PRIx64, pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed, pRequest->requestId); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index cf253a24ca..83e588a2ff 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -1157,7 +1157,7 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t SRequestObj *pRequest = pWrapper->pRequest; SQuery *pQuery = pRequest->pQuery; - qDebug("0x%" PRIx64 " start to semantic analysis, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); + qDebug("req:0x%" PRIx64 ", start to semantic analysis, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); int64_t analyseStart = taosGetTimestampUs(); pRequest->metric.ctgCostUs = analyseStart - pRequest->metric.ctgStart; @@ -1276,14 +1276,14 @@ void handleQueryAnslyseRes(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta pRequest->pQuery = NULL; if (NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, QID:0x%" PRIx64, + tscDebug("req:0x%" PRIx64 ", client retry to handle the error, code:%d - %s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); restartAsyncQuery(pRequest, code); return; } // return to app directly - tscError("0x%" PRIx64 " error occurs, code:%s, return to user app, QID:0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("req:0x%" PRIx64 ", error occurs, code:%s, return to user app, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); pRequest->code = code; returnToUser(pRequest); @@ -1333,7 +1333,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c SQuery *pQuery = pRequest->pQuery; pRequest->metric.ctgCostUs += taosGetTimestampUs() - pRequest->metric.ctgStart; - qDebug("0x%" PRIx64 " start to continue parse, QID:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId, + qDebug("req:0x%" PRIx64 ", start to continue parse, QID:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId, tstrerror(code)); if (code == TSDB_CODE_SUCCESS) { @@ -1346,7 +1346,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s, QID:0x%" PRIx64, pWrapper->pRequest->self, code, + tscError("req:0x%" PRIx64 ", error happens, code:%d - %s, QID:0x%" PRIx64, pWrapper->pRequest->self, code, tstrerror(code), pWrapper->pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1363,7 +1363,7 @@ void continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest) } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s, QID:0x%" PRIx64, pWrapper->pRequest->self, code, + tscError("req:0x%" PRIx64 ", error happens, code:%d - %s, QID:0x%" PRIx64, pWrapper->pRequest->self, code, tstrerror(code), pWrapper->pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1484,7 +1484,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), + tscError("req:0x%" PRIx64 ", error happens, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1492,11 +1492,11 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { pRequest->pQuery = NULL; if (NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, QID:0x%" PRIx64, + tscDebug("req:0x%" PRIx64 ", client retry to handle the error, code:%d - %s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); code = refreshMeta(pRequest->pTscObj, pRequest); if (code != 0) { - tscWarn("0x%" PRIx64 " refresh meta failed, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), + tscWarn("req:0x%" PRIx64 ", refresh meta failed, code:%d - %s, QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); } pRequest->prevCode = code; @@ -1511,7 +1511,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } void restartAsyncQuery(SRequestObj *pRequest, int32_t code) { - tscInfo("restart request: %s p: %p", pRequest->sqlstr, pRequest); + tscInfo("restart request:%s p:%p", pRequest->sqlstr, pRequest); SRequestObj *pUserReq = pRequest; (void)acquireRequest(pRequest->self); while (pUserReq) { diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index b70c018110..58e7ed6b03 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -917,7 +917,7 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) { if (ctg && (*ctg)) { *catalogHandle = *ctg; CTG_STAT_HIT_INC(CTG_CI_CLUSTER, 1); - qDebug("CTG:%p, get catalog handle from cache, clusterId:0x%" PRIx64, *ctg, clusterId); + qDebug("CTG:%p get catalog handle from cache, clusterId:0x%" PRIx64, *ctg, clusterId); CTG_API_LEAVE(TSDB_CODE_SUCCESS); } From 56e411c451397f5a37d576cf2d4a06595c2ab1b7 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 16:00:30 +0800 Subject: [PATCH 12/22] enh: adjust log format --- source/client/inc/clientStmt.h | 10 ++++---- source/client/inc/clientStmt2.h | 8 +++--- source/client/src/clientMain.c | 2 +- source/client/src/clientStmt.c | 2 +- source/client/src/clientStmt2.c | 2 +- source/libs/catalog/inc/catalogInt.h | 24 +++++++++--------- source/libs/catalog/src/catalog.c | 2 +- source/libs/parser/inc/parUtil.h | 12 ++++----- source/libs/parser/src/parInsertSql.c | 12 ++++----- source/libs/parser/src/parInsertUtil.c | 6 ++--- source/libs/parser/src/parTranslater.c | 34 +++++++++++++------------- 11 files changed, 57 insertions(+), 57 deletions(-) diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h index 35bfa66f72..ec61b2ff57 100644 --- a/source/client/inc/clientStmt.h +++ b/source/client/inc/clientStmt.h @@ -205,12 +205,12 @@ extern char *gStmtStatusStr[]; } \ } while (0) -#define STMT_FLOG(param, ...) qFatal("stmt:%p " param, pStmt, __VA_ARGS__) -#define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__) -#define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__) +#define STMT_FLOG(param, ...) qFatal("stmt:%p, " param, pStmt, __VA_ARGS__) +#define STMT_ELOG(param, ...) qError("stmt:%p, " param, pStmt, __VA_ARGS__) +#define STMT_DLOG(param, ...) qDebug("stmt:%p, " param, pStmt, __VA_ARGS__) -#define STMT_ELOG_E(param) qError("stmt:%p " param, pStmt) -#define STMT_DLOG_E(param) qDebug("stmt:%p " param, pStmt) +#define STMT_ELOG_E(param) qError("stmt:%p, " param, pStmt) +#define STMT_DLOG_E(param) qDebug("stmt:%p, " param, pStmt) TAOS_STMT *stmtInit(STscObj* taos, int64_t reqid, TAOS_STMT_OPTIONS* pOptions); int stmtClose(TAOS_STMT *stmt); diff --git a/source/client/inc/clientStmt2.h b/source/client/inc/clientStmt2.h index 283573803e..b95327e236 100644 --- a/source/client/inc/clientStmt2.h +++ b/source/client/inc/clientStmt2.h @@ -222,11 +222,11 @@ do { \ #define STMT_FLOG(param, ...) qFatal("stmt:%p " param, pStmt, __VA_ARGS__) -#define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__) -#define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__) +#define STMT_ELOG(param, ...) qError("stmt:%p, " param, pStmt, __VA_ARGS__) +#define STMT_DLOG(param, ...) qDebug("stmt:%p, " param, pStmt, __VA_ARGS__) -#define STMT_ELOG_E(param) qError("stmt:%p " param, pStmt) -#define STMT_DLOG_E(param) qDebug("stmt:%p " param, pStmt) +#define STMT_ELOG_E(param) qError("stmt:%p, " param, pStmt) +#define STMT_DLOG_E(param) qDebug("stmt:%p, " param, pStmt) */ TAOS_STMT2 *stmtInit2(STscObj *taos, TAOS_STMT2_OPTION *pOptions); int stmtClose2(TAOS_STMT2 *stmt); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 83e588a2ff..3b9239131f 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -1469,7 +1469,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { code = pRequest->prevCode; terrno = code; pRequest->code = code; - tscDebug("call sync query cb with code: %s", tstrerror(code)); + tscDebug("req:0x%" PRIx64 ", call sync query cb with code: %s", pRequest->self, tstrerror(code)); doRequestCallback(pRequest, code); return; } diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 4f912ec077..839102883a 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -573,7 +573,7 @@ int32_t stmtRebuildDataBlock(STscStmt* pStmt, STableDataCxt* pDataBlock, STableD STMT_ERR_RET(stmtTryAddTableVgroupInfo(pStmt, &vgId)); STMT_ERR_RET(qRebuildStmtDataBlock(newBlock, pDataBlock, uid, suid, vgId, pStmt->sql.autoCreateTbl)); - STMT_DLOG("tableDataCxt rebuilt, uid:%" PRId64 ", vgId:%d", uid, vgId); + STMT_DLOG("uid:%" PRId64 ", rebuild table data context, vgId:%d", uid, vgId); return TSDB_CODE_SUCCESS; } diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index 67066e1fdd..ae56403925 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -499,7 +499,7 @@ static int32_t stmtRebuildDataBlock(STscStmt2* pStmt, STableDataCxt* pDataBlock, STMT_ERR_RET(stmtTryAddTableVgroupInfo(pStmt, &vgId)); STMT_ERR_RET(qRebuildStmtDataBlock(newBlock, pDataBlock, uid, suid, vgId, pStmt->sql.autoCreateTbl)); - STMT_DLOG("tableDataCxt rebuilt, uid:%" PRId64 ", vgId:%d", uid, vgId); + STMT_DLOG("uid:%" PRId64 ", rebuild table data context, vgId:%d", uid, vgId); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index dd553ac301..b6bc2fac07 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -827,19 +827,19 @@ typedef struct SCtgCacheItemInfo { #define CTG_CACHE_OVERFLOW(_csize, _maxsize) ((_maxsize >= 0) ? ((_csize) >= (_maxsize)*1048576L * 0.9) : false) #define CTG_CACHE_LOW(_csize, _maxsize) ((_maxsize >= 0) ? ((_csize) <= (_maxsize)*1048576L * 0.75) : true) -#define ctgFatal(param, ...) qFatal("CTG:%p " param, pCtg, __VA_ARGS__) -#define ctgError(param, ...) qError("CTG:%p " param, pCtg, __VA_ARGS__) -#define ctgWarn(param, ...) qWarn("CTG:%p " param, pCtg, __VA_ARGS__) -#define ctgInfo(param, ...) qInfo("CTG:%p " param, pCtg, __VA_ARGS__) -#define ctgDebug(param, ...) qDebug("CTG:%p " param, pCtg, __VA_ARGS__) -#define ctgTrace(param, ...) qTrace("CTG:%p " param, pCtg, __VA_ARGS__) +#define ctgFatal(param, ...) qFatal("CTG:%p, " param, pCtg, __VA_ARGS__) +#define ctgError(param, ...) qError("CTG:%p, " param, pCtg, __VA_ARGS__) +#define ctgWarn(param, ...) qWarn ("CTG:%p, " param, pCtg, __VA_ARGS__) +#define ctgInfo(param, ...) qInfo ("CTG:%p, " param, pCtg, __VA_ARGS__) +#define ctgDebug(param, ...) qDebug("CTG:%p, " param, pCtg, __VA_ARGS__) +#define ctgTrace(param, ...) qTrace("CTG:%p, " param, pCtg, __VA_ARGS__) -#define ctgTaskFatal(param, ...) qFatal("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) -#define ctgTaskError(param, ...) qError("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) -#define ctgTaskWarn(param, ...) qWarn("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) -#define ctgTaskInfo(param, ...) qInfo("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) -#define ctgTaskDebug(param, ...) qDebug("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) -#define ctgTaskTrace(param, ...) qTrace("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) +#define ctgTaskFatal(param, ...) qFatal("QID:%" PRIx64 ", CTG:%p, " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) +#define ctgTaskError(param, ...) qError("QID:%" PRIx64 ", CTG:%p, " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) +#define ctgTaskWarn(param, ...) qWarn ("QID:%" PRIx64 ", CTG:%p, " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) +#define ctgTaskInfo(param, ...) qInfo ("QID:%" PRIx64 ", CTG:%p, " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) +#define ctgTaskDebug(param, ...) qDebug("QID:%" PRIx64 ", CTG:%p, " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) +#define ctgTaskTrace(param, ...) qTrace("QID:%" PRIx64 ", CTG:%p, " param, pTask->pJob->queryId, pCtg, __VA_ARGS__) #define CTG_LOCK_DEBUG(...) \ do { \ diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 58e7ed6b03..b70c018110 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -917,7 +917,7 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) { if (ctg && (*ctg)) { *catalogHandle = *ctg; CTG_STAT_HIT_INC(CTG_CI_CLUSTER, 1); - qDebug("CTG:%p get catalog handle from cache, clusterId:0x%" PRIx64, *ctg, clusterId); + qDebug("CTG:%p, get catalog handle from cache, clusterId:0x%" PRIx64, *ctg, clusterId); CTG_API_LEAVE(TSDB_CODE_SUCCESS); } diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h index bbd977854d..ede31ec2a5 100644 --- a/source/libs/parser/inc/parUtil.h +++ b/source/libs/parser/inc/parUtil.h @@ -26,12 +26,12 @@ extern "C" { #include "parToken.h" #include "query.h" -#define parserFatal(param, ...) qFatal("PARSER:" param, ##__VA_ARGS__) -#define parserError(param, ...) qError("PARSER:" param, ##__VA_ARGS__) -#define parserWarn(param, ...) qWarn ("PARSER:" param, ##__VA_ARGS__) -#define parserInfo(param, ...) qInfo ("PARSER:" param, ##__VA_ARGS__) -#define parserDebug(param, ...) qDebug("PARSER:" param, ##__VA_ARGS__) -#define parserTrace(param, ...) qTrace("PARSER:" param, ##__VA_ARGS__) +#define parserFatal(param, ...) qFatal("PARSER " param, ##__VA_ARGS__) +#define parserError(param, ...) qError("PARSER " param, ##__VA_ARGS__) +#define parserWarn(param, ...) qWarn ("PARSER " param, ##__VA_ARGS__) +#define parserInfo(param, ...) qInfo ("PARSER " param, ##__VA_ARGS__) +#define parserDebug(param, ...) qDebug("PARSER " param, ##__VA_ARGS__) +#define parserTrace(param, ...) qTrace("PARSER " param, ##__VA_ARGS__) #define ROWTS_PSEUDO_COLUMN_NAME "_rowts" #define C0_PSEUDO_COLUMN_NAME "_c0" diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 70dc3011b0..ada93fdf5d 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -2351,7 +2351,7 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt } taosMemoryFree(pLine); - parserDebug("0x%" PRIx64 " %d rows have been parsed", pCxt->pComCxt->requestId, *pNumOfRows); + parserDebug("QID:0x%" PRIx64 ", %d rows have been parsed", pCxt->pComCxt->requestId, *pNumOfRows); if (TSDB_CODE_SUCCESS == code && 0 == (*pNumOfRows) && 0 == pStmt->totalRowsNum && (!TSDB_QUERY_HAS_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) && !pStmt->fileProcessing) { @@ -2381,10 +2381,10 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt if (!pStmt->fileProcessing) { code = taosCloseFile(&pStmt->fp); if (TSDB_CODE_SUCCESS != code) { - parserWarn("0x%" PRIx64 " failed to close file.", pCxt->pComCxt->requestId); + parserWarn("QID:0x%" PRIx64 ", failed to close file.", pCxt->pComCxt->requestId); } } else { - parserDebug("0x%" PRIx64 " insert from csv. File is too large, do it in batches.", pCxt->pComCxt->requestId); + parserDebug("QID:0x%" PRIx64 ", insert from csv. File is too large, do it in batches.", pCxt->pComCxt->requestId); } if (pStmt->insertType != TSDB_QUERY_TYPE_FILE_INSERT) { return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is exclusive", NULL); @@ -2676,7 +2676,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif if (pCxt->isStmtBind) { if (TK_NK_ID == pTbName->type || (tbNameAfterDbName != NULL && *(tbNameAfterDbName + 1) != '?')) { // In SQL statements, the table name has already been specified. - parserWarn("0x%" PRIx64 " table name is specified in sql, ignore the table name in bind param", + parserWarn("QID:0x%" PRIx64 ", table name is specified in sql, ignore the table name in bind param", pCxt->pComCxt->requestId); } } @@ -3194,14 +3194,14 @@ static int32_t buildInsertCatalogReq(SInsertParseContext* pCxt, SVnodeModifyOpSt static int32_t setNextStageInfo(SInsertParseContext* pCxt, SQuery* pQuery, SCatalogReq* pCatalogReq) { SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; if (pCxt->missCache) { - parserDebug("0x%" PRIx64 " %d rows of %d tables will insert before cache miss", pCxt->pComCxt->requestId, + parserDebug("QID:0x%" PRIx64 ", %d rows of %d tables will insert before cache miss", pCxt->pComCxt->requestId, pStmt->totalRowsNum, pStmt->totalTbNum); pQuery->execStage = QUERY_EXEC_STAGE_PARSE; return buildInsertCatalogReq(pCxt, pStmt, pCatalogReq); } - parserDebug("0x%" PRIx64 " %d rows of %d tables will insert", pCxt->pComCxt->requestId, pStmt->totalRowsNum, + parserDebug("QID:0x%" PRIx64 ", %d rows of %d tables will insert", pCxt->pComCxt->requestId, pStmt->totalRowsNum, pStmt->totalTbNum); pQuery->execStage = QUERY_EXEC_STAGE_SCHEDULE; diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 1931f0803d..127155d105 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -298,7 +298,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat } if (TSDB_CODE_SUCCESS == code) { *pOutput = pTableCxt; - qDebug("tableDataCxt created, code:%d, uid:%" PRId64 ", vgId:%d", code, pTableMeta->uid, pTableMeta->vgId); + qDebug("uid:%" PRId64 ", create table data context, code:%d, vgId:%d", pTableMeta->uid, code, pTableMeta->vgId); } else { insDestroyTableDataCxt(pTableCxt); } @@ -478,7 +478,7 @@ static int32_t fillVgroupDataCxt(STableDataCxt* pTableCxt, SVgroupDataCxt* pVgCx taosMemoryFreeClear(pTableCxt->pData); } - qDebug("add tableDataCxt uid:%" PRId64 " to vgId:%d", pTableCxt->pMeta->uid, pVgCxt->vgId); + qDebug("uid:%" PRId64 ", add table data context to vgId:%d", pTableCxt->pMeta->uid, pVgCxt->vgId); return code; } @@ -572,7 +572,7 @@ int32_t insGetStmtTableVgUid(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo code = catalogGetTableMeta((SCatalog*)pBuildInfo->pCatalog, &conn, &sname, &pTableMeta); if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) { - parserDebug("tb %s.%s not exist", sname.dbname, sname.tname); + parserDebug("tb:%s.%s not exist", sname.dbname, sname.tname); return code; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2fdba9bad9..e715611df2 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -533,7 +533,7 @@ static int32_t getViewMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCac } if (TSDB_CODE_SUCCESS != code && TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { - parserError("0x%" PRIx64 " catalogGetViewMeta error, code:%s, dbName:%s, viewName:%s", pParCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetViewMeta error, code:%s, dbName:%s, viewName:%s", pParCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -549,7 +549,7 @@ static int32_t getTargetNameImpl(SParseContext* pParCxt, SParseMetaCache* pMetaC code = TSDB_CODE_PAR_INTERNAL_ERROR; } if (TSDB_CODE_SUCCESS != code && TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { - parserError("0x%" PRIx64 " catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pParCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pParCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -565,7 +565,7 @@ static int32_t getTargetName(STranslateContext* pCxt, const SName* pName, char* code = getTargetNameImpl(pParCxt, pCxt->pMetaCache, pName, pTbName); } if (TSDB_CODE_SUCCESS != code && TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { - parserError("0x%" PRIx64 " catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -657,7 +657,7 @@ int32_t getTargetMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCache, c } if (TSDB_CODE_SUCCESS != code && TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { - parserError("0x%" PRIx64 " catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pParCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pParCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -673,7 +673,7 @@ static int32_t getTargetMeta(STranslateContext* pCxt, const SName* pName, STable code = getTargetMetaImpl(pParCxt, pCxt->pMetaCache, pName, pMeta, couldBeView); } if (TSDB_CODE_SUCCESS != code && TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { - parserError("0x%" PRIx64 " catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -703,7 +703,7 @@ static int32_t getTableCfg(STranslateContext* pCxt, const SName* pName, STableCf } } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " catalogRefreshGetTableCfg error, code:%s, dbName:%s, tbName:%s", + parserError("QID:0x%" PRIx64 ", catalogRefreshGetTableCfg error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -726,7 +726,7 @@ static int32_t refreshGetTableMeta(STranslateContext* pCxt, const char* pDbName, code = catalogRefreshGetTableMeta(pParCxt->pCatalog, &conn, &name, pMeta, false); } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " catalogRefreshGetTableMeta error, code:%s, dbName:%s, tbName:%s", + parserError("QID:0x%" PRIx64 ", catalogRefreshGetTableMeta error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pDbName, pTableName); } return code; @@ -749,7 +749,7 @@ static int32_t getDBVgInfoImpl(STranslateContext* pCxt, const SName* pName, SArr } } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " catalogGetDBVgList error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetDBVgList error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, tstrerror(code), fullDbName); } return code; @@ -786,7 +786,7 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam } } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s", + parserError("QID:0x%" PRIx64 ", catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -811,7 +811,7 @@ static int32_t getDBVgVersion(STranslateContext* pCxt, const char* pDbFName, int } } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " catalogGetDBVgVersion error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetDBVgVersion error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pDbFName); } return code; @@ -842,7 +842,7 @@ static int32_t getDBCfg(STranslateContext* pCxt, const char* pDbName, SDbCfgInfo } } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " catalogGetDBCfg error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, tstrerror(code), + parserError("QID:0x%" PRIx64 ", catalogGetDBCfg error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, tstrerror(code), dbFname); } return code; @@ -871,7 +871,7 @@ static int32_t getUdfInfo(STranslateContext* pCxt, SFunctionNode* pFunc) { tFreeSFuncInfo(&funcInfo); } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " catalogGetUdfInfo error, code:%s, funcName:%s", pCxt->pParseCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetUdfInfo error, code:%s, funcName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pFunc->functionName); } return code; @@ -896,7 +896,7 @@ static int32_t getTableIndex(STranslateContext* pCxt, const SName* pName, SArray } } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " getTableIndex error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, + parserError("QID:0x%" PRIx64 ", getTableIndex error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; @@ -915,7 +915,7 @@ static int32_t getDnodeList(STranslateContext* pCxt, SArray** pDnodes) { code = catalogGetDnodeList(pParCxt->pCatalog, &conn, pDnodes); } if (TSDB_CODE_SUCCESS != code) { - parserError("0x%" PRIx64 " getDnodeList error, code:%s", pCxt->pParseCxt->requestId, tstrerror(code)); + parserError("QID:0x%" PRIx64 ", getDnodeList error, code:%s", pCxt->pParseCxt->requestId, tstrerror(code)); } return code; } @@ -933,7 +933,7 @@ static int32_t getTableTsmas(STranslateContext* pCxt, const SName* pName, SArray code = catalogGetTableTsmas(pParCxt->pCatalog, &conn, pName, ppTsmas); } if (code) - parserError("0x%" PRIx64 " get table tsma for : %s.%s error, code:%s", pCxt->pParseCxt->requestId, pName->dbname, + parserError("QID:0x%" PRIx64 ", get table tsma for : %s.%s error, code:%s", pCxt->pParseCxt->requestId, pName->dbname, pName->tname, tstrerror(code)); return code; } @@ -951,7 +951,7 @@ static int32_t getTsma(STranslateContext* pCxt, const SName* pName, STableTSMAIn code = catalogGetTsma(pParCxt->pCatalog, &conn, pName, pTsma); } if (code) - parserError("0x%" PRIx64 " get tsma for: %s.%s error, code:%s", pCxt->pParseCxt->requestId, pName->dbname, + parserError("QID:0x%" PRIx64 ", get tsma for: %s.%s error, code:%s", pCxt->pParseCxt->requestId, pName->dbname, pName->tname, tstrerror(code)); return code; } @@ -15504,7 +15504,7 @@ static int32_t fillVgroupInfo(SParseContext* pParseCxt, const SName* pName, SVgr if (code == TSDB_CODE_SUCCESS) { *pVgInfo = vg; } else { - parserError("0x%" PRIx64 " catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s", pParseCxt->requestId, + parserError("QID:0x%" PRIx64 ", catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s", pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } From 03d507422bc51e5498c88d6100845c9b68397eeb Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 16:08:26 +0800 Subject: [PATCH 13/22] enh: adjust log format --- source/libs/catalog/src/ctgAsync.c | 62 +++++++++++++-------------- source/libs/catalog/src/ctgRemote.c | 8 ++-- source/libs/planner/src/planner.c | 6 +-- source/libs/qworker/src/qwDbg.c | 2 +- source/libs/qworker/src/qworker.c | 10 ++--- source/libs/scheduler/inc/schInt.h | 14 +++--- source/libs/scheduler/src/schJob.c | 18 ++++---- source/libs/scheduler/src/schUtil.c | 6 +-- source/libs/scheduler/src/scheduler.c | 2 +- 9 files changed, 64 insertions(+), 64 deletions(-) diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 03a2a342c7..b6c66958e3 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -77,7 +77,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), name->tname); return TSDB_CODE_SUCCESS; @@ -99,7 +99,7 @@ int32_t ctgInitGetTbMetasTask(SCtgJob* pJob, int32_t taskIdx, void* param) { ctx->pNames = param; ctx->pResList = taosArrayInit(pJob->tbMetaNum, sizeof(SMetaRes)); if (NULL == ctx->pResList) { - qError("QID:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum, + qError("QID:0x%" PRIx64 ", taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum, (int32_t)sizeof(SMetaRes)); ctgFreeTask(&task, true); CTG_ERR_RET(terrno); @@ -110,7 +110,7 @@ int32_t ctgInitGetTbMetasTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), taosArrayGetSize(ctx->pNames), pJob->tbMetaNum); return TSDB_CODE_SUCCESS; @@ -138,7 +138,7 @@ int32_t ctgInitGetDbVgTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), dbFName); return TSDB_CODE_SUCCESS; @@ -166,7 +166,7 @@ int32_t ctgInitGetDbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), dbFName); return TSDB_CODE_SUCCESS; @@ -194,7 +194,7 @@ int32_t ctgInitGetDbInfoTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), dbFName); return TSDB_CODE_SUCCESS; @@ -228,7 +228,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), name->tname); return TSDB_CODE_SUCCESS; @@ -250,7 +250,7 @@ int32_t ctgInitGetTbHashsTask(SCtgJob* pJob, int32_t taskIdx, void* param) { ctx->pNames = param; ctx->pResList = taosArrayInit(pJob->tbHashNum, sizeof(SMetaRes)); if (NULL == ctx->pResList) { - qError("QID:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum, + qError("QID:0x%" PRIx64 ", taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum, (int32_t)sizeof(SMetaRes)); ctgFreeTask(&task, true); CTG_ERR_RET(terrno); @@ -261,7 +261,7 @@ int32_t ctgInitGetTbHashsTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), taosArrayGetSize(ctx->pNames), pJob->tbHashNum); return TSDB_CODE_SUCCESS; @@ -280,7 +280,7 @@ int32_t ctgInitGetQnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); return TSDB_CODE_SUCCESS; } @@ -298,7 +298,7 @@ int32_t ctgInitGetDnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); return TSDB_CODE_SUCCESS; } @@ -325,7 +325,7 @@ int32_t ctgInitGetIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), name); return TSDB_CODE_SUCCESS; @@ -353,7 +353,7 @@ int32_t ctgInitGetUdfTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), name); return TSDB_CODE_SUCCESS; @@ -381,7 +381,7 @@ int32_t ctgInitGetUserTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), user->user); return TSDB_CODE_SUCCESS; @@ -399,7 +399,7 @@ int32_t ctgInitGetSvrVerTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); return TSDB_CODE_SUCCESS; } @@ -431,7 +431,7 @@ int32_t ctgInitGetTbIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), name->tname); return TSDB_CODE_SUCCESS; @@ -464,7 +464,7 @@ int32_t ctgInitGetTbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), name->tname); return TSDB_CODE_SUCCESS; @@ -497,7 +497,7 @@ int32_t ctgInitGetTbTagTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), name->tname); return TSDB_CODE_SUCCESS; @@ -520,7 +520,7 @@ int32_t ctgInitGetViewsTask(SCtgJob* pJob, int32_t taskIdx, void* param) { ctx->forceFetch = p->forceFetch; ctx->pResList = taosArrayInit(pJob->viewNum, sizeof(SMetaRes)); if (NULL == ctx->pResList) { - qError("QID:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum, + qError("QID:0x%" PRIx64 ", taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum, (int32_t)sizeof(SMetaRes)); ctgFreeTask(&task, true); CTG_ERR_RET(terrno); @@ -531,7 +531,7 @@ int32_t ctgInitGetViewsTask(SCtgJob* pJob, int32_t taskIdx, void* param) { CTG_ERR_RET(terrno); } - qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx, + qDebug("QID:0x%" PRIx64 ", the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), taosArrayGetSize(ctx->pNames), pJob->viewNum); return TSDB_CODE_SUCCESS; @@ -552,7 +552,7 @@ int32_t ctgInitGetTbTSMATask(SCtgJob* pJob, int32_t taskId, void* param) { pTaskCtx->pNames = param; pTaskCtx->pResList = taosArrayInit(pJob->tbTsmaNum, sizeof(SMetaRes)); if (NULL == pTaskCtx->pResList) { - qError("QID:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum, + qError("QID:0x%" PRIx64 ", taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum, (int32_t)sizeof(SMetaRes)); ctgFreeTask(&task, true); CTG_ERR_RET(terrno); @@ -580,7 +580,7 @@ int32_t ctgInitGetTSMATask(SCtgJob* pJob, int32_t taskId, void* param) { pTaskCtx->pNames = param; pTaskCtx->pResList = taosArrayInit(pJob->tsmaNum, sizeof(SMetaRes)); if (NULL == pTaskCtx->pResList) { - qError("QID:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum, + qError("QID:0x%" PRIx64 ", taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum, (int32_t)sizeof(SMetaRes)); ctgFreeTask(&task, true); CTG_ERR_RET(terrno); @@ -609,7 +609,7 @@ static int32_t ctgInitGetTbNamesTask(SCtgJob* pJob, int32_t taskId, void* param) pTaskCtx->pNames = param; pTaskCtx->pResList = taosArrayInit(pJob->tbNameNum, sizeof(SMetaRes)); if (NULL == pTaskCtx->pResList) { - qError("QID:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbNameNum, + qError("QID:0x%" PRIx64 ", taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbNameNum, (int32_t)sizeof(SMetaRes)); ctgFreeTask(&task, true); CTG_ERR_RET(terrno); @@ -1478,16 +1478,16 @@ _return: int32_t ctgCallUserCb(void* param) { SCtgJob* pJob = (SCtgJob*)param; - qDebug("QID:0x%" PRIx64 " ctg start to call user cb with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode)); + qDebug("QID:0x%" PRIx64 ", ctg start to call user cb with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode)); (*pJob->userFp)(&pJob->jobRes, pJob->userParam, pJob->jobResCode); - qDebug("QID:0x%" PRIx64 " ctg end to call user cb", pJob->queryId); + qDebug("QID:0x%" PRIx64 ", ctg end to call user cb", pJob->queryId); int64_t refId = pJob->refId; int32_t code = taosRemoveRef(gCtgMgmt.jobPool, refId); if (code) { - qError("QID:0x%" PRIx64 " remove ctg job %" PRId64 " from jobPool failed, error:%s", pJob->queryId, refId, + qError("QID:0x%" PRIx64 ", remove ctg job %" PRId64 " from jobPool failed, error:%s", pJob->queryId, refId, tstrerror(code)); } @@ -1498,7 +1498,7 @@ void ctgUpdateJobErrCode(SCtgJob* pJob, int32_t errCode) { if (!NEED_CLIENT_REFRESH_VG_ERROR(errCode) || errCode == TSDB_CODE_SUCCESS) return; atomic_store_32(&pJob->jobResCode, errCode); - qDebug("QID:0x%" PRIx64 " ctg job errCode updated to %s", pJob->queryId, tstrerror(errCode)); + qDebug("QID:0x%" PRIx64 ", ctg job errCode updated to %s", pJob->queryId, tstrerror(errCode)); return; } @@ -1510,7 +1510,7 @@ int32_t ctgHandleTaskEnd(SCtgTask* pTask, int32_t rspCode) { return TSDB_CODE_SUCCESS; } - qDebug("QID:0x%" PRIx64 " task %d end with res %s", pJob->queryId, pTask->taskId, tstrerror(rspCode)); + qDebug("QID:0x%" PRIx64 ", task %d end with res %s", pJob->queryId, pTask->taskId, tstrerror(rspCode)); pTask->code = rspCode; pTask->status = CTG_TASK_DONE; @@ -1519,7 +1519,7 @@ int32_t ctgHandleTaskEnd(SCtgTask* pTask, int32_t rspCode) { int32_t taskDone = atomic_add_fetch_32(&pJob->taskDone, 1); if (taskDone < taosArrayGetSize(pJob->pTasks)) { - qDebug("QID:0x%" PRIx64 " task done: %d, total: %d", pJob->queryId, taskDone, + qDebug("QID:0x%" PRIx64 ", task done: %d, total: %d", pJob->queryId, taskDone, (int32_t)taosArrayGetSize(pJob->pTasks)); ctgUpdateJobErrCode(pJob, rspCode); @@ -4374,7 +4374,7 @@ int32_t ctgLaunchJob(SCtgJob* pJob) { CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); } - qDebug("QID:0x%" PRIx64 " ctg launch [%dth] task", pJob->queryId, pTask->taskId); + qDebug("QID:0x%" PRIx64 ", ctg launch [%dth] task", pJob->queryId, pTask->taskId); CTG_ERR_RET((*gCtgAsyncFps[pTask->type].launchFp)(pTask)); pTask = taosArrayGet(pJob->pTasks, i); @@ -4387,7 +4387,7 @@ int32_t ctgLaunchJob(SCtgJob* pJob) { } if (taskNum <= 0) { - qDebug("QID:0x%" PRIx64 " ctg call user callback with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode)); + qDebug("QID:0x%" PRIx64 ", ctg call user callback with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode)); CTG_ERR_RET(taosAsyncExec(ctgCallUserCb, pJob, NULL)); #if CTG_BATCH_FETCH diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 251f8b806c..e5c7750ddc 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -48,7 +48,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu msgNum = 0; } - ctgDebug("QID:0x%" PRIx64 " ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId, + ctgDebug("QID:0x%" PRIx64 ", ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId, TMSG_INFO(cbParam->reqType + 1)); SHashObj* pBatchs = taosHashInit(taskNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); @@ -115,7 +115,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu pMsgCtx->pBatchs = pBatchs; - ctgDebug("QID:0x%" PRIx64 " ctg task %d idx %d start to handle rsp %s, pBatchs: %p", pJob->queryId, pTask->taskId, + ctgDebug("QID:0x%" PRIx64 ", ctg task %d idx %d start to handle rsp %s, pBatchs: %p", pJob->queryId, pTask->taskId, pRsp->msgIdx, TMSG_INFO(taskMsg.msgType + 1), pBatchs); (void)(*gCtgAsyncFps[pTask->type].handleRspFp)( @@ -455,7 +455,7 @@ int32_t ctgHandleMsgCallback(void* param, SDataBuf* pMsg, int32_t rspCode) { CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); } - qDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId, + qDebug("QID:0x%" PRIx64 ", ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId, TMSG_INFO(cbParam->reqType + 1)); #if CTG_BATCH_FETCH @@ -810,7 +810,7 @@ int32_t ctgLaunchBatchs(SCatalog* pCtg, SCtgJob* pJob, SHashObj* pBatchs) { SCtgBatch* pBatch = (SCtgBatch*)p; int32_t msgSize = 0; - ctgDebug("QID:0x%" PRIx64 " ctg start to launch batch %d", pJob->queryId, pBatch->batchId); + ctgDebug("QID:0x%" PRIx64 ", ctg start to launch batch %d", pJob->queryId, pBatch->batchId); CTG_ERR_JRET(ctgBuildBatchReqMsg(pBatch, *vgId, &msg, &msgSize)); code = ctgAsyncSendMsg(pCtg, &pBatch->conn, pJob, pBatch->pTaskIds, pBatch->batchId, pBatch->pMsgIdxs, diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index ee460e2610..6706d22147 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -37,7 +37,7 @@ static int32_t dumpQueryPlan(SQueryPlan* pPlan) { char* pStr = NULL; code = nodesNodeToString((SNode*)pPlan, false, &pStr, NULL); if (TSDB_CODE_SUCCESS == code) { - planDebugL("QID:0x%" PRIx64 " Query Plan, JsonPlan: %s", pPlan->queryId, pStr); + planDebugL("QID:0x%" PRIx64 ", Query Plan, JsonPlan: %s", pPlan->queryId, pStr); taosMemoryFree(pStr); } return code; @@ -123,7 +123,7 @@ int32_t qContinuePlanPostQuery(void* pPostPlan) { } int32_t qSetSubplanExecutionNode(SSubplan* subplan, int32_t groupId, SDownstreamSourceNode* pSource) { - planDebug("QID:0x%" PRIx64 " set subplan execution node, groupId:%d", subplan->id.queryId, groupId); + planDebug("QID:0x%" PRIx64 ", set subplan execution node, groupId:%d", subplan->id.queryId, groupId); return setSubplanExecutionNode(subplan->pNode, groupId, pSource); } @@ -143,7 +143,7 @@ static void clearSubplanExecutionNode(SPhysiNode* pNode) { } void qClearSubplanExecutionNode(SSubplan* pSubplan) { - planDebug("QID:0x%" PRIx64 " clear subplan execution node, groupId:%d", pSubplan->id.queryId, pSubplan->id.groupId); + planDebug("QID:0x%" PRIx64 ", clear subplan execution node, groupId:%d", pSubplan->id.queryId, pSubplan->id.groupId); clearSubplanExecutionNode(pSubplan->pNode); } diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c index 2777425365..e430990c0d 100644 --- a/source/libs/qworker/src/qwDbg.c +++ b/source/libs/qworker/src/qwDbg.c @@ -187,7 +187,7 @@ void qwDbgDumpJobsInfo(void) { int32_t jobIdx = 0; SQWJobInfo* pJob = (SQWJobInfo*)taosHashIterate(gQueryMgmt.pJobInfo, NULL); while (NULL != pJob) { - qDebug("QID:0x%" PRIx64 " CID:0x%" PRIx64 " the %dth remain job", pJob->memInfo->jobId, pJob->memInfo->clientId, jobIdx++); + qDebug("QID:0x%" PRIx64 ", CID:0x%" PRIx64 " the %dth remain job", pJob->memInfo->jobId, pJob->memInfo->clientId, jobIdx++); int32_t sessionIdx = 0; SQWSessionInfo* pSession = (SQWSessionInfo*)taosHashIterate(pJob->pSessions, NULL); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 2b66db772a..14839b74b3 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -1699,18 +1699,18 @@ void qWorkerRetireJob(uint64_t jobId, uint64_t clientId, int32_t errCode) { SQWJobInfo *pJob = (SQWJobInfo *)taosHashGet(gQueryMgmt.pJobInfo, id, sizeof(id)); if (NULL == pJob) { - qError("QID:0x%" PRIx64 " CID:0x%" PRIx64 " fail to get job from job hash", jobId, clientId); + qError("QID:0x%" PRIx64 ", CID:0x%" PRIx64 " fail to get job from job hash", jobId, clientId); return; } if (0 == atomic_val_compare_exchange_32(&pJob->errCode, 0, errCode) && 0 == atomic_val_compare_exchange_8(&pJob->retired, 0, 1)) { - qDebug("QID:0x%" PRIx64 " CID:0x%" PRIx64 " mark retired, errCode: 0x%x, allocSize:%" PRId64, jobId, clientId, + qDebug("QID:0x%" PRIx64 ", CID:0x%" PRIx64 " mark retired, errCode: 0x%x, allocSize:%" PRId64, jobId, clientId, errCode, atomic_load_64(&pJob->memInfo->allocMemSize)); (void)qwRetireJob(pJob); } else { - qDebug("QID:0x%" PRIx64 " already retired, retired: %d, errCode: 0x%x, allocSize:%" PRId64, jobId, + qDebug("QID:0x%" PRIx64 ", already retired, retired: %d, errCode: 0x%x, allocSize:%" PRId64, jobId, atomic_load_8(&pJob->retired), atomic_load_32(&pJob->errCode), atomic_load_64(&pJob->memInfo->allocMemSize)); } } @@ -1741,10 +1741,10 @@ void qWorkerRetireJobs(int64_t retireSize, int32_t errCode) { jobNum++; - qDebug("QID:0x%" PRIx64 " CID:0x%" PRIx64 " job mark retired in batch, retired:%d, usedSize:%" PRId64 ", retireSize:%" PRId64, + qDebug("QID:0x%" PRIx64 ", CID:0x%" PRIx64 " job mark retired in batch, retired:%d, usedSize:%" PRId64 ", retireSize:%" PRId64, pJob->memInfo->jobId, pJob->memInfo->clientId, retired, aSize, retireSize); } else { - qDebug("QID:0x%" PRIx64 " CID:0x%" PRIx64 " job may already failed, errCode:%s", pJob->memInfo->jobId, pJob->memInfo->clientId, tstrerror(pJob->errCode)); + qDebug("QID:0x%" PRIx64 ", CID:0x%" PRIx64 " job may already failed, errCode:%s", pJob->memInfo->jobId, pJob->memInfo->clientId, tstrerror(pJob->errCode)); } pJob = (SQWJobInfo *)taosHashIterate(gQueryMgmt.pJobInfo, pJob); diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index ddae00bd18..4e44c52d70 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -462,23 +462,23 @@ extern SSchedulerMgmt schMgmt; (_task)->profile.endTs = us; \ } while (0) -#define SCH_JOB_ELOG(param, ...) qError("QID:0x%" PRIx64 ", SID:%" PRId64 " " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) -#define SCH_JOB_DLOG(param, ...) qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 " " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) +#define SCH_JOB_ELOG(param, ...) qError("QID:0x%" PRIx64 ", SID:%" PRId64 ", " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) +#define SCH_JOB_DLOG(param, ...) qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 ", " param, pJob->queryId, pJob->seriousId, __VA_ARGS__) #define SCH_TASK_ELOG(param, ...) \ - qError("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qError("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d, " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_DLOG(param, ...) \ - qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qDebug("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d, " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_TLOG(param, ...) \ - qTrace("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qTrace("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d, " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_DLOGL(param, ...) \ - qDebugL("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qDebugL("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d, " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_TASK_WLOG(param, ...) \ - qWarn("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ + qWarn("QID:0x%" PRIx64 ", SID:%" PRId64 ", CID:0x%" PRIx64 ", TID:0x%" PRIx64 ", EID:%d, " param, pJob->queryId, pJob->seriousId, SCH_CLIENT_ID(pTask), \ SCH_TASK_ID(pTask), SCH_TASK_EID(pTask), __VA_ARGS__) #define SCH_SET_ERRNO(_err) \ diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index ce2930819e..e8135efce5 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -758,7 +758,7 @@ void schFreeJobImpl(void *job) { uint64_t queryId = pJob->queryId; int64_t refId = pJob->refId; - qDebug("QID:0x%" PRIx64 " begin to free sch job, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); + qDebug("QID:0x%" PRIx64 ", begin to free sch job, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); schDropJobAllTasks(pJob); @@ -818,7 +818,7 @@ void schFreeJobImpl(void *job) { } } - qDebug("QID:0x%" PRIx64 " sch job freed, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); + qDebug("QID:0x%" PRIx64 ", sch job freed, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); } int32_t schJobFetchRows(SSchJob *pJob) { @@ -853,7 +853,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { int64_t refId = -1; SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); if (NULL == pJob) { - qError("QID:0x%" PRIx64 " calloc %d failed", pReq->pDag->queryId, (int32_t)sizeof(SSchJob)); + qError("QID:0x%" PRIx64 ", calloc %d failed", pReq->pDag->queryId, (int32_t)sizeof(SSchJob)); SCH_ERR_JRET(terrno); } @@ -863,7 +863,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { if (pReq->sql) { pJob->sql = taosStrdup(pReq->sql); if (NULL == pJob->sql) { - qError("QID:0x%" PRIx64 " strdup sql %s failed", pReq->pDag->queryId, pReq->sql); + qError("QID:0x%" PRIx64 ", strdup sql %s failed", pReq->pDag->queryId, pReq->sql); SCH_ERR_JRET(terrno); } } @@ -871,7 +871,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { if (pReq->allocatorRefId > 0) { pJob->allocatorRefId = nodesMakeAllocatorWeakRef(pReq->allocatorRefId); if (pJob->allocatorRefId <= 0) { - qError("QID:0x%" PRIx64 " nodesMakeAllocatorWeakRef failed", pReq->pDag->queryId); + qError("QID:0x%" PRIx64 ", nodesMakeAllocatorWeakRef failed", pReq->pDag->queryId); SCH_ERR_JRET(terrno); } } @@ -883,11 +883,11 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { pJob->pWorkerCb = pReq->pWorkerCb; if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) { - qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId); + qDebug("QID:0x%" PRIx64 ", input exec nodeList is empty", pReq->pDag->queryId); } else { pJob->nodeList = taosArrayDup(pReq->pNodeList, NULL); if (NULL == pJob->nodeList) { - qError("QID:0x%" PRIx64 " taosArrayDup failed, origNum:%d", pReq->pDag->queryId, + qError("QID:0x%" PRIx64 ", taosArrayDup failed, origNum:%d", pReq->pDag->queryId, (int32_t)taosArrayGetSize(pReq->pNodeList)); SCH_ERR_JRET(terrno); } @@ -950,7 +950,7 @@ _return: int32_t schExecJob(SSchJob *pJob, SSchedulerReq *pReq) { int32_t code = 0; - qDebug("QID:0x%" PRIx64 " sch job refId 0x%" PRIx64 " started", pReq->pDag->queryId, pJob->refId); + qDebug("QID:0x%" PRIx64 ", sch job refId 0x%" PRIx64 " started", pReq->pDag->queryId, pJob->refId); SCH_ERR_RET(schLaunchJob(pJob)); @@ -958,7 +958,7 @@ int32_t schExecJob(SSchJob *pJob, SSchedulerReq *pReq) { SCH_JOB_DLOG("sync wait for rsp now, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); code = tsem_wait(&pJob->rspSem); if (code) { - qError("QID:0x%" PRIx64 " tsem_wait sync rspSem failed, error:%s", pReq->pDag->queryId, tstrerror(code)); + qError("QID:0x%" PRIx64 ", tsem_wait sync rspSem failed, error:%s", pReq->pDag->queryId, tstrerror(code)); SCH_ERR_RET(code); } } diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index 1eb7dd5281..7a95087c07 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -23,7 +23,7 @@ #include "trpc.h" FORCE_INLINE int32_t schAcquireJob(int64_t refId, SSchJob **ppJob) { - qDebug("sch acquire jobId:0x%" PRIx64, refId); + qTrace("sch acquire jobId:0x%" PRIx64, refId); *ppJob = (SSchJob *)taosAcquireRef(schMgmt.jobRef, refId); if (NULL == *ppJob) { return terrno; @@ -37,7 +37,7 @@ FORCE_INLINE int32_t schReleaseJob(int64_t refId) { return TSDB_CODE_SUCCESS; } - qDebug("sch release jobId:0x%" PRIx64, refId); + qTrace("sch release jobId:0x%" PRIx64, refId); return taosReleaseRef(schMgmt.jobRef, refId); } @@ -46,7 +46,7 @@ FORCE_INLINE int32_t schReleaseJobEx(int64_t refId, int32_t *released) { return TSDB_CODE_SUCCESS; } - qDebug("sch release ex jobId:0x%" PRIx64, refId); + qTrace("sch release ex jobId:0x%" PRIx64, refId); return taosReleaseRefEx(schMgmt.jobRef, refId, released); } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 21659d9cd5..f99fe112de 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -224,7 +224,7 @@ int32_t schedulerValidatePlan(SQueryPlan* pPlan) { int32_t code = TSDB_CODE_SUCCESS; SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); if (NULL == pJob) { - qError("QID:0x%" PRIx64 " calloc %d failed", pPlan->queryId, (int32_t)sizeof(SSchJob)); + qError("QID:0x%" PRIx64 ", calloc %d failed", pPlan->queryId, (int32_t)sizeof(SSchJob)); SCH_ERR_RET(terrno); } From 61e0e77dcf3ac437f5fec57b411341c29ed96b97 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 16:15:21 +0800 Subject: [PATCH 14/22] enh: adjust log format --- source/libs/transport/src/transCli.c | 202 +++++++++++++-------------- source/libs/transport/src/transSvr.c | 116 +++++++-------- 2 files changed, 159 insertions(+), 159 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 4236d4e171..9d8d096677 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -388,7 +388,7 @@ int32_t cliGetConnTimer(SCliThrd* pThrd, SCliConn* pConn) { tDebug("no available timer, create a timer %p", timer); int ret = uv_timer_init(pThrd->loop, timer); if (ret != 0) { - tError("conn %p failed to init timer %p since %s", pConn, timer, uv_err_name(ret)); + tError("conn:%p, failed to init timer %p since %s", pConn, timer, uv_err_name(ret)); return TSDB_CODE_THIRDPARTY_ERROR; } } @@ -400,11 +400,11 @@ void cliResetConnTimer(SCliConn* conn) { SCliThrd* pThrd = conn->hostThrd; if (conn->timer) { if (uv_is_active((uv_handle_t*)conn->timer)) { - tDebug("%s conn %p stop timer", CONN_GET_INST_LABEL(conn), conn); + tDebug("%s conn:%p, stop timer", CONN_GET_INST_LABEL(conn), conn); TAOS_UNUSED(uv_timer_stop(conn->timer)); } if (taosArrayPush(pThrd->timerList, &conn->timer) == NULL) { - tError("%s conn %p failed to push timer %p to list since %s", CONN_GET_INST_LABEL(conn), conn, conn->timer, + tError("%s conn:%p, failed to push timer %p to list since %s", CONN_GET_INST_LABEL(conn), conn, conn->timer, tstrerror(terrno)); } conn->timer->data = NULL; @@ -435,7 +435,7 @@ void cliConnMayUpdateTimer(SCliConn* conn, int64_t timeout) { } int ret = uv_timer_start(conn->timer, cliConnTimeout__checkReq, timeout, 0); if (ret != 0) { - tError("%s conn %p failed to start timer %p since %s", CONN_GET_INST_LABEL(conn), conn, conn->timer, + tError("%s conn:%p, failed to start timer %p since %s", CONN_GET_INST_LABEL(conn), conn, conn->timer, uv_err_name(ret)); } } @@ -493,7 +493,7 @@ int8_t cliMayRecycleConn(SCliConn* conn) { SCliThrd* pThrd = conn->hostThrd; STrans* pInst = pThrd->pInst; - tTrace("%s conn %p in-process req summary:reqsToSend:%d, reqsSentOut:%d, statusTableSize:%d", + tTrace("%s conn:%p, in-process req summary:reqsToSend:%d, reqsSentOut:%d, statusTableSize:%d", CONN_GET_INST_LABEL(conn), conn, transQueueSize(&conn->reqsToSend), transQueueSize(&conn->reqsSentOut), taosHashGetSize(conn->pQTable)); @@ -503,14 +503,14 @@ int8_t cliMayRecycleConn(SCliConn* conn) { conn->forceDelFromHeap = 1; code = delConnFromHeapCache(pThrd->connHeapCache, conn); if (code == TSDB_CODE_RPC_ASYNC_IN_PROCESS) { - tDebug("%s conn %p failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn, + tDebug("%s conn:%p, failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); TAOS_UNUSED(transHeapMayBalance(conn->heap, conn)); return 1; } else { if (code != 0) { - tDebug("%s conn %p failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn, + tDebug("%s conn:%p, failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); return 0; } @@ -519,10 +519,10 @@ int8_t cliMayRecycleConn(SCliConn* conn) { return 1; } else if ((transQueueSize(&conn->reqsToSend) == 0) && (transQueueSize(&conn->reqsSentOut) == 0) && (taosHashGetSize(conn->pQTable) != 0)) { - tDebug("%s conn %p do balance directly", CONN_GET_INST_LABEL(conn), conn); + tDebug("%s conn:%p, do balance directly", CONN_GET_INST_LABEL(conn), conn); TAOS_UNUSED(transHeapMayBalance(conn->heap, conn)); } else { - tTrace("%s conn %p may do balance", CONN_GET_INST_LABEL(conn), conn); + tTrace("%s conn:%p, may do balance", CONN_GET_INST_LABEL(conn), conn); TAOS_UNUSED(transHeapMayBalance(conn->heap, conn)); } return 0; @@ -573,12 +573,12 @@ int8_t cliMayNotifyUserOnRecvReleaseExcept(SCliConn* conn, STransMsgHead* pHead, STraceId* trace = &pHead->traceId; code = cliBuildExceptResp(pThrd, pReq, &resp); if (code != 0) { - tGWarn("%s conn %p failed to build except resp for req:%" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, qId, + tGWarn("%s conn:%p, failed to build except resp for req:%" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, qId, tstrerror(code)); } code = cliNotifyCb(conn, NULL, &resp); if (code != 0) { - tGWarn("%s conn %p failed to notify user for req:%" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, qId, + tGWarn("%s conn:%p, failed to notify user for req:%" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, qId, tstrerror(code)); } @@ -593,7 +593,7 @@ int32_t cliHandleState_mayHandleReleaseResp(SCliConn* conn, STransMsgHead* pHead int64_t qId = taosHton64(pHead->qid); STraceId* trace = &pHead->traceId; int64_t seqNum = taosHton64(pHead->seqNum); - tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, seqNum:%" PRId64 ", sid:%" PRId64 "", + tGDebug("%s conn:%p, %s received from %s, local info:%s, len:%d, seqNum:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), conn->dst, conn->src, pHead->msgLen, seqNum, qId); @@ -602,12 +602,12 @@ int32_t cliHandleState_mayHandleReleaseResp(SCliConn* conn, STransMsgHead* pHead code = taosHashRemove(conn->pQTable, &qId, sizeof(qId)); if (code != 0) { - tDebug("%s conn %p failed to release req:%" PRId64 " from conn", CONN_GET_INST_LABEL(conn), conn, qId); + tDebug("%s conn:%p, failed to release req:%" PRId64 " from conn", CONN_GET_INST_LABEL(conn), conn, qId); } code = taosHashRemove(pThrd->pIdConnTable, &qId, sizeof(qId)); if (code != 0) { - tDebug("%s conn %p failed to release req:%" PRId64 " from thrd ", CONN_GET_INST_LABEL(conn), conn, qId); + tDebug("%s conn:%p, failed to release req:%" PRId64 " from thrd ", CONN_GET_INST_LABEL(conn), conn, qId); } tDebug("%s %p reqToSend:%d, sentOut:%d", CONN_GET_INST_LABEL(conn), conn, transQueueSize(&conn->reqsToSend), @@ -653,7 +653,7 @@ int32_t cliHandleState_mayCreateAhandle(SCliConn* conn, STransMsgHead* pHead, ST pCtx->st = taosGetTimestampUs(); STraceId* trace = &pHead->traceId; pResp->info.ahandle = transCtxDumpVal(pCtx, pHead->msgType); - tGDebug("%s conn %p %s received from %s, local info:%s, sid:%" PRId64 ", create ahandle %p by %s", + tGDebug("%s conn:%p, %s received from %s, local info:%s, sid:%" PRId64 ", create ahandle %p by %s", CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), conn->dst, conn->src, qId, pResp->info.ahandle, TMSG_INFO(pHead->msgType)); return 0; @@ -677,17 +677,17 @@ void cliHandleResp(SCliConn* conn) { int32_t msgLen = transDumpFromBuffer(&conn->readBuf, (char**)&pHead, 0); if (msgLen < 0) { taosMemoryFree(pHead); - tWarn("%s conn %p recv invalid packet", CONN_GET_INST_LABEL(conn), conn); + tWarn("%s conn:%p, recv invalid packet", CONN_GET_INST_LABEL(conn), conn); // TODO: notify cb code = pThrd->notifyExceptCb(pThrd, NULL, NULL); if (code != 0) { - tError("%s conn %p failed to notify user since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tError("%s conn:%p, failed to notify user since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } return; } if ((code = transDecompressMsg((char**)&pHead, &msgLen)) < 0) { - tDebug("%s conn %p recv invalid packet, failed to decompress", CONN_GET_INST_LABEL(conn), conn); + tDebug("%s conn:%p, recv invalid packet, failed to decompress", CONN_GET_INST_LABEL(conn), conn); // TODO: notify cb return; } @@ -712,7 +712,7 @@ void cliHandleResp(SCliConn* conn) { return; } if (code != 0) { - tWarn("%s conn %p recv unexpected packet, msgType:%s, seqNum:%" PRId64 ", sid:%" PRId64 + tWarn("%s conn:%p, recv unexpected packet, msgType:%s, seqNum:%" PRId64 ", sid:%" PRId64 ", the sever may sends repeated response since %s", CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), seq, qId, tstrerror(code)); // TODO: notify cb @@ -725,7 +725,7 @@ void cliHandleResp(SCliConn* conn) { } else { code = cliHandleState_mayUpdateStateTime(conn, pReq); if (code != 0) { - tDebug("%s conn %p failed to update state time sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, qId, + tDebug("%s conn:%p, failed to update state time sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, qId, tstrerror(code)); } } @@ -733,7 +733,7 @@ void cliHandleResp(SCliConn* conn) { code = cliBuildRespFromCont(pReq, &resp, pHead); STraceId* trace = &resp.info.traceId; - tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, seq:%" PRId64 ", sid:%" PRId64 ", code:%s", + tGDebug("%s conn:%p, %s received from %s, local info:%s, len:%d, seq:%" PRId64 ", sid:%" PRId64 ", code:%s", CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(resp.msgType), conn->dst, conn->src, pHead->msgLen, seq, qId, tstrerror(pHead->code)); code = cliNotifyCb(conn, pReq, &resp); @@ -760,7 +760,7 @@ void cliConnTimeout(uv_timer_t* handle) { } cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr); - tTrace("%s conn %p failed to connect %s since conn timeout", CONN_GET_INST_LABEL(conn), conn, conn->dstAddr); + tTrace("%s conn:%p, failed to connect %s since conn timeout", CONN_GET_INST_LABEL(conn), conn, conn->dstAddr); TAOS_UNUSED(transUnrefCliHandle(conn)); } @@ -899,7 +899,7 @@ static int32_t cliGetConnFromPool(SCliThrd* pThrd, const char* key, SCliConn** p transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, task); } - tDebug("conn %p get from pool, pool size:%d, dst:%s", conn, conn->list->size, conn->dstAddr); + tDebug("conn:%p, get from pool, pool size:%d, dst:%s", conn, conn->list->size, conn->dstAddr); *ppConn = conn; return 0; @@ -941,7 +941,7 @@ static void addConnToPool(void* pool, SCliConn* conn) { QUEUE_INIT(&conn->q); QUEUE_PUSH(&conn->list->conns, &conn->q); conn->list->size += 1; - tDebug("conn %p added to pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr); + tDebug("conn:%p, added to pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr); conn->heapMissHit = 0; @@ -961,7 +961,7 @@ static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_ SConnBuffer* pBuf = &conn->readBuf; int32_t code = transAllocBuffer(pBuf, buf); if (code < 0) { - tError("conn %p failed to alloc buffer, since %s", conn, tstrerror(code)); + tError("conn:%p, failed to alloc buffer, since %s", conn, tstrerror(code)); } } static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { @@ -975,14 +975,14 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { SCliConn* conn = handle->data; code = transSetReadOption((uv_handle_t*)handle); if (code != 0) { - tWarn("%s conn %p failed to set recv opt since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tWarn("%s conn:%p, failed to set recv opt since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } SConnBuffer* pBuf = &conn->readBuf; if (nread > 0) { pBuf->len += nread; while (transReadComplete(pBuf)) { - tTrace("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn); + tTrace("%s conn:%p, read complete", CONN_GET_INST_LABEL(conn), conn); if (pBuf->invalid) { conn->broken = true; TAOS_UNUSED(transUnrefCliHandle(conn)); @@ -999,11 +999,11 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { // ref http://docs.libuv.org/en/v1.x/stream.html?highlight=uv_read_start#c.uv_read_cb // nread might be 0, which does not indicate an error or EOF. This is equivalent to EAGAIN or EWOULDBLOCK under // read(2). - tTrace("%s conn %p read empty", CONN_GET_INST_LABEL(conn), conn); + tTrace("%s conn:%p, read empty", CONN_GET_INST_LABEL(conn), conn); return; } if (nread < 0) { - tDebug("%s conn %p read error:%s, ref:%d", CONN_GET_INST_LABEL(conn), conn, uv_err_name(nread), + tDebug("%s conn:%p, read error:%s, ref:%d", CONN_GET_INST_LABEL(conn), conn, uv_err_name(nread), transGetRefCount(conn)); conn->broken = true; TAOS_UNUSED(transUnrefCliHandle(conn)); @@ -1136,10 +1136,10 @@ static void cliDestroyAllQidFromThrd(SCliConn* conn) { code = taosHashRemove(pThrd->pIdConnTable, qid, sizeof(*qid)); if (code != 0) { - tDebug("%s conn %p failed to remove state %" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, *qid, + tDebug("%s conn:%p, failed to remove state %" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, *qid, tstrerror(code)); } else { - tDebug("%s conn %p destroy sid::%" PRId64 "", CONN_GET_INST_LABEL(conn), conn, *qid); + tDebug("%s conn:%p, destroy sid::%" PRId64 "", CONN_GET_INST_LABEL(conn), conn, *qid); } STransCtx* ctx = pIter; @@ -1163,17 +1163,17 @@ static void cliDestroy(uv_handle_t* handle) { SCliThrd* pThrd = conn->hostThrd; cliResetConnTimer(conn); - tDebug("%s conn %p try to destroy", CONN_GET_INST_LABEL(conn), conn); + tDebug("%s conn:%p, try to destroy", CONN_GET_INST_LABEL(conn), conn); code = destroyAllReqs(conn); if (code != 0) { - tDebug("%s conn %p failed to all reqs since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tDebug("%s conn:%p, failed to all reqs since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } conn->forceDelFromHeap = 1; code = delConnFromHeapCache(pThrd->connHeapCache, conn); if (code != 0) { - tDebug("%s conn %p failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tDebug("%s conn:%p, failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } taosMemoryFree(conn->dstAddr); @@ -1190,7 +1190,7 @@ static void cliDestroy(uv_handle_t* handle) { destroyWQ(&conn->wq); transDestroyBuffer(&conn->readBuf); - tTrace("%s conn %p destroy successfully", CONN_GET_INST_LABEL(conn), conn); + tTrace("%s conn:%p, destroy successfully", CONN_GET_INST_LABEL(conn), conn); taosMemoryFree(conn); } @@ -1217,12 +1217,12 @@ static void notifyAndDestroyReq(SCliConn* pConn, SCliReq* pReq, int32_t code) { } STraceId* trace = &resp.info.traceId; - tDebug("%s conn %p notify user and destroy msg %s since %s", CONN_GET_INST_LABEL(pConn), pConn, + tDebug("%s conn:%p, notify user and destroy msg %s since %s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pReq->msg.msgType), tstrerror(resp.code)); // handle noresp and inter manage msg if (pCtx == NULL || REQUEST_NO_RESP(&pReq->msg)) { - tDebug("%s conn %p destroy %s msg directly since %s", CONN_GET_INST_LABEL(pConn), pConn, + tDebug("%s conn:%p, destroy %s msg directly since %s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pReq->msg.msgType), tstrerror(resp.code)); destroyReq(pReq); return; @@ -1271,7 +1271,7 @@ static void cliHandleException(SCliConn* conn) { cliResetConnTimer(conn); code = destroyAllReqs(conn); if (code != 0) { - tError("%s conn %p failed to destroy all reqs on conn since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tError("%s conn:%p, failed to destroy all reqs on conn since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } cliDestroyAllQidFromThrd(conn); @@ -1288,13 +1288,13 @@ static void cliHandleException(SCliConn* conn) { conn->forceDelFromHeap = 1; code = delConnFromHeapCache(pThrd->connHeapCache, conn); if (code != 0) { - tError("%s conn %p failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tError("%s conn:%p, failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } if (conn->registered) { int8_t ref = transGetRefCount(conn); if (ref == 0 && !uv_is_closing((uv_handle_t*)conn->stream)) { - // tTrace("%s conn %p fd %d,%d,%d,%p uv_closed", CONN_GET_INST_LABEL(conn), conn, conn->stream->u.fd, + // tTrace("%s conn:%p, fd %d,%d,%d,%p uv_closed", CONN_GET_INST_LABEL(conn), conn, conn->stream->u.fd, // conn->stream->io_watcher.fd, conn->stream->accepted_fd, conn->stream->queued_fds); uv_close((uv_handle_t*)conn->stream, cliDestroy); } @@ -1346,7 +1346,7 @@ static void cliBatchSendCb(uv_write_t* req, int status) { cliConnRmReqs(conn); if (status != 0) { - tDebug("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(conn), conn, uv_err_name(status)); + tDebug("%s conn:%p, failed to send msg since %s", CONN_GET_INST_LABEL(conn), conn, uv_err_name(status)); TAOS_UNUSED(transUnrefCliHandle(conn)); return; } @@ -1355,7 +1355,7 @@ static void cliBatchSendCb(uv_write_t* req, int status) { if (conn->readerStart == 0) { code = uv_read_start((uv_stream_t*)conn->stream, cliAllocRecvBufferCb, cliRecvCb); if (code != 0) { - tDebug("%s conn %p failed to start read since%s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tDebug("%s conn:%p, failed to start read since%s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); TAOS_UNUSED(transUnrefCliHandle(conn)); return; } @@ -1365,7 +1365,7 @@ static void cliBatchSendCb(uv_write_t* req, int status) { if (!cliMayRecycleConn(conn)) { code = cliBatchSend(conn, 1); if (code != 0) { - tDebug("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); + tDebug("%s conn:%p, failed to send msg since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); TAOS_UNUSED(transUnrefCliHandle(conn)); } } @@ -1435,7 +1435,7 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { } QUEUE_PUSH(&pThrd->batchSendSet, &pConn->batchSendq); pConn->inThreadSendq = 1; - tDebug("%s conn %p batch send later", pInst->label, pConn); + tDebug("%s conn:%p, batch send later", pInst->label, pConn); return 0; } @@ -1443,7 +1443,7 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { int32_t totalLen = 0; if (size == 0) { - tDebug("%s conn %p not msg to send", pInst->label, pConn); + tDebug("%s conn:%p, not msg to send", pInst->label, pConn); return 0; } uv_buf_t* wb = NULL; @@ -1520,7 +1520,7 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { pCliMsg->sent = 1; STraceId* trace = &pCliMsg->msg.info.traceId; - tGDebug("%s conn %p %s is sent to %s, local info:%s, seq:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), + tGDebug("%s conn:%p, %s is sent to %s, local info:%s, seq:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pReq->msgType), pConn->dst, pConn->src, pConn->seq, pReq->info.qId); transQueuePush(&pConn->reqsSentOut, &pCliMsg->q); @@ -1536,7 +1536,7 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { uv_write_t* req = allocWReqFromWQ(&pConn->wq, pConn); if (req == NULL) { - tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno)); + tError("%s conn:%p, failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno)); while (!QUEUE_IS_EMPTY(&reqToSend)) { queue* h = QUEUE_HEAD(&reqToSend); SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, sendQ); @@ -1550,11 +1550,11 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { SWReqsWrapper* pWreq = req->data; QUEUE_MOVE(&reqToSend, &pWreq->node); - tDebug("%s conn %p start to send msg, batch size:%d, len:%d", CONN_GET_INST_LABEL(pConn), pConn, j, totalLen); + tDebug("%s conn:%p, start to send msg, batch size:%d, len:%d", CONN_GET_INST_LABEL(pConn), pConn, j, totalLen); int32_t ret = uv_write(req, (uv_stream_t*)pConn->stream, wb, j, cliBatchSendCb); if (ret != 0) { - tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(ret)); + tError("%s conn:%p, failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(ret)); while (!QUEUE_IS_EMPTY(&pWreq->node)) { queue* h = QUEUE_HEAD(&pWreq->node); SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, sendQ); @@ -1617,23 +1617,23 @@ static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) { addr.sin_addr.s_addr = ipaddr; addr.sin_port = (uint16_t)htons(conn->port); - tTrace("%s conn %p try to connect to %s", pInst->label, conn, conn->dstAddr); + tTrace("%s conn:%p, try to connect to %s", pInst->label, conn, conn->dstAddr); int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd < 0) { TAOS_CHECK_GOTO(terrno, &lino, _exception1); } - tTrace("%s conn %p fd %d openend", pInst->label, conn, fd); + tTrace("%s conn:%p, fd %d openend", pInst->label, conn, fd); int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd); if (ret != 0) { - tError("%s conn %p failed to set stream since %s", transLabel(pInst), conn, uv_err_name(ret)); + tError("%s conn:%p, failed to set stream since %s", transLabel(pInst), conn, uv_err_name(ret)); TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1); } ret = transSetConnOption((uv_tcp_t*)conn->stream, 20); if (ret != 0) { - tError("%s conn %p failed to set socket opt since %s", transLabel(pInst), conn, uv_err_name(ret)); + tError("%s conn:%p, failed to set socket opt since %s", transLabel(pInst), conn, uv_err_name(ret)); TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1); return code; } @@ -1656,19 +1656,19 @@ static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) { transRefCliHandle(conn); ret = uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0); if (ret != 0) { - tError("%s conn %p failed to start timer since %s", transLabel(pInst), conn, uv_err_name(ret)); + tError("%s conn:%p, failed to start timer since %s", transLabel(pInst), conn, uv_err_name(ret)); TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception2); } return TSDB_CODE_RPC_ASYNC_IN_PROCESS; _exception1: - tError("%s conn %p failed to do connect since %s", transLabel(pInst), conn, tstrerror(code)); + tError("%s conn:%p, failed to do connect since %s", transLabel(pInst), conn, tstrerror(code)); cliDestroyConn(conn, true); return code; _exception2: TAOS_UNUSED(transUnrefCliHandle(conn)); - tError("%s conn %p failed to do connect since %s", transLabel(pInst), conn, tstrerror(code)); + tError("%s conn:%p, failed to do connect since %s", transLabel(pInst), conn, tstrerror(code)); return code; } @@ -1738,7 +1738,7 @@ void cliConnCb(uv_connect_t* req, int status) { STUB_RAND_NETWORK_ERR(status); if (status != 0) { - tError("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr, + tError("%s conn:%p, failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr, uv_strerror(status)); cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, pConn->dstAddr); TAOS_UNUSED(transUnrefCliHandle(pConn)); @@ -1747,14 +1747,14 @@ void cliConnCb(uv_connect_t* req, int status) { pConn->connnected = 1; code = cliConnSetSockInfo(pConn); if (code != 0) { - tDebug("%s conn %p failed to get sock info since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code)); + tDebug("%s conn:%p, failed to get sock info since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code)); TAOS_UNUSED(transUnrefCliHandle(pConn)); } - tTrace("%s conn %p connect to server successfully", CONN_GET_INST_LABEL(pConn), pConn); + tTrace("%s conn:%p, connect to server successfully", CONN_GET_INST_LABEL(pConn), pConn); code = cliBatchSend(pConn, 1); if (code != 0) { - tDebug("%s conn %p failed to get sock info since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code)); + tDebug("%s conn:%p, failed to get sock info since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code)); TAOS_UNUSED(transUnrefCliHandle(pConn)); } } @@ -1952,7 +1952,7 @@ int32_t cliHandleState_mayUpdateStateCtx(SCliConn* pConn, SCliReq* pReq) { SReqCtx* pCtx = pReq->ctx; SCliThrd* pThrd = pConn->hostThrd; if (pCtx == NULL) { - tDebug("%s conn %p not need to update statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); + tDebug("%s conn:%p, not need to update statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); return 0; } @@ -1960,11 +1960,11 @@ int32_t cliHandleState_mayUpdateStateCtx(SCliConn* pConn, SCliReq* pReq) { if (pUserCtx == NULL) { pCtx->userCtx.st = taosGetTimestampUs(); code = taosHashPut(pConn->pQTable, &qid, sizeof(qid), &pCtx->userCtx, sizeof(pCtx->userCtx)); - tDebug("%s conn %p succ to add statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); + tDebug("%s conn:%p, succ to add statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); } else { transCtxMerge(pUserCtx, &pCtx->userCtx); pUserCtx->st = taosGetTimestampUs(); - tDebug("%s conn %p succ to update statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); + tDebug("%s conn:%p, succ to update statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); } return 0; } @@ -1987,12 +1987,12 @@ int32_t cliMayGetStateByQid(SCliThrd* pThrd, SCliReq* pReq, SCliConn** pConn) { transReleaseExHandle(transGetRefMgt(), qid); return TSDB_CODE_RPC_STATE_DROPED; } - tDebug("%s conn %p failed to get statue, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); + tDebug("%s conn:%p, failed to get statue, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); transReleaseExHandle(transGetRefMgt(), qid); return TSDB_CODE_RPC_ASYNC_IN_PROCESS; } else { *pConn = pState->conn; - tDebug("%s conn %p succ to get conn of statue, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); + tDebug("%s conn:%p, succ to get conn of statue, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid); } transReleaseExHandle(transGetRefMgt(), qid); return 0; @@ -2010,10 +2010,10 @@ int32_t cliHandleState_mayUpdateState(SCliConn* pConn, SCliReq* pReq) { SReqState state = {.conn = pConn, .arg = NULL}; code = taosHashPut(pThrd->pIdConnTable, &qid, sizeof(qid), &state, sizeof(state)); if (code != 0) { - tDebug("%s conn %p failed to statue, sid:%" PRId64 " since %s", transLabel(pThrd->pInst), pConn, qid, + tDebug("%s conn:%p, failed to statue, sid:%" PRId64 " since %s", transLabel(pThrd->pInst), pConn, qid, tstrerror(code)); } else { - tDebug("%s conn %p succ to add statue, sid:%" PRId64 " (1)", transLabel(pThrd->pInst), pConn, qid); + tDebug("%s conn:%p, succ to add statue, sid:%" PRId64 " (1)", transLabel(pThrd->pInst), pConn, qid); } TAOS_UNUSED(cliHandleState_mayUpdateStateCtx(pConn, pReq)); @@ -2050,7 +2050,7 @@ void cliHandleBatchReq(SCliThrd* pThrd, SCliReq* pReq) { } else if (code == 0) { code = addConnToHeapCache(pThrd->connHeapCache, pConn); if (code != 0) { - tWarn("%s conn %p failed to added to heap cache since %s", pInst->label, pConn, tstrerror(code)); + tWarn("%s conn:%p, failed to added to heap cache since %s", pInst->label, pConn, tstrerror(code)); } } else { if (code == TSDB_CODE_OUT_OF_MEMORY && pConn == NULL) { @@ -2063,11 +2063,11 @@ void cliHandleBatchReq(SCliThrd* pThrd, SCliReq* pReq) { } code = cliSendReq(pConn, pReq); if (code != 0) { - tWarn("%s conn %p failed to send req since %s", pInst->label, pConn, tstrerror(code)); + tWarn("%s conn:%p, failed to send req since %s", pInst->label, pConn, tstrerror(code)); TAOS_UNUSED(transUnrefCliHandle(pConn)); } - tTrace("%s conn %p ready", pInst->label, pConn); + tTrace("%s conn:%p, ready", pInst->label, pConn); return; _exception: @@ -2110,7 +2110,7 @@ static void cliDoReq(queue* wq, SCliThrd* pThrd) { QUEUE_INIT(&conn->batchSendq); code = cliBatchSend(conn, 1); if (code != 0) { - tWarn("%s conn %p failed to send req since %s", pThrd->pInst->label, conn, tstrerror(code)); + tWarn("%s conn:%p, failed to send req since %s", pThrd->pInst->label, conn, tstrerror(code)); TAOS_UNUSED(transUnrefCliHandle(conn)); } } @@ -2160,7 +2160,7 @@ static FORCE_INLINE void destroyReq(void* arg) { removeReqFromSendQ(pReq); STraceId* trace = &pReq->msg.info.traceId; - tGDebug("free memory:%p, free ctx: %p", pReq, pReq->ctx); + tGTrace("free memory:%p, free ctx:%p", pReq, pReq->ctx); if (pReq->ctx) { destroyReqCtx(pReq->ctx); @@ -2517,7 +2517,7 @@ static FORCE_INLINE void doDelayTask(void* param) { static FORCE_INLINE void doCloseIdleConn(void* param) { STaskArg* arg = param; SCliConn* conn = arg->param1; - tDebug("%s conn %p idle, close it", CONN_GET_INST_LABEL(conn), conn); + tDebug("%s conn:%p, idle, close it", CONN_GET_INST_LABEL(conn), conn); conn->task = NULL; taosMemoryFree(arg); @@ -2559,7 +2559,7 @@ static FORCE_INLINE void cliPerfLog_epset(SCliConn* pConn, SCliReq* pReq) { tWarn("failed to debug epset since %s", tstrerror(code)); return; } - tTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); + tTrace("%s conn:%p, extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); return; } @@ -2846,10 +2846,10 @@ int32_t cliNotifyImplCb(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) { return 0; } if (pCtx->pSem || pCtx->syncMsgRef != 0) { - tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); + tGTrace("%s conn:%p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pSem) { if (pCtx->pRsp == NULL) { - tGTrace("%s conn %p(sync) failed to resp, ignore", CONN_GET_INST_LABEL(pConn), pConn); + tGTrace("%s conn:%p(sync) failed to resp, ignore", CONN_GET_INST_LABEL(pConn), pConn); } else { memcpy((char*)pCtx->pRsp, (char*)pResp, sizeof(*pResp)); } @@ -2875,7 +2875,7 @@ int32_t cliNotifyImplCb(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) { } } } else { - tGTrace("%s conn %p handle resp", CONN_GET_INST_LABEL(pConn), pConn); + tGTrace("%s conn:%p, handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pResp->info.hasEpSet == 1) { SEpSet epset = {0}; if (transCreateUserEpsetFromReqEpset(pCtx->epSet, &epset) != 0) { @@ -2938,7 +2938,7 @@ void transRefCliHandle(void* handle) { SCliConn* conn = (SCliConn*)handle; conn->ref++; - tTrace("%s conn %p ref %d", CONN_GET_INST_LABEL(conn), conn, conn->ref); + tTrace("%s conn:%p, ref %d", CONN_GET_INST_LABEL(conn), conn, conn->ref); } int32_t transUnrefCliHandle(void* handle) { if (handle == NULL) { @@ -2949,7 +2949,7 @@ int32_t transUnrefCliHandle(void* handle) { conn->ref--; ref = conn->ref; - tTrace("%s conn %p ref:%d", CONN_GET_INST_LABEL(conn), conn, conn->ref); + tTrace("%s conn:%p, ref:%d", CONN_GET_INST_LABEL(conn), conn, conn->ref); if (conn->ref == 0) { cliDestroyConn(conn, true); } @@ -3615,7 +3615,7 @@ static void cliConnRemoveTimoutQidMsg(SCliConn* pConn, int64_t* st, queue* set) if (((*st - pCtx->st) / 1000000) >= pInst->readTimeout) { code = taosHashRemove(pThrd->pIdConnTable, qid, sizeof(*qid)); if (code != 0) { - tError("%s conn %p failed to remove state sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid, + tError("%s conn:%p, failed to remove state sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid, tstrerror(code)); } @@ -3624,11 +3624,11 @@ static void cliConnRemoveTimoutQidMsg(SCliConn* pConn, int64_t* st, queue* set) if (taosArrayPush(pQIdBuf, qid) == NULL) { code = terrno; - tError("%s conn %p failed to add sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid, + tError("%s conn:%p, failed to add sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid, tstrerror(code)); break; } - tWarn("%s conn %p remove timeout msg sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), pConn, *qid); + tWarn("%s conn:%p, remove timeout msg sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), pConn, *qid); } pIter = taosHashIterate(pConn->pQTable, pIter); } @@ -3642,7 +3642,7 @@ static void cliConnRemoveTimoutQidMsg(SCliConn* pConn, int64_t* st, queue* set) transCtxCleanup(p); code = taosHashRemove(pConn->pQTable, qid, sizeof(*qid)); if (code != 0) { - tError("%s conn %p failed to drop ctx of sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid, + tError("%s conn:%p, failed to drop ctx of sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid, tstrerror(code)); } } @@ -3674,7 +3674,7 @@ static int8_t cliConnRemoveTimeoutMsg(SCliConn* pConn) { if (QUEUE_IS_EMPTY(&set)) { return 0; } - tWarn("%s conn %p do remove timeout msg", pInst->label, pConn); + tWarn("%s conn:%p, do remove timeout msg", pInst->label, pConn); destroyReqInQueue(pConn, &set, TSDB_CODE_RPC_TIMEOUT); return 1; } @@ -3682,7 +3682,7 @@ static FORCE_INLINE int8_t shouldSWitchToOtherConn(SCliConn* pConn, char* key) { SCliThrd* pThrd = pConn->hostThrd; STrans* pInst = pThrd->pInst; - tDebug("get conn %p from heap cache for key:%s, status:%d, refCnt:%d", pConn, key, pConn->inHeap, pConn->reqRefCnt); + tDebug("get conn:%p from heap cache for key:%s, status:%d, refCnt:%d", pConn, key, pConn->inHeap, pConn->reqRefCnt); int32_t reqsNum = transQueueSize(&pConn->reqsToSend); int32_t reqsSentOut = transQueueSize(&pConn->reqsSentOut); int32_t stateNum = taosHashGetSize(pConn->pQTable); @@ -3694,14 +3694,14 @@ static FORCE_INLINE int8_t shouldSWitchToOtherConn(SCliConn* pConn, char* key) { if (pConn->list == NULL && pConn->dstAddr != NULL) { pConn->list = taosHashGet((SHashObj*)pThrd->pool, pConn->dstAddr, strlen(pConn->dstAddr)); if (pConn->list != NULL) { - tTrace("conn %p get list %p from pool for key:%s", pConn, pConn->list, key); + tTrace("conn:%p, get list %p from pool for key:%s", pConn, pConn->list, key); } } if (pConn->list && pConn->list->totalSize >= pInst->connLimitNum / 4) { - tWarn("%s conn %p try to remove timeout msg since too many conn created", transLabel(pInst), pConn); + tWarn("%s conn:%p, try to remove timeout msg since too many conn created", transLabel(pInst), pConn); if (cliConnRemoveTimeoutMsg(pConn)) { - tWarn("%s conn %p succ to remove timeout msg", transLabel(pInst), pConn); + tWarn("%s conn:%p, succ to remove timeout msg", transLabel(pInst), pConn); } return 1; } @@ -3724,7 +3724,7 @@ static FORCE_INLINE void logConnMissHit(SCliConn* pConn) { SCliThrd* pThrd = pConn->hostThrd; STrans* pInst = pThrd->pInst; pConn->heapMissHit++; - tDebug("conn %p has %d reqs, %d sentout and %d status in process, total limit:%d, switch to other conn", pConn, + tDebug("conn:%p, has %d reqs, %d sentout and %d status in process, total limit:%d, switch to other conn", pConn, transQueueSize(&pConn->reqsToSend), transQueueSize(&pConn->reqsSentOut), taosHashGetSize(pConn->pQTable), pInst->shareConnLimit); // if (transQueueSize(&pConn->reqsSentOut) >= pInst->shareConnLimit) { @@ -3745,12 +3745,12 @@ static SCliConn* getConnFromHeapCache(SHashObj* pConnHeapCache, char* key) { tTrace("failed to get conn from heap cache for key:%s", key); return NULL; } else { - tTrace("conn %p get conn from heap cache for key:%s", pConn, key); + tTrace("conn:%p, get conn from heap cache for key:%s", pConn, key); if (shouldSWitchToOtherConn(pConn, key)) { SCliConn* pNewConn = NULL; code = balanceConnHeapCache(pConnHeapCache, pConn, &pNewConn); if (code == 1) { - tTrace("conn %p start to handle reqs", pNewConn); + tTrace("conn:%p, start to handle reqs", pNewConn); return pNewConn; } return NULL; @@ -3765,7 +3765,7 @@ static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn) { if (pConn->heap != NULL) { p = pConn->heap; - tTrace("conn %p add to heap cache for key:%s, status:%d, refCnt:%d, add direct", pConn, pConn->dstAddr, + tTrace("conn:%p, add to heap cache for key:%s, status:%d, refCnt:%d, add direct", pConn, pConn->dstAddr, pConn->inHeap, pConn->reqRefCnt); } else { code = getOrCreateHeap(pConnHeapCacahe, pConn->dstAddr, &p); @@ -3781,14 +3781,14 @@ static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn) { } code = transHeapInsert(p, pConn); - tTrace("conn %p add to heap cache for key:%s, status:%d, refCnt:%d", pConn, pConn->dstAddr, pConn->inHeap, + tTrace("conn:%p, add to heap cache for key:%s, status:%d, refCnt:%d", pConn, pConn->dstAddr, pConn->inHeap, pConn->reqRefCnt); return code; } static int32_t delConnFromHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn) { if (pConn->heap != NULL) { - tTrace("conn %p try to delete from heap cache direct", pConn); + tTrace("conn:%p, try to delete from heap cache direct", pConn); return transHeapDelete(pConn->heap, pConn); } @@ -3799,7 +3799,7 @@ static int32_t delConnFromHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn) { } int32_t code = transHeapDelete(p, pConn); if (code != 0) { - tTrace("conn %p failed delete from heap cache since %s", pConn, tstrerror(code)); + tTrace("conn:%p, failed delete from heap cache since %s", pConn, tstrerror(code)); } return code; } @@ -3864,7 +3864,7 @@ int32_t transHeapInsert(SHeap* heap, SCliConn* p) { // impl later p->reqRefCnt++; if (p->inHeap == 1) { - tTrace("failed to insert conn %p since already in heap", p); + tTrace("failed to insert conn:%p since already in heap", p); return TSDB_CODE_DUP_KEY; } @@ -3881,12 +3881,12 @@ int32_t transHeapDelete(SHeap* heap, SCliConn* p) { } if (p->inHeap == 0) { - tTrace("failed to del conn %p since not in heap", p); + tTrace("failed to del conn:%p since not in heap", p); return 0; } else { int64_t now = taosGetTimestampMs(); if (p->forceDelFromHeap == 0 && now - p->lastAddHeapTime < 10000) { - tTrace("conn %p not added/delete to heap frequently", p); + tTrace("conn:%p, not added/delete to heap frequently", p); return TSDB_CODE_RPC_ASYNC_IN_PROCESS; } } @@ -3895,11 +3895,11 @@ int32_t transHeapDelete(SHeap* heap, SCliConn* p) { p->reqRefCnt--; if (p->reqRefCnt == 0) { heapRemove(heap->heap, &p->node); - tTrace("conn %p delete from heap", p); + tTrace("conn:%p, delete from heap", p); } else if (p->reqRefCnt < 0) { - tTrace("conn %p has %d reqs, not delete from heap,assert", p, p->reqRefCnt); + tTrace("conn:%p, has %d reqs, not delete from heap,assert", p, p->reqRefCnt); } else { - tTrace("conn %p has %d reqs, not delete from heap", p, p->reqRefCnt); + tTrace("conn:%p, has %d reqs, not delete from heap", p, p->reqRefCnt); } return 0; } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 582bb15b00..ad79fa0a82 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -215,7 +215,7 @@ void uvAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* b SConnBuffer* pBuf = &conn->readBuf; int32_t code = transAllocBuffer(pBuf, buf); if (code < 0) { - tError("conn %p failed to alloc buffer, since %s", conn, tstrerror(code)); + tError("conn:%p, failed to alloc buffer, since %s", conn, tstrerror(code)); } } @@ -393,24 +393,24 @@ static void uvPerfLog_receive(SSvrConn* pConn, STransMsgHead* pHead, STransMsg* if (pConn->status == ConnNormal && pHead->noResp == 0) { if (cost >= EXCEPTION_LIMIT_US) { - tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, cost:%dus, recv exception, seqNum:%" PRId64 + tGDebug("%s conn:%p, %s received from %s, local info:%s, len:%d, cost:%dus, recv exception, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen, (int)cost, pTransMsg->info.seqNum, pTransMsg->info.qId); } else { - tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, cost:%dus, seqNum:%" PRId64 ", sid:%" PRId64 "", + tGDebug("%s conn:%p, %s received from %s, local info:%s, len:%d, cost:%dus, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen, (int)cost, pTransMsg->info.seqNum, pTransMsg->info.qId); } } else { if (cost >= EXCEPTION_LIMIT_US) { tGDebug( - "%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, recv exception, " + "%s conn:%p, %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, recv exception, " "seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen, pHead->noResp, pTransMsg->code, (int)(cost), pTransMsg->info.seqNum, pTransMsg->info.qId); } else { - tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, seqNum:%" PRId64 + tGDebug("%s conn:%p, %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, seqNum:%" PRId64 ", " "sid:%" PRId64 "", transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen, @@ -440,23 +440,23 @@ static int32_t uvMayHandleReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) { if (pHead->msgType == TDMT_SCH_TASK_RELEASE) { int64_t qId = taosHton64(pHead->qid); if (qId <= 0) { - tError("conn %p recv release, but invalid sid:%" PRId64 "", pConn, qId); + tError("conn:%p, recv release, but invalid sid:%" PRId64 "", pConn, qId); code = TSDB_CODE_RPC_NO_STATE; } else { void* p = taosHashGet(pConn->pQTable, &qId, sizeof(qId)); if (p == NULL) { code = TSDB_CODE_RPC_NO_STATE; - tTrace("conn %p recv release, and releady release by server sid:%" PRId64 "", pConn, qId); + tTrace("conn:%p, recv release, and releady release by server sid:%" PRId64 "", pConn, qId); } else { SSvrRegArg* arg = p; (pInst->cfp)(pInst->parent, &(arg->msg), NULL); - tTrace("conn %p recv release, notify server app, sid:%" PRId64 "", pConn, qId); + tTrace("conn:%p, recv release, notify server app, sid:%" PRId64 "", pConn, qId); code = taosHashRemove(pConn->pQTable, &qId, sizeof(qId)); if (code != 0) { - tDebug("conn %p failed to remove sid:%" PRId64 "", pConn, qId); + tDebug("conn:%p, failed to remove sid:%" PRId64 "", pConn, qId); } - tTrace("conn %p clear state,sid:%" PRId64 "", pConn, qId); + tTrace("conn:%p, clear state,sid:%" PRId64 "", pConn, qId); } } @@ -468,7 +468,7 @@ static int32_t uvMayHandleReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) { SSvrRespMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrRespMsg)); if (srvMsg == NULL) { - tError("conn %p recv release, failed to send release-resp since %s", pConn, tstrerror(terrno)); + tError("conn:%p, recv release, failed to send release-resp since %s", pConn, tstrerror(terrno)); taosMemoryFree(pHead); return terrno; } @@ -496,7 +496,7 @@ bool uvConnMayGetUserInfo(SSvrConn* pConn, STransMsgHead** ppHead, int32_t* msgL if (pHead->withUserInfo) { STransMsgHead* tHead = taosMemoryCalloc(1, len - sizeof(pInst->user)); if (tHead == NULL) { - tError("conn %p failed to get user info since %s", pConn, tstrerror(terrno)); + tError("conn:%p, failed to get user info since %s", pConn, tstrerror(terrno)); return false; } memcpy((char*)tHead, (char*)pHead, TRANS_MSG_OVERHEAD); @@ -524,28 +524,28 @@ static bool uvHandleReq(SSvrConn* pConn) { int8_t resetBuf = 0; int msgLen = transDumpFromBuffer(&pConn->readBuf, (char**)&pHead, 0); if (msgLen <= 0) { - tError("%s conn %p read invalid packet", transLabel(pInst), pConn); + tError("%s conn:%p, read invalid packet", transLabel(pInst), pConn); return false; } if (transDecompressMsg((char**)&pHead, &msgLen) < 0) { - tError("%s conn %p recv invalid packet, failed to decompress", transLabel(pInst), pConn); + tError("%s conn:%p, recv invalid packet, failed to decompress", transLabel(pInst), pConn); taosMemoryFree(pHead); return false; } if (uvConnMayGetUserInfo(pConn, &pHead, &msgLen) == true) { - tDebug("%s conn %p get user info", transLabel(pInst), pConn); + tDebug("%s conn:%p, get user info", transLabel(pInst), pConn); } else { if (pConn->userInited == 0) { taosMemoryFree(pHead); - tDebug("%s conn %p failed get user info since %s", transLabel(pInst), pConn, tstrerror(terrno)); + tDebug("%s conn:%p, failed get user info since %s", transLabel(pInst), pConn, tstrerror(terrno)); return false; } - tDebug("%s conn %p no need get user info", transLabel(pInst), pConn); + tDebug("%s conn:%p, no need get user info", transLabel(pInst), pConn); } if (resetBuf == 0) { - tTrace("%s conn %p not reset read buf", transLabel(pInst), pConn); + tTrace("%s conn:%p, not reset read buf", transLabel(pInst), pConn); } pHead->code = htonl(pHead->code); @@ -573,7 +573,7 @@ static bool uvHandleReq(SSvrConn* pConn) { if (pHead->seqNum == 0) { STraceId* trace = &pHead->traceId; - tGError("%s conn %p received invalid seqNum, msgType:%s", transLabel(pInst), pConn, TMSG_INFO(pHead->msgType)); + tGError("%s conn:%p, received invalid seqNum, msgType:%s", transLabel(pInst), pConn, TMSG_INFO(pHead->msgType)); return false; } @@ -623,7 +623,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) { code = transSetReadOption((uv_handle_t*)cli); if (code != 0) { - tWarn("%s conn %p failed to set recv opt since %s", transLabel(pInst), conn, tstrerror(code)); + tWarn("%s conn:%p, failed to set recv opt since %s", transLabel(pInst), conn, tstrerror(code)); } SConnBuffer* pBuf = &conn->readBuf; @@ -632,7 +632,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) { if (pBuf->len <= TRANS_PACKET_LIMIT) { while (transReadComplete(pBuf)) { if (true == pBuf->invalid || false == uvHandleReq(conn)) { - tError("%s conn %p read invalid packet, received from %s, local info:%s", transLabel(pInst), conn, conn->dst, + tError("%s conn:%p, read invalid packet, received from %s, local info:%s", transLabel(pInst), conn, conn->dst, conn->src); conn->broken = true; transUnrefSrvHandle(conn); @@ -641,7 +641,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) { } return; } else { - tError("%s conn %p read invalid packet, exceed limit, received from %s, local info:%s", transLabel(pInst), conn, + tError("%s conn:%p, read invalid packet, exceed limit, received from %s, local info:%s", transLabel(pInst), conn, conn->dst, conn->src); transUnrefSrvHandle(conn); return; @@ -651,7 +651,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) { return; } - tDebug("%s conn %p read error:%s", transLabel(pInst), conn, uv_err_name(nread)); + tDebug("%s conn:%p, read error:%s", transLabel(pInst), conn, uv_err_name(nread)); if (nread < 0) { conn->broken = true; transUnrefSrvHandle(conn); @@ -668,7 +668,7 @@ void uvAllocConnBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* b void uvOnTimeoutCb(uv_timer_t* handle) { // opt SSvrConn* pConn = handle->data; - tError("conn %p time out", pConn); + tError("conn:%p, time out", pConn); } void uvOnSendCb(uv_write_t* req, int status) { @@ -683,7 +683,7 @@ void uvOnSendCb(uv_write_t* req, int status) { freeWReqToWQ(&conn->wq, wrapper); - tDebug("%s conn %p send data out ", transLabel(conn->pInst), conn); + tDebug("%s conn:%p, send data out ", transLabel(conn->pInst), conn); if (status == 0) { while (!QUEUE_IS_EMPTY(&src)) { queue* head = QUEUE_HEAD(&src); @@ -691,7 +691,7 @@ void uvOnSendCb(uv_write_t* req, int status) { SSvrRespMsg* smsg = QUEUE_DATA(head, SSvrRespMsg, q); STraceId* trace = &smsg->msg.info.traceId; - tGDebug("%s conn %p msg already send out, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(conn->pInst), conn, + tGDebug("%s conn:%p, msg already send out, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(conn->pInst), conn, smsg->msg.info.seqNum, smsg->msg.info.qId); destroySmsg(smsg); } @@ -702,7 +702,7 @@ void uvOnSendCb(uv_write_t* req, int status) { SSvrRespMsg* smsg = QUEUE_DATA(head, SSvrRespMsg, q); STraceId* trace = &smsg->msg.info.traceId; - tGDebug("%s conn %p failed to send, seqNum:%" PRId64 ", sid:%" PRId64 " since %s", transLabel(conn->pInst), conn, + tGDebug("%s conn:%p, failed to send, seqNum:%" PRId64 ", sid:%" PRId64 " since %s", transLabel(conn->pInst), conn, smsg->msg.info.seqNum, smsg->msg.info.qId, uv_err_name(status)); destroySmsg(smsg); } @@ -770,7 +770,7 @@ static int32_t uvPrepareSendData(SSvrRespMsg* smsg, uv_buf_t* wb) { } STraceId* trace = &pMsg->info.traceId; - tGDebug("%s conn %p %s is sent to %s, local info:%s, len:%d, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(pInst), + tGDebug("%s conn:%p, %s is sent to %s, local info:%s, len:%d, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(pInst), pConn, TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, len, pMsg->info.seqNum, pMsg->info.qId); wb->base = (char*)pHead; @@ -780,7 +780,7 @@ static int32_t uvPrepareSendData(SSvrRespMsg* smsg, uv_buf_t* wb) { static int32_t uvBuildToSendData(SSvrConn* pConn, uv_buf_t** ppBuf, int32_t* bufNum, queue* toSendQ) { int32_t code = 0; int32_t size = transQueueSize(&pConn->resps); - tDebug("%s conn %p has %d msg to send", transLabel(pConn->pInst), pConn, size); + tDebug("%s conn:%p, has %d msg to send", transLabel(pConn->pInst), pConn, size); if (size == 0) { return 0; } @@ -828,13 +828,13 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrRespMsg* smsg) { } int32_t size = transQueueSize(&pConn->resps); if (size == 0) { - tDebug("%s conn %p has %d msg to send", transLabel(pConn->pInst), pConn, size); + tDebug("%s conn:%p, has %d msg to send", transLabel(pConn->pInst), pConn, size); return; } uv_write_t* req = allocWReqFromWQ(&pConn->wq, pConn); if (req == NULL) { - uError("%s conn %p failed to alloc write req since %s", transLabel(pConn->pInst), pConn, tstrerror(terrno)); + uError("%s conn:%p, failed to alloc write req since %s", transLabel(pConn->pInst), pConn, tstrerror(terrno)); transUnrefSrvHandle(pConn); return; } @@ -844,11 +844,11 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrRespMsg* smsg) { int32_t bufNum = 0; code = uvBuildToSendData(pConn, &pBuf, &bufNum, &pWreq->node); if (code != 0) { - tError("%s conn %p failed to send data", transLabel(pConn->pInst), pConn); + tError("%s conn:%p, failed to send data", transLabel(pConn->pInst), pConn); return; } if (bufNum == 0) { - tDebug("%s conn %p no data to send", transLabel(pConn->pInst), pConn); + tDebug("%s conn:%p, no data to send", transLabel(pConn->pInst), pConn); return; } @@ -856,7 +856,7 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrRespMsg* smsg) { int32_t ret = uv_write(req, (uv_stream_t*)pConn->pTcp, pBuf, bufNum, uvOnSendCb); if (ret != 0) { - tError("conn %p failed to write data since %s", pConn, uv_err_name(ret)); + tError("conn:%p, failed to write data since %s", pConn, uv_err_name(ret)); pConn->broken = true; while (!QUEUE_IS_EMPTY(&pWreq->node)) { queue* head = QUEUE_HEAD(&pWreq->node); @@ -876,13 +876,13 @@ int32_t uvMayHandleReleaseResp(SSvrRespMsg* pMsg) { if (pMsg->msg.msgType == TDMT_SCH_TASK_RELEASE && qid > 0) { SSvrRegArg* p = taosHashGet(pConn->pQTable, &qid, sizeof(qid)); if (p == NULL) { - tError("%s conn %p already release sid:%" PRId64 "", transLabel(pConn->pInst), pConn, qid); + tError("%s conn:%p, already release sid:%" PRId64 "", transLabel(pConn->pInst), pConn, qid); return TSDB_CODE_RPC_NO_STATE; } else { transFreeMsg(p->msg.pCont); code = taosHashRemove(pConn->pQTable, &qid, sizeof(qid)); if (code != 0) { - tError("%s conn %p failed to release sid:%" PRId64 " since %s", transLabel(pConn->pInst), pConn, qid, + tError("%s conn:%p, failed to release sid:%" PRId64 " since %s", transLabel(pConn->pInst), pConn, qid, tstrerror(code)); } } @@ -1001,18 +1001,18 @@ static void uvShutDownCb(uv_shutdown_t* req, int status) { static void uvWorkDoTask(uv_work_t* req) { // doing time-consumeing task // only auth conn currently, add more func later - tTrace("conn %p start to be processed in BG Thread", req->data); + tTrace("conn:%p, start to be processed in BG Thread", req->data); return; } static void uvWorkAfterTask(uv_work_t* req, int status) { if (status != 0) { - tTrace("conn %p failed to processed ", req->data); + tTrace("conn:%p, failed to processed ", req->data); } // Done time-consumeing task // add more func later // this func called in main loop - tTrace("conn %p already processed ", req->data); + tTrace("conn:%p, already processed ", req->data); taosMemoryFree(req); } @@ -1112,18 +1112,18 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) { if ((code = uv_accept(q, (uv_stream_t*)(pConn->pTcp))) == 0) { uv_os_fd_t fd; TAOS_UNUSED(uv_fileno((const uv_handle_t*)pConn->pTcp, &fd)); - tTrace("conn %p created, fd:%d", pConn, fd); + tTrace("conn:%p, created, fd:%d", pConn, fd); struct sockaddr_storage peername, sockname; // Get and valid the peer info int addrlen = sizeof(peername); if ((code = uv_tcp_getpeername(pConn->pTcp, (struct sockaddr*)&peername, &addrlen)) != 0) { - tError("conn %p failed to get peer info since %s", pConn, uv_strerror(code)); + tError("conn:%p, failed to get peer info since %s", pConn, uv_strerror(code)); transUnrefSrvHandle(pConn); return; } if (peername.ss_family != AF_INET) { - tError("conn %p failed to get peer info since not support other protocol except ipv4", pConn); + tError("conn:%p, failed to get peer info since not support other protocol except ipv4", pConn); transUnrefSrvHandle(pConn); return; } @@ -1132,12 +1132,12 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) { // Get and valid the sock info addrlen = sizeof(sockname); if ((code = uv_tcp_getsockname(pConn->pTcp, (struct sockaddr*)&sockname, &addrlen)) != 0) { - tError("conn %p failed to get local info since %s", pConn, uv_strerror(code)); + tError("conn:%p, failed to get local info since %s", pConn, uv_strerror(code)); transUnrefSrvHandle(pConn); return; } if (sockname.ss_family != AF_INET) { - tError("conn %p failed to get sock info since not support other protocol except ipv4", pConn); + tError("conn:%p, failed to get sock info since not support other protocol except ipv4", pConn); transUnrefSrvHandle(pConn); return; } @@ -1156,7 +1156,7 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) { } code = uv_read_start((uv_stream_t*)(pConn->pTcp), uvAllocRecvBufferCb, uvOnRecvCb); if (code != 0) { - tWarn("conn %p failed to start to read since %s", pConn, uv_err_name(code)); + tWarn("conn:%p, failed to start to read since %s", pConn, uv_err_name(code)); transUnrefSrvHandle(pConn); return; } @@ -1341,7 +1341,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { pConn->refId = exh->refId; QUEUE_INIT(&exh->q); - tTrace("%s handle %p, conn %p created, refId:%" PRId64, transLabel(pInst), exh, pConn, pConn->refId); + tTrace("%s handle %p, conn:%p created, refId:%" PRId64, transLabel(pInst), exh, pConn, pConn->refId); pConn->pQTable = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); if (pConn->pQTable == NULL) { @@ -1405,7 +1405,7 @@ static FORCE_INLINE void destroyConn(SSvrConn* conn, bool clear) { if (clear) { if (!uv_is_closing((uv_handle_t*)conn->pTcp)) { - tTrace("conn %p to be destroyed", conn); + tTrace("conn:%p, to be destroyed", conn); uv_close((uv_handle_t*)conn->pTcp, uvDestroyConn); } } @@ -1421,7 +1421,7 @@ void uvConnDestroyAllState(SSvrConn* p) { SSvrRegArg* arg = pIter; int64_t* qid = taosHashGetKey(pIter, NULL); (pInst->cfp)(pInst->parent, &(arg->msg), NULL); - tTrace("conn %p broken, notify server app, sid:%" PRId64 "", p, *qid); + tTrace("conn:%p, broken, notify server app, sid:%" PRId64 "", p, *qid); pIter = taosHashIterate(pQTable, pIter); } @@ -1441,7 +1441,7 @@ static void uvDestroyConn(uv_handle_t* handle) { transRemoveExHandle(uvGetConnRefOfThrd(thrd), conn->refId); STrans* pInst = thrd->pInst; - tDebug("%s conn %p destroy", transLabel(pInst), conn); + tDebug("%s conn:%p, destroy", transLabel(pInst), conn); transQueueDestroy(&conn->resps); @@ -1718,7 +1718,7 @@ void uvHandleRelease(SSvrRespMsg* msg, SWorkThrd* thrd) { return; } void uvHandleResp(SSvrRespMsg* msg, SWorkThrd* thrd) { // send msg to client - tDebug("%s conn %p start to send resp (2/2)", transLabel(thrd->pInst), msg->pConn); + tDebug("%s conn:%p, start to send resp (2/2)", transLabel(thrd->pInst), msg->pConn); uvStartSendResp(msg); } @@ -1726,7 +1726,7 @@ int32_t uvHandleStateReq(SSvrRespMsg* msg) { int32_t code = 0; SSvrConn* conn = msg->pConn; int64_t qid = msg->msg.info.qId; - tDebug("%s conn %p start to register brokenlink callback, sid:%" PRId64 "", transLabel(conn->pInst), conn, qid); + tDebug("%s conn:%p, start to register brokenlink callback, sid:%" PRId64 "", transLabel(conn->pInst), conn, qid); SSvrRegArg arg = {.notifyCount = 0, .init = 1, .msg = msg->msg}; SSvrRegArg* p = taosHashGet(conn->pQTable, &qid, sizeof(qid)); @@ -1735,12 +1735,12 @@ int32_t uvHandleStateReq(SSvrRespMsg* msg) { } code = taosHashPut(conn->pQTable, &qid, sizeof(qid), &arg, sizeof(arg)); - if (code == 0) tDebug("conn %p register brokenlink callback succ", conn); + if (code == 0) tDebug("conn:%p, register brokenlink callback succ", conn); return code; } void uvHandleRegister(SSvrRespMsg* msg, SWorkThrd* thrd) { SSvrConn* conn = msg->pConn; - tDebug("%s conn %p register brokenlink callback", transLabel(thrd->pInst), conn); + tDebug("%s conn:%p, register brokenlink callback", transLabel(thrd->pInst), conn); int32_t code = uvHandleStateReq(msg); taosMemoryFree(msg); } @@ -1859,7 +1859,7 @@ void transRefSrvHandle(void* handle) { } SSvrConn* pConn = handle; pConn->ref++; - tTrace("conn %p ref count:%d", pConn, pConn->ref); + tTrace("conn:%p, ref count:%d", pConn, pConn->ref); } void transUnrefSrvHandle(void* handle) { @@ -1868,7 +1868,7 @@ void transUnrefSrvHandle(void* handle) { } SSvrConn* pConn = handle; pConn->ref--; - tTrace("conn %p ref count:%d", pConn, pConn->ref); + tTrace("conn:%p, ref count:%d", pConn, pConn->ref); if (pConn->ref == 0) { destroyConn((SSvrConn*)handle, true); } @@ -1903,7 +1903,7 @@ int32_t transReleaseSrvHandle(void* handle, int32_t status) { m->msg = tmsg; m->type = Normal; - tDebug("%s conn %p start to send %s, sid:%" PRId64 "", transLabel(pThrd->pInst), exh->handle, TMSG_INFO(tmsg.msgType), + tDebug("%s conn:%p, start to send %s, sid:%" PRId64 "", transLabel(pThrd->pInst), exh->handle, TMSG_INFO(tmsg.msgType), qId); if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) { destroySmsg(m); @@ -1958,7 +1958,7 @@ int32_t transSendResponse(const STransMsg* msg) { m->type = Normal; STraceId* trace = (STraceId*)&msg->info.traceId; - tGDebug("conn %p start to send resp (1/2)", exh->handle); + tGDebug("conn:%p, start to send resp (1/2)", exh->handle); if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) { destroySmsg(m); transReleaseExHandle(msg->info.refIdMgt, refId); @@ -2006,7 +2006,7 @@ int32_t transRegisterMsg(const STransMsg* msg) { m->type = Register; STrans* pInst = pThrd->pInst; - tDebug("%s conn %p start to register brokenlink callback", transLabel(pInst), exh->handle); + tDebug("%s conn:%p, start to register brokenlink callback", transLabel(pInst), exh->handle); if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) { destroySmsg(m); transReleaseExHandle(msg->info.refIdMgt, refId); From 9a8fc303ae1606a265d27eb2e7159f208de1f400 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 16:39:48 +0800 Subject: [PATCH 15/22] enh: adjust log format --- source/client/src/clientImpl.c | 4 ++-- source/dnode/vnode/src/sma/smaRollup.c | 4 ++-- source/libs/catalog/src/ctgAsync.c | 2 +- source/libs/scheduler/src/schRemote.c | 5 +++-- source/libs/scheduler/src/scheduler.c | 6 +++--- source/libs/transport/src/thttp.c | 12 +++++------ source/libs/transport/src/transCli.c | 6 +++--- source/libs/transport/src/transComm.c | 2 +- source/libs/transport/src/transSvr.c | 30 +++++++++++++------------- 9 files changed, 36 insertions(+), 35 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 82228d7547..e4e5660fd1 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1789,8 +1789,8 @@ int32_t doProcessMsgFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) { char tbuf[40] = {0}; TRACE_TO_STR(trace, tbuf); - tscDebug("processMsgFromServer handle %p, message: %s, size:%d, code: %s, QID:%s", pMsg->info.handle, - TMSG_INFO(pMsg->msgType), pMsg->contLen, tstrerror(pMsg->code), tbuf); + tscDebug("QID:%s, process message from server, handle:%p, message:%s, size:%d, code:%s", tbuf, pMsg->info.handle, + TMSG_INFO(pMsg->msgType), pMsg->contLen, tstrerror(pMsg->code)); if (pSendInfo->requestObjRefId != 0) { SRequestObj* pRequest = (SRequestObj*)taosAcquireRef(clientReqRefPool, pSendInfo->requestObjRefId); diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 7d83dbcf84..3c5634f763 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -1249,7 +1249,7 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) { if (streamFlushed) { pRSmaInfo->items[i].streamFlushed = 1; if (++nStreamFlushed >= nTaskInfo) { - smaInfo("vgId:%d, rsma commit, checkpoint ready, %d us consumed, received/total: %d/%d", TD_VID(pVnode), + smaInfo("vgId:%d, rsma commit, checkpoint ready, %d us consumed, received/total:%d/%d", TD_VID(pVnode), nSleep * 10, nStreamFlushed, nTaskInfo); taosHashCancelIterate(pInfoHash, infoHash); goto _checkpoint; @@ -1260,7 +1260,7 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) { } taosUsleep(10); ++nSleep; - smaDebug("vgId:%d, rsma commit, wait for checkpoint ready, %d us elapsed, received/total: %d/%d", TD_VID(pVnode), + smaDebug("vgId:%d, rsma commit, wait for checkpoint ready, %d us elapsed, received/total:%d/%d", TD_VID(pVnode), nSleep * 10, nStreamFlushed, nTaskInfo); } } while (0); diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index b6c66958e3..55d69baf70 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -1519,7 +1519,7 @@ int32_t ctgHandleTaskEnd(SCtgTask* pTask, int32_t rspCode) { int32_t taskDone = atomic_add_fetch_32(&pJob->taskDone, 1); if (taskDone < taosArrayGetSize(pJob->pTasks)) { - qDebug("QID:0x%" PRIx64 ", task done: %d, total: %d", pJob->queryId, taskDone, + qDebug("QID:0x%" PRIx64 ", task done:%d, total:%d", pJob->queryId, taskDone, (int32_t)taosArrayGetSize(pJob->pTasks)); ctgUpdateJobErrCode(pJob, rspCode); diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index b18decfff2..f6b7c5fefa 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -489,7 +489,8 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { SSchTask *pTask = NULL; SSchJob *pJob = NULL; - qDebug("begin to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle, + int64_t qid = pParam->queryId; + qDebug("QID:0x%" PRIx64 ", begin to handle rsp msg, type:%s, handle:%p, code:%s", qid,TMSG_INFO(pMsg->msgType), pMsg->handle, tstrerror(rspCode)); SCH_ERR_JRET(schProcessOnCbBegin(&pJob, &pTask, pParam->queryId, pParam->refId, pParam->taskId)); @@ -503,7 +504,7 @@ _return: taosMemoryFreeClear(pMsg->pData); taosMemoryFreeClear(pMsg->pEpSet); - qDebug("end to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle, + qDebug("QID:0x%" PRIx64 ", end to handle rsp msg, type:%s, handle:%p, code:%s", qid, TMSG_INFO(pMsg->msgType), pMsg->handle, tstrerror(rspCode)); SCH_RET(code); diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index f99fe112de..75cfdc7c36 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -62,7 +62,7 @@ int32_t schedulerInit() { } int32_t schedulerExecJob(SSchedulerReq *pReq, int64_t *pJobId) { - qDebug("scheduler %s exec job start", pReq->syncReq ? "SYNC" : "ASYNC"); + qDebug("scheduler %s exec job will start", pReq->syncReq ? "SYNC" : "ASYNC"); int32_t code = 0; SSchJob *pJob = NULL; @@ -111,7 +111,7 @@ int32_t schedulerGetTasksStatus(int64_t jobId, SArray *pSub) { for (int32_t m = 0; m < pLevel->taskNum; ++m) { SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); if (NULL == pTask) { - qError("failed to get task %d, total: %d", m, pLevel->taskNum); + qError("failed to get task %d, total:%d", m, pLevel->taskNum); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); } @@ -120,7 +120,7 @@ int32_t schedulerGetTasksStatus(int64_t jobId, SArray *pSub) { TAOS_STRCPY(subDesc.status, jobTaskStatusStr(pTask->status)); if (NULL == taosArrayPush(pSub, &subDesc)) { - qError("taosArrayPush task %d failed, error: %x, ", m, terrno); + qError("taosArrayPush task %d failed, error:0x%x", m, terrno); SCH_ERR_JRET(terrno); } } diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c index deb5f07436..4d153c5443 100644 --- a/source/libs/transport/src/thttp.c +++ b/source/libs/transport/src/thttp.c @@ -235,7 +235,7 @@ static FORCE_INLINE int32_t taosBuildDstAddr(const char* server, uint16_t port, uint32_t ip = 0; int32_t code = taosGetIpv4FromFqdn(server, &ip); if (code) { - tError("http-report failed to resolving domain names %s, reason: %s", server, tstrerror(code)); + tError("http-report failed to resolving domain names %s, reason:%s", server, tstrerror(code)); return TSDB_CODE_RPC_FQDN_ERROR; } char buf[TD_IP_LEN] = {0}; @@ -332,7 +332,7 @@ static void httpMayDiscardMsg(SHttpModule* http, SAsyncItem* item) { QUEUE_REMOVE(h); msg = QUEUE_DATA(h, SHttpMsg, q); if (!msg->quit) { - tError("http-report failed to report chanId:%" PRId64 ",seq:%" PRId64 ", reason: %s", msg->chanId, msg->seq, + tError("http-report failed to report chanId:%" PRId64 ",seq:%" PRId64 ", reason:%s", msg->chanId, msg->seq, tstrerror(TSDB_CODE_HTTP_MODULE_QUIT)); httpDestroyMsg(msg); } else { @@ -471,7 +471,7 @@ static void clientSentCb(uv_write_t* req, int32_t status) { STUB_RAND_NETWORK_ERR(status); SHttpClient* cli = req->data; if (status != 0) { - tError("http-report failed to send data, reason: %s, dst:%s:%d, chanId:%" PRId64 ", seq:%" PRId64 "", + tError("http-report failed to send data, reason:%s, dst:%s:%d, chanId:%" PRId64 ", seq:%" PRId64 "", uv_strerror(status), cli->addr, cli->port, cli->chanId, cli->seq); if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); @@ -725,7 +725,7 @@ static void httpHandleReq(SHttpMsg* msg) { END: if (ignore == false) { - tError("http-report failed to report to addr: %s:%d, chanId:%" PRId64 ",seq:%" PRId64 " reason:%s", msg->server, + tError("http-report failed to report to addr:%s:%d, chanId:%" PRId64 ",seq:%" PRId64 " reason:%s", msg->server, msg->port, chanId, msg->seq, tstrerror(code)); } httpDestroyMsg(msg); @@ -937,12 +937,12 @@ int64_t taosInitHttpChan() { } void taosDestroyHttpChan(int64_t chanId) { - tDebug("http-report send quit, chanId: %" PRId64 "", chanId); + tDebug("http-report send quit, chanId:%" PRId64, chanId); int ret = 0; SHttpModule* load = taosAcquireRef(httpRefMgt, chanId); if (load == NULL) { - tError("http-report failed to destroy chanId %" PRId64 ", reason:%s", chanId, tstrerror(terrno)); + tError("http-report failed to destroy chanId:%" PRId64 ", reason:%s", chanId, tstrerror(terrno)); ret = terrno; return; } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 9d8d096677..e90fe9297a 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -941,7 +941,7 @@ static void addConnToPool(void* pool, SCliConn* conn) { QUEUE_INIT(&conn->q); QUEUE_PUSH(&conn->list->conns, &conn->q); conn->list->size += 1; - tDebug("conn:%p, added to pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr); + tDebug("conn:%p, added to pool, pool size:%d, dst:%s", conn, conn->list->size, conn->dstAddr); conn->heapMissHit = 0; @@ -1894,7 +1894,7 @@ static FORCE_INLINE int32_t cliUpdateFqdnCache(SHashObj* cache, char* fqdn) { char old[TSDB_FQDN_LEN] = {0}, new[TSDB_FQDN_LEN] = {0}; taosInetNtoa(old, *v); taosInetNtoa(new, addr); - tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new); + tWarn("update ip of fqdn:%s, old:%s, new:%s", fqdn, old, new); code = taosHashPut(cache, fqdn, len, &addr, sizeof(addr)); } } else { @@ -2541,7 +2541,7 @@ static FORCE_INLINE void cliPerfLog_schedMsg(SCliReq* pReq, char* label) { return; } - tGDebug("%s retry on next node,use:%s, step: %d,timeout:%" PRId64 "", label, tbuf, pCtx->retryStep, + tGDebug("%s retry on next node,use:%s, step:%d,timeout:%" PRId64, label, tbuf, pCtx->retryStep, pCtx->retryNextInterval); return; } diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index c0edcd54e4..73e14ebed4 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -836,7 +836,7 @@ int32_t subnetInit(SubnetUtils* pUtils, SIpV4Range* pRange) { return 0; } int32_t subnetDebugInfoToBuf(SubnetUtils* pUtils, char* buf) { - sprintf(buf, "raw: %s, address: %d, netmask:%d, network:%d, broadcast:%d", pUtils->info, pUtils->address, + sprintf(buf, "raw:%s, address:%d, netmask:%d, network:%d, broadcast:%d", pUtils->info, pUtils->address, pUtils->netmask, pUtils->network, pUtils->broadcast); return 0; } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index ad79fa0a82..35d74123f0 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -274,7 +274,7 @@ int32_t uvWhiteListToStr(SWhiteUserList* plist, char* user, char** ppBuf) { return terrno; } - int32_t len = sprintf(pBuf, "user: %s, ver: %" PRId64 ", ip: {%s}", user, plist->ver, tmp); + int32_t len = sprintf(pBuf, "user:%s, ver:%" PRId64 ", ip:{%s}", user, plist->ver, tmp); taosMemoryFree(tmp); *ppBuf = pBuf; @@ -1027,7 +1027,7 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { int err = uv_tcp_init(pObj->loop, cli); if (err != 0) { - tError("failed to create tcp: %s", uv_err_name(err)); + tError("failed to create tcp:%s", uv_err_name(err)); taosMemoryFree(cli); return; } @@ -1059,10 +1059,10 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb)); } else { if (!uv_is_closing((uv_handle_t*)cli)) { - tError("failed to accept tcp: %s", uv_err_name(err)); + tError("failed to accept tcp:%s", uv_err_name(err)); uv_close((uv_handle_t*)cli, uvFreeCb); } else { - tError("failed to accept tcp: %s", uv_err_name(err)); + tError("failed to accept tcp:%s", uv_err_name(err)); taosMemoryFree(cli); } } @@ -1464,7 +1464,7 @@ static void uvDestroyConn(uv_handle_t* handle) { } static void uvPipeListenCb(uv_stream_t* handle, int status) { if (status != 0) { - tError("server failed to init pipe, errmsg: %s", uv_err_name(status)); + tError("server failed to init pipe, errmsg:%s", uv_err_name(status)); return; } @@ -1473,12 +1473,12 @@ static void uvPipeListenCb(uv_stream_t* handle, int status) { int ret = uv_pipe_init(srv->loop, pipe, 1); if (ret != 0) { - tError("trans-svr failed to init pipe, errmsg: %s", uv_err_name(ret)); + tError("trans-svr failed to init pipe, errmsg:%s", uv_err_name(ret)); } ret = uv_accept((uv_stream_t*)&srv->pipeListen, (uv_stream_t*)pipe); if (ret != 0) { - tError("trans-svr failed to accept pipe, errmsg: %s", uv_err_name(ret)); + tError("trans-svr failed to accept pipe, errmsg:%s", uv_err_name(ret)); return; } @@ -1507,7 +1507,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, SServerObj* srv = taosMemoryCalloc(1, sizeof(SServerObj)); if (srv == NULL) { code = terrno; - tError("failed to init server since: %s", tstrerror(code)); + tError("failed to init server since:%s", tstrerror(code)); return NULL; } @@ -1526,7 +1526,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, code = uv_loop_init(srv->loop); if (code != 0) { - tError("failed to init server since: %s", uv_err_name(code)); + tError("failed to init server since:%s", uv_err_name(code)); code = TSDB_CODE_THIRDPARTY_ERROR; goto End; } @@ -1541,7 +1541,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, #if defined(WINDOWS) || defined(DARWIN) int ret = uv_pipe_init(srv->loop, &srv->pipeListen, 0); if (ret != 0) { - tError("failed to init pipe, errmsg: %s", uv_err_name(ret)); + tError("failed to init pipe, errmsg:%s", uv_err_name(ret)); goto End; } #if defined(WINDOWS) @@ -1553,13 +1553,13 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, ret = uv_pipe_bind(&srv->pipeListen, pipeName); if (ret != 0) { - tError("failed to bind pipe, errmsg: %s", uv_err_name(ret)); + tError("failed to bind pipe, errmsg:%s", uv_err_name(ret)); goto End; } ret = uv_listen((uv_stream_t*)&srv->pipeListen, SOMAXCONN, uvPipeListenCb); if (ret != 0) { - tError("failed to listen pipe, errmsg: %s", uv_err_name(ret)); + tError("failed to listen pipe, errmsg:%s", uv_err_name(ret)); goto End; } @@ -1637,21 +1637,21 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, uv_os_sock_t fds[2]; if ((code = uv_socketpair(SOCK_STREAM, 0, fds, UV_NONBLOCK_PIPE, UV_NONBLOCK_PIPE)) != 0) { - tError("failed to create pipe, errmsg: %s", uv_err_name(code)); + tError("failed to create pipe, errmsg:%s", uv_err_name(code)); code = TSDB_CODE_THIRDPARTY_ERROR; goto End; } code = uv_pipe_init(srv->loop, &(srv->pipe[i][0]), 1); if (code != 0) { - tError("failed to init pipe, errmsg: %s", uv_err_name(code)); + tError("failed to init pipe, errmsg:%s", uv_err_name(code)); code = TSDB_CODE_THIRDPARTY_ERROR; goto End; } code = uv_pipe_open(&(srv->pipe[i][0]), fds[1]); if (code != 0) { - tError("failed to init pipe, errmsg: %s", uv_err_name(code)); + tError("failed to init pipe, errmsg:%s", uv_err_name(code)); code = TSDB_CODE_THIRDPARTY_ERROR; goto End; } From 5e07b497ce6d755e9ac7e8405121ef7963b76243 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 17:06:23 +0800 Subject: [PATCH 16/22] enh: adjust log format --- source/client/src/clientEnv.c | 12 ++++++------ source/client/src/clientHb.c | 8 ++++---- source/client/src/clientImpl.c | 8 ++++---- source/client/src/clientMain.c | 9 +++++---- source/libs/scheduler/src/schStatus.c | 2 +- source/libs/scheduler/src/scheduler.c | 4 ++-- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index a890c3d0ad..3802aea5fa 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -458,7 +458,7 @@ void destroyTscObj(void *pObj) { STscObj *pTscObj = pObj; int64_t tscId = pTscObj->id; - tscTrace("begin to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); + tscTrace("connObj:%" PRIx64 ", begin to destroy, p:%p", tscId, pTscObj); SClientHbKey connKey = {.tscRid = pTscObj->id, .connType = pTscObj->connType}; hbDeregisterConn(pTscObj, connKey); @@ -467,7 +467,7 @@ void destroyTscObj(void *pObj) { taosHashCleanup(pTscObj->pRequests); schedulerStopQueryHb(pTscObj->pAppInfo->pTransporter); - tscDebug("connObj 0x%" PRIx64 " p:%p destroyed, remain inst totalConn:%" PRId64, pTscObj->id, pTscObj, + tscDebug("connObj:0x%" PRIx64 ", p:%p destroyed, remain inst totalConn:%" PRId64, pTscObj->id, pTscObj, pTscObj->pAppInfo->numOfConns); // In any cases, we should not free app inst here. Or an race condition rises. @@ -476,7 +476,7 @@ void destroyTscObj(void *pObj) { (void)taosThreadMutexDestroy(&pTscObj->mutex); taosMemoryFree(pTscObj); - tscTrace("end to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); + tscTrace("connObj:0x%" PRIx64 ", end to destroy, p:%p", tscId, pTscObj); } int32_t createTscObj(const char *user, const char *auth, const char *db, int32_t connType, SAppInstInfo *pAppInfo, @@ -682,7 +682,7 @@ void doDestroyRequest(void *p) { SRequestObj *pRequest = (SRequestObj *)p; uint64_t reqId = pRequest->requestId; - tscDebug("begin to destroy request 0x%" PRIx64 " p:%p", reqId, pRequest); + tscDebug("QID:0x%" PRIx64 ", begin to destroy request p:%p", reqId, pRequest); int64_t nextReqRefId = pRequest->relation.nextRefId; @@ -724,7 +724,7 @@ void doDestroyRequest(void *p) { taosMemoryFreeClear(pRequest->effectiveUser); taosMemoryFreeClear(pRequest->sqlstr); taosMemoryFree(pRequest); - tscDebug("end to destroy request %" PRIx64 " p:%p", reqId, pRequest); + tscDebug("QID:0x%" PRIx64 ", end to destroy request p:%p", reqId, pRequest); destroyNextReq(nextReqRefId); } @@ -747,7 +747,7 @@ void taosStopQueryImpl(SRequestObj *pRequest) { } schedulerFreeJob(&pRequest->body.queryJob, TSDB_CODE_TSC_QUERY_KILLED); - tscDebug("request %" PRIx64 " killed", pRequest->requestId); + tscDebug("QID:0x%" PRIx64 ", killed", pRequest->requestId); } void stopAllQueries(SRequestObj *pRequest) { diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index b3e288c816..518689ee89 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -121,7 +121,7 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat pTscObj->authVer = pRsp->version; if (pTscObj->sysInfo != pRsp->sysInfo) { - tscDebug("update sysInfo of user %s from %" PRIi8 " to %" PRIi8 ", tscRid:%" PRIi64, pRsp->user, + tscDebug("update sysInfo of user %s from %" PRIi8 " to %" PRIi8 ", connObj:%" PRIi64, pRsp->user, pTscObj->sysInfo, pRsp->sysInfo, pTscObj->id); pTscObj->sysInfo = pRsp->sysInfo; } @@ -134,7 +134,7 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat if (passInfo->fp) { (*passInfo->fp)(passInfo->param, &pRsp->passVer, TAOS_NOTIFY_PASSVER); } - tscDebug("update passVer of user %s from %d to %d, tscRid:%" PRIi64, pRsp->user, oldVer, + tscDebug("update passVer of user %s from %d to %d, connObj:%" PRIi64, pRsp->user, oldVer, atomic_load_32(&passInfo->ver), pTscObj->id); } } @@ -147,7 +147,7 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat if (whiteListInfo->fp) { (*whiteListInfo->fp)(whiteListInfo->param, &pRsp->whiteListVer, TAOS_NOTIFY_WHITELIST_VER); } - tscDebug("update whitelist version of user %s from %" PRId64 " to %" PRId64 ", tscRid:%" PRIi64, pRsp->user, + tscDebug("update whitelist version of user %s from %" PRId64 " to %" PRId64 ", connObj:%" PRIi64, pRsp->user, oldVer, atomic_load_64(&whiteListInfo->ver), pTscObj->id); } } else { @@ -156,7 +156,7 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat SWhiteListInfo *whiteListInfo = &pTscObj->whiteListInfo; int64_t oldVer = atomic_load_64(&whiteListInfo->ver); atomic_store_64(&whiteListInfo->ver, pRsp->whiteListVer); - tscDebug("update whitelist version of user %s from %" PRId64 " to %" PRId64 ", tscRid:%" PRIi64, pRsp->user, + tscDebug("update whitelist version of user %s from %" PRId64 " to %" PRId64 ", connObj:%" PRIi64, pRsp->user, oldVer, atomic_load_64(&whiteListInfo->ver), pTscObj->id); } releaseTscObj(pReq->connKey.tscRid); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index e4e5660fd1..a8dfb100d5 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -245,7 +245,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, int32_t err = taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self, sizeof((*pRequest)->self)); if (err) { - tscError("req:0x%" PRId64 ", failed to add to request container, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", + tscError("req:0x%" PRId64 ", failed to add to request container, QID:0x%" PRIx64 ", connObj:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; @@ -256,7 +256,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) { if (TSDB_CODE_SUCCESS != nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) { - tscError("req:0x%" PRId64 ", failed to create node allocator, QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, + tscError("req:0x%" PRId64 ", failed to create node allocator, QID:0x%" PRIx64 ", connObj:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; @@ -1221,7 +1221,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { return; } - tscDebug("schedulerExecCb request type %s", TMSG_INFO(pRequest->type)); + tscDebug("req:0x%" PRIx64 ", schedulerExecCb request type %s", pRequest->self, TMSG_INFO(pRequest->type)); if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) { if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) { tscError("req:0x%" PRIx64 ", remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); @@ -2983,7 +2983,7 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s } taosMemoryFree(param); - tscDebug("taos_query end with sql:%s", sql); + tscDebug("connObj:0x%" PRIx64 ", taos_query end with sql:%s", *(int64_t*)taos, sql); return pRequest; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 3b9239131f..e9a684d10d 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -478,10 +478,10 @@ void taos_close_internal(void *taos) { } STscObj *pTscObj = (STscObj *)taos; - tscDebug("0x%" PRIx64 " try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs); + tscDebug("connObj:0x%" PRIx64 ", try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs); if (TSDB_CODE_SUCCESS != taosRemoveRef(clientConnRefPool, pTscObj->id)) { - tscError("0x%" PRIx64 " failed to remove ref from conn pool", pTscObj->id); + tscError("connObj:0x%" PRIx64 ", failed to remove ref from conn pool", pTscObj->id); } } @@ -535,14 +535,15 @@ void taos_free_result(TAOS_RES *res) { return; } - tscDebug("taos free res %p", res); + tscTrace("taos free res %p", res); if (TD_RES_QUERY(res)) { SRequestObj *pRequest = (SRequestObj *)res; - tscDebug("0x%" PRIx64 " taos_free_result start to free query", pRequest->requestId); + tscDebug("QID:0x%" PRIx64 ", taos_free_result start to free query", pRequest->requestId); destroyRequest(pRequest); return; } + SMqRspObj *pRsp = (SMqRspObj *)res; if (TD_RES_TMQ(res)) { tDeleteMqDataRsp(&pRsp->dataRsp); diff --git a/source/libs/scheduler/src/schStatus.c b/source/libs/scheduler/src/schStatus.c index 9792af22f6..1bd91093b5 100644 --- a/source/libs/scheduler/src/schStatus.c +++ b/source/libs/scheduler/src/schStatus.c @@ -70,7 +70,7 @@ int32_t schHandleOpBeginEvent(int64_t jobId, SSchJob** job, SCH_OP_TYPE type, SS SSchJob* pJob = NULL; (void)schAcquireJob(jobId, &pJob); if (NULL == pJob) { - qDebug("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, jobId); + qDebug("jobId:0x%" PRIx64 ", acquire sch job failed, may be dropped", jobId); SCH_ERR_RET(TSDB_CODE_SCH_JOB_NOT_EXISTS); } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 75cfdc7c36..9437bf73d6 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -62,7 +62,7 @@ int32_t schedulerInit() { } int32_t schedulerExecJob(SSchedulerReq *pReq, int64_t *pJobId) { - qDebug("scheduler %s exec job will start", pReq->syncReq ? "SYNC" : "ASYNC"); + qDebug("QID:0x%" PRIx64 ", scheduler %s exec job will start", pReq->pConn->requestId, pReq->syncReq ? "SYNC" : "ASYNC"); int32_t code = 0; SSchJob *pJob = NULL; @@ -167,7 +167,7 @@ void schedulerFreeJob(int64_t *jobId, int32_t errCode) { SSchJob *pJob = NULL; (void)schAcquireJob(*jobId, &pJob); if (NULL == pJob) { - qDebug("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); + qDebug("jobId:0x%" PRIx64 ", acquire sch job failed, may be dropped", *jobId); return; } From e314966cb94c5ccfc0cb71e526409d208eca1125 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 18:16:59 +0800 Subject: [PATCH 17/22] enh: adjust log format --- source/client/src/clientEnv.c | 18 +++--- source/client/src/clientHb.c | 26 ++++---- source/client/src/clientImpl.c | 6 +- source/client/src/clientMain.c | 2 +- source/client/src/clientMonitor.c | 68 ++++++++++----------- source/client/src/clientMsgHandler.c | 38 ++++++------ source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 2 +- source/dnode/mgmt/mgmt_mnode/src/mmInt.c | 2 +- source/dnode/mnode/impl/src/mndStream.c | 2 +- source/dnode/vnode/src/tsdb/tsdbFile2.c | 16 ++--- source/libs/executor/src/groupoperator.c | 2 +- source/libs/executor/src/scanoperator.c | 2 +- source/libs/scheduler/src/schUtil.c | 8 +-- source/libs/stream/src/streamExec.c | 2 +- source/libs/sync/src/syncMain.c | 6 +- source/libs/transport/src/trans.c | 2 +- source/libs/transport/src/transCli.c | 6 +- source/libs/transport/src/transComm.c | 2 +- source/util/src/tpagedbuf.c | 2 +- source/util/src/tqueue.c | 12 ++-- source/util/src/tref.c | 68 ++++++++++----------- 21 files changed, 146 insertions(+), 146 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 3802aea5fa..84864766f9 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -133,7 +133,7 @@ static int32_t generateWriteSlowLog(STscObj *pTscObj, SRequestObj *pRequest, int cJSON *json = cJSON_CreateObject(); int32_t code = TSDB_CODE_SUCCESS; if (json == NULL) { - tscError("[monitor] cJSON_CreateObject failed"); + tscError("failed to create monitor json"); return TSDB_CODE_OUT_OF_MEMORY; } char clusterId[32] = {0}; @@ -262,17 +262,17 @@ static void deregisterRequest(SRequestObj *pRequest) { if ((pRequest->pQuery && pRequest->pQuery->pRoot && QUERY_NODE_VNODE_MODIFY_STMT == pRequest->pQuery->pRoot->type && (0 == ((SVnodeModifyOpStmt *)pRequest->pQuery->pRoot)->sqlNodeType)) || QUERY_NODE_VNODE_MODIFY_STMT == pRequest->stmtType) { - tscDebug("insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 - "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", - duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, - pRequest->metric.planCostUs, pRequest->metric.execCostUs); + tscDebug("req:0x%" PRIx64 ", insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 + "us, analyseCost:%" PRId64 "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", + pRequest->self, duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, + pRequest->metric.analyseCostUs, pRequest->metric.planCostUs, pRequest->metric.execCostUs); (void)atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration); reqType = SLOW_LOG_TYPE_INSERT; } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { - tscDebug("query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 - "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", - duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, - pRequest->metric.planCostUs, pRequest->metric.execCostUs); + tscDebug("req:0x%" PRIx64 ", query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 + "us, analyseCost:%" PRId64 "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", + pRequest->self, duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, + pRequest->metric.analyseCostUs, pRequest->metric.planCostUs, pRequest->metric.execCostUs); (void)atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration); reqType = SLOW_LOG_TYPE_QUERY; diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 518689ee89..b6a1c7fe7a 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -548,7 +548,7 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { struct SCatalog *pCatalog = NULL; int32_t code = catalogGetHandle(pReq->clusterId, &pCatalog); if (code != TSDB_CODE_SUCCESS) { - tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pReq->clusterId, tstrerror(code)); + tscWarn("catalogGetHandle failed, clusterId:0x%" PRIx64 ", error:%s", pReq->clusterId, tstrerror(code)); } else { hbProcessQueryRspKvs(kvNum, pRsp->info, pCatalog, pAppHbMgr); } @@ -608,7 +608,7 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { pInst->serverCfg.monitorParas = pRsp.monitorParas; pInst->serverCfg.enableAuditDelete = pRsp.enableAuditDelete; - tscDebug("[monitor] paras from hb, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", pInst->clusterId, + tscDebug("monitor paras from hb, clusterId:0x%" PRIx64 ", threshold:%d scope:%d", pInst->clusterId, pRsp.monitorParas.tsSlowLogThreshold, pRsp.monitorParas.tsSlowLogScope); if (rspNum) { @@ -1081,33 +1081,33 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req code = hbGetQueryBasicInfo(connKey, req); if (code != TSDB_CODE_SUCCESS) { - tscWarn("hbGetQueryBasicInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetQueryBasicInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } if (hbParam->reqCnt == 0) { code = catalogGetHandle(hbParam->clusterId, &pCatalog); if (code != TSDB_CODE_SUCCESS) { - tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("catalogGetHandle failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } code = hbGetAppInfo(hbParam->clusterId, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("getAppInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("getAppInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } if (!taosHashGet(clientHbMgr.appHbHash, &hbParam->clusterId, sizeof(hbParam->clusterId))) { code = hbGetExpiredUserInfo(connKey, pCatalog, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbGetExpiredUserInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetExpiredUserInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } if (clientHbMgr.appHbHash) { code = taosHashPut(clientHbMgr.appHbHash, &hbParam->clusterId, sizeof(uint64_t), NULL, 0); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbQueryHbReqHandle put clusterId failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, + tscWarn("hbQueryHbReqHandle put clusterId failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } @@ -1118,7 +1118,7 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req if (2 != atomic_load_8(&hbParam->pAppHbMgr->connHbFlag)) { code = hbGetUserAuthInfo(connKey, hbParam, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbGetUserAuthInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetUserAuthInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } atomic_store_8(&hbParam->pAppHbMgr->connHbFlag, 1); @@ -1126,32 +1126,32 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req code = hbGetExpiredDBInfo(connKey, pCatalog, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbGetExpiredDBInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetExpiredDBInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } code = hbGetExpiredStbInfo(connKey, pCatalog, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbGetExpiredStbInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetExpiredStbInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } #ifdef TD_ENTERPRISE code = hbGetExpiredViewInfo(connKey, pCatalog, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbGetExpiredViewInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetExpiredViewInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } #endif code = hbGetExpiredTSMAInfo(connKey, pCatalog, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbGetExpiredTSMAInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetExpiredTSMAInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } } else { code = hbGetAppInfo(hbParam->clusterId, req); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbGetAppInfo failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbGetAppInfo failed, clusterId:0x%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); return code; } } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index a8dfb100d5..3efa0a2130 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1754,14 +1754,14 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg, SCatalog* pCatalog = NULL; int32_t code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog); if (code != TSDB_CODE_SUCCESS) { - tscError("fail to get catalog handle, clusterId:%" PRIx64 ", error %s", pTscObj->pAppInfo->clusterId, + tscError("fail to get catalog handle, clusterId:0x%" PRIx64 ", error:%s", pTscObj->pAppInfo->clusterId, tstrerror(code)); return; } code = catalogUpdateVgEpSet(pCatalog, pSendInfo->target.dbFName, pSendInfo->target.vgId, pEpSet); if (code != TSDB_CODE_SUCCESS) { - tscError("fail to update catalog vg epset, clusterId:%" PRIx64 ", error %s", pTscObj->pAppInfo->clusterId, + tscError("fail to update catalog vg epset, clusterId:0x%" PRIx64 ", error:%s", pTscObj->pAppInfo->clusterId, tstrerror(code)); return; } @@ -2983,7 +2983,7 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s } taosMemoryFree(param); - tscDebug("connObj:0x%" PRIx64 ", taos_query end with sql:%s", *(int64_t*)taos, sql); + tscDebug("connObj:0x%" PRIx64 ", res:%p created, taos_query end with sql:%s", *(int64_t*)taos, pRequest, sql); return pRequest; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e9a684d10d..8540bf9449 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -535,7 +535,7 @@ void taos_free_result(TAOS_RES *res) { return; } - tscTrace("taos free res %p", res); + tscTrace("res:%p, will be freed", res); if (TD_RES_QUERY(res)) { SRequestObj *pRequest = (SRequestObj *)res; diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 5f7e11b6a3..45b8ec7d49 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -97,7 +97,7 @@ static void monitorFreeSlowLogDataEx(void* paras) { static SAppInstInfo* getAppInstByClusterId(int64_t clusterId) { void* p = taosHashGet(appInfo.pInstMapByClusterId, &clusterId, LONG_BYTES); if (p == NULL) { - tscError("failed to get app inst, clusterId:%" PRIx64, clusterId); + tscError("failed to get app inst, clusterId:0x%" PRIx64, clusterId); return NULL; } return *(SAppInstInfo**)p; @@ -114,7 +114,7 @@ static int32_t monitorReportAsyncCB(void* param, SDataBuf* pMsg, int32_t code) { if (param != NULL) { MonitorSlowLogData* p = (MonitorSlowLogData*)param; if (code != 0) { - tscError("failed to send slow log:%s, clusterId:%" PRIx64, p->data, p->clusterId); + tscError("failed to send slow log:%s, clusterId:0x%" PRIx64, p->data, p->clusterId); } MonitorSlowLogData tmp = {.clusterId = p->clusterId, .type = p->type, @@ -241,7 +241,7 @@ void monitorCreateClient(int64_t clusterId) { MonitorClient* pMonitor = NULL; taosWLockLatch(&monitorLock); if (taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES) == NULL) { - tscInfo("[monitor] monitorCreateClient for %" PRIx64, clusterId); + tscInfo("clusterId:0x%" PRIx64 ", create monitor", clusterId); pMonitor = taosMemoryCalloc(1, sizeof(MonitorClient)); if (pMonitor == NULL) { tscError("failed to create monitor client"); @@ -293,7 +293,7 @@ void monitorCreateClient(int64_t clusterId) { tscError("failed to start timer"); goto fail; } - tscInfo("[monitor] monitorCreateClient for %" PRIx64 "finished %p.", clusterId, pMonitor); + tscInfo("clusterId:0x%" PRIx64 ", create monitor finished, montitor:%p", clusterId, pMonitor); } taosWUnLockLatch(&monitorLock); @@ -331,7 +331,7 @@ void monitorCreateClientCounter(int64_t clusterId, const char* name, const char* } goto end; } - tscInfo("[monitor] monitorCreateClientCounter %" PRIx64 "(%p):%s : %p.", pMonitor->clusterId, pMonitor, name, + tscInfo("clusterId:0x%" PRIx64 ", monitor:%p, create counter:%s:%p", pMonitor->clusterId, pMonitor, name, newCounter); end: @@ -347,21 +347,21 @@ void monitorCounterInc(int64_t clusterId, const char* counterName, const char** MonitorClient** ppMonitor = (MonitorClient**)taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES); if (ppMonitor == NULL || *ppMonitor == NULL) { - tscError("monitorCounterInc not found pMonitor %" PRId64, clusterId); + tscError("clusterId:0x%" PRId64 ", monitor not found", clusterId); goto end; } MonitorClient* pMonitor = *ppMonitor; taos_counter_t** ppCounter = (taos_counter_t**)taosHashGet(pMonitor->counters, counterName, strlen(counterName)); if (ppCounter == NULL || *ppCounter == NULL) { - tscError("monitorCounterInc not found pCounter %" PRIx64 ":%s.", clusterId, counterName); + tscError("clusterId:0x%" PRIx64 ", monitor:%p counter:%s not found", clusterId, pMonitor, counterName); goto end; } if (taos_counter_inc(*ppCounter, label_values) != 0) { - tscError("monitorCounterInc failed to inc %" PRIx64 ":%s.", clusterId, counterName); + tscError("clusterId:0x%" PRIx64 ", monitor:%p counter:%s inc failed", clusterId, pMonitor, counterName); goto end; } - tscDebug("[monitor] monitorCounterInc %" PRIx64 "(%p):%s", pMonitor->clusterId, pMonitor, counterName); + tscDebug("clusterId:0x%" PRIx64 ", monitor:%p, counter:%s inc", pMonitor->clusterId, pMonitor, counterName); end: taosWUnLockLatch(&monitorLock); @@ -379,11 +379,11 @@ static void monitorWriteSlowLog2File(MonitorSlowLogData* slowLogData, char* tmpP char path[PATH_MAX] = {0}; char clusterId[32] = {0}; if (snprintf(clusterId, sizeof(clusterId), "%" PRIx64, slowLogData->clusterId) < 0) { - tscError("failed to generate clusterId:%" PRIx64, slowLogData->clusterId); + tscError("failed to generate clusterId:0x%" PRIx64, slowLogData->clusterId); return; } taosGetTmpfilePath(tmpPath, clusterId, path); - tscInfo("[monitor] create slow log file:%s", path); + tscInfo("monitor create slow log file:%s", path); pFile = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_READ | TD_FILE_TRUNC); if (pFile == NULL) { tscError("failed to open file:%s since %d", path, terrno); @@ -404,7 +404,7 @@ static void monitorWriteSlowLog2File(MonitorSlowLogData* slowLogData, char* tmpP pClient->offset = 0; pClient->pFile = pFile; if (taosHashPut(monitorSlowLogHash, &slowLogData->clusterId, LONG_BYTES, &pClient, POINTER_BYTES) != 0) { - tscError("failed to put clusterId:%" PRId64 " to hash table", slowLogData->clusterId); + tscError("failed to put clusterId:0x%" PRIx64 " to hash table", slowLogData->clusterId); int32_t ret = taosCloseFile(&pFile); if (ret != 0) { tscError("failed to close file:%p ret:%d", pFile, ret); @@ -428,11 +428,11 @@ static void monitorWriteSlowLog2File(MonitorSlowLogData* slowLogData, char* tmpP if (taosWriteFile(pFile, slowLogData->data, strlen(slowLogData->data) + 1) < 0) { tscError("failed to write len to file:%p since %s", pFile, terrstr()); } - tscDebug("[monitor] write slow log to file:%p, clusterId:%" PRIx64, pFile, slowLogData->clusterId); + tscDebug("monitor write slow log to file:%p, clusterId:0x%" PRIx64, pFile, slowLogData->clusterId); } static char* readFile(TdFilePtr pFile, int64_t* offset, int64_t size) { - tscDebug("[monitor] readFile slow begin pFile:%p, offset:%" PRId64 ", size:%" PRId64, pFile, *offset, size); + tscDebug("monitor readFile slow begin pFile:%p, offset:%" PRId64 ", size:%" PRId64, pFile, *offset, size); if (taosLSeekFile(pFile, *offset, SEEK_SET) < 0) { tscError("failed to seek file:%p code: %d", pFile, terrno); return NULL; @@ -481,7 +481,7 @@ static char* readFile(TdFilePtr pFile, int64_t* offset, int64_t size) { *offset += (len + 1); } - tscDebug("[monitor] readFile slow log end, data:%s, offset:%" PRId64, pCont, *offset); + tscDebug("monitor readFile slow log end, data:%s, offset:%" PRId64, pCont, *offset); return pCont; } @@ -525,7 +525,7 @@ static int32_t monitorReadSend(int64_t clusterId, TdFilePtr pFile, int64_t* offs SLOW_LOG_QUEUE_TYPE type, char* fileName) { SAppInstInfo* pInst = getAppInstByClusterId(clusterId); if (pInst == NULL) { - tscError("failed to get app instance by clusterId:%" PRId64, clusterId); + tscError("failed to get app instance by clusterId:0x%" PRIx64, clusterId); if (taosCloseFile(&pFile) != 0) { tscError("failed to close file:%p", pFile); } @@ -546,13 +546,13 @@ static void monitorSendSlowLogAtBeginning(int64_t clusterId, char** fileName, Td int64_t size = getFileSize(*fileName); if (size <= offset) { processFileInTheEnd(pFile, *fileName); - tscDebug("[monitor] monitorSendSlowLogAtBeginning delete file:%s", *fileName); + tscDebug("monitor delete file:%s", *fileName); } else { int32_t code = monitorReadSend(clusterId, pFile, &offset, size, SLOW_LOG_READ_BEGINNIG, *fileName); if (code == 0) { - tscDebug("[monitor] monitorSendSlowLogAtBeginning send slow log succ, clusterId:%" PRId64, clusterId); + tscDebug("monitor send slow log succ, clusterId:0x%" PRIx64, clusterId); } else { - tscError("[monitor] monitorSendSlowLogAtBeginning send slow log failed, clusterId:%" PRId64 ",ret:%d", clusterId, + tscError("monitor send slow log failed, clusterId:0x%" PRIx64 ",ret:%d", clusterId, code); } *fileName = NULL; @@ -562,12 +562,12 @@ static void monitorSendSlowLogAtBeginning(int64_t clusterId, char** fileName, Td static void monitorSendSlowLogAtRunning(int64_t clusterId) { void* tmp = taosHashGet(monitorSlowLogHash, &clusterId, LONG_BYTES); if (tmp == NULL) { - tscError("failed to get slow log client by clusterId:%" PRId64, clusterId); + tscError("failed to get slow log client by clusterId:0x%" PRIx64, clusterId); return; } SlowLogClient* pClient = (*(SlowLogClient**)tmp); if (pClient == NULL) { - tscError("failed to get slow log client by clusterId:%" PRId64, clusterId); + tscError("failed to get slow log client by clusterId:0x%" PRIx64, clusterId); return; } int64_t size = getFileSize(pClient->path); @@ -575,11 +575,11 @@ static void monitorSendSlowLogAtRunning(int64_t clusterId) { if (taosFtruncateFile(pClient->pFile, 0) < 0) { tscError("failed to truncate file:%p code: %d", pClient->pFile, terrno); } - tscDebug("[monitor] monitorSendSlowLogAtRunning truncate file to 0 file:%p", pClient->pFile); + tscDebug("monitor truncate file to 0 file:%p", pClient->pFile); pClient->offset = 0; } else { int32_t code = monitorReadSend(clusterId, pClient->pFile, &pClient->offset, size, SLOW_LOG_READ_RUNNING, NULL); - tscDebug("[monitor] monitorSendSlowLogAtRunning send slow log clusterId:%" PRId64 ",ret:%d", clusterId, code); + tscDebug("monitor send slow log clusterId:0x%" PRIx64 ",ret:%d", clusterId, code); } } @@ -596,13 +596,13 @@ static bool monitorSendSlowLogAtQuit(int64_t clusterId) { if (size <= pClient->offset) { processFileInTheEnd(pClient->pFile, pClient->path); pClient->pFile = NULL; - tscInfo("[monitor] monitorSendSlowLogAtQuit remove file:%s", pClient->path); + tscInfo("monitor remove file:%s", pClient->path); if ((--quitCnt) == 0) { return true; } } else { int32_t code = monitorReadSend(clusterId, pClient->pFile, &pClient->offset, size, SLOW_LOG_READ_QUIT, NULL); - tscDebug("[monitor] monitorSendSlowLogAtQuit send slow log clusterId:%" PRId64 ",ret:%d", clusterId, code); + tscDebug("monitor send slow log clusterId:0x%" PRIx64 ",ret:%d", clusterId, code); } return false; } @@ -620,7 +620,7 @@ static void monitorSendAllSlowLogAtQuit() { } else if (pClient->offset == 0) { int64_t* clusterId = (int64_t*)taosHashGetKey(pIter, NULL); int32_t code = monitorReadSend(*clusterId, pClient->pFile, &pClient->offset, size, SLOW_LOG_READ_QUIT, NULL); - tscDebug("[monitor] monitorSendAllSlowLogAtQuit send slow log clusterId:%" PRId64 ",ret:%d", *clusterId, code); + tscDebug("monitor send slow log clusterId:0x%" PRIx64 ",ret:%d", *clusterId, code); if (code == 0) { quitCnt++; } @@ -669,7 +669,7 @@ static void monitorSendAllSlowLog() { int64_t size = getFileSize(pClient->path); if (size <= 0) { if (size < 0) { - tscError("[monitor] monitorSendAllSlowLog failed to get file size:%s, err:%d", pClient->path, errno); + tscError("monitor failed to get file size:%s, err:%d", pClient->path, errno); if (errno == ENOENT) { processFileRemoved(pClient); } @@ -677,7 +677,7 @@ static void monitorSendAllSlowLog() { continue; } int32_t code = monitorReadSend(*clusterId, pClient->pFile, &pClient->offset, size, SLOW_LOG_READ_RUNNING, NULL); - tscDebug("[monitor] monitorSendAllSlowLog send slow log clusterId:%" PRId64 ",ret:%d", *clusterId, code); + tscDebug("monitor send slow log clusterId:0x%" PRIx64 ",ret:%d", *clusterId, code); } } } @@ -686,7 +686,7 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) { SAppInstInfo* pInst = getAppInstByClusterId((int64_t)clusterId); if (pInst == NULL || !pInst->serverCfg.monitorParas.tsEnableMonitor) { - tscInfo("[monitor] monitor is disabled, skip send slow log"); + tscInfo("monitor is disabled, skip send slow log"); return; } char namePrefix[PATH_MAX] = {0}; @@ -837,7 +837,7 @@ static void tscMonitorStop() { int32_t monitorInit() { int32_t code = 0; - tscInfo("[monitor] tscMonitor init"); + tscInfo("monitor init"); monitorCounterHash = (SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); if (monitorCounterHash == NULL) { @@ -887,7 +887,7 @@ int32_t monitorInit() { } void monitorClose() { - tscInfo("[monitor] tscMonitor close"); + tscInfo("monitor close"); taosWLockLatch(&monitorLock); atomic_store_32(&monitorFlag, 1); tscMonitorStop(); @@ -907,17 +907,17 @@ int32_t monitorPutData2MonitorQueue(MonitorSlowLogData data) { MonitorSlowLogData* slowLogData = NULL; if (atomic_load_32(&monitorFlag) == 1) { - tscError("[monitor] slow log thread is exiting"); + tscError("monitor slow log thread is exiting"); return -1; } code = taosAllocateQitem(sizeof(MonitorSlowLogData), DEF_QITEM, 0, (void**)&slowLogData); if (code) { - tscError("[monitor] failed to allocate slow log data"); + tscError("monitor failed to allocate slow log data"); return code; } *slowLogData = data; - tscDebug("[monitor] write slow log to queue, clusterId:%" PRIx64 " type:%s, data:%s", slowLogData->clusterId, + tscDebug("monitor write slow log to queue, clusterId:0x%" PRIx64 " type:%s, data:%s", slowLogData->clusterId, queueTypeStr[slowLogData->type], slowLogData->data); if (taosWriteQitem(monitorQueue, slowLogData) == 0) { if (tsem2_post(&monitorSem) != 0) { diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 58ba39864d..75a8801c9b 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -123,7 +123,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { } for (int32_t i = 0; i < connectRsp.epSet.numOfEps; ++i) { - tscDebug("0x%" PRIx64 " epSet.fqdn[%d]:%s port:%d, connObj:0x%" PRIx64, pRequest->requestId, i, + tscDebug("QID:0x%" PRIx64 " epSet.fqdn[%d]:%s port:%d, connObj:0x%" PRIx64, pRequest->requestId, i, connectRsp.epSet.eps[i].fqdn, connectRsp.epSet.eps[i].port, pTscObj->id); } @@ -137,7 +137,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { pTscObj->pAppInfo->clusterId = connectRsp.clusterId; pTscObj->pAppInfo->serverCfg.monitorParas = connectRsp.monitorParas; pTscObj->pAppInfo->serverCfg.enableAuditDelete = connectRsp.enableAuditDelete; - tscDebug("[monitor] paras from connect rsp, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", + tscDebug("monitor paras from connect rsp, clusterId:0x%" PRIx64 ", threshold:%d scope:%d", connectRsp.clusterId, connectRsp.monitorParas.tsSlowLogThreshold, connectRsp.monitorParas.tsSlowLogScope); lastClusterId = connectRsp.clusterId; @@ -164,7 +164,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { SAppHbMgr* pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, pTscObj->appHbMgrIdx); if (pAppHbMgr) { if (hbRegisterConn(pAppHbMgr, pTscObj->id, connectRsp.clusterId, connectRsp.connType) != 0) { - tscError("0x%" PRIx64 " failed to register conn to hbMgr", pRequest->requestId); + tscError("QID:0x%" PRIx64 " failed to register conn to hbMgr", pRequest->requestId); } } else { (void)taosThreadMutexUnlock(&clientHbMgr.lock); @@ -173,7 +173,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { } (void)taosThreadMutexUnlock(&clientHbMgr.lock); - tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, + tscDebug("QID:0x%" PRIx64 " clusterId:0x%" PRIx64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, pTscObj->pAppInfo->numOfConns); End: @@ -229,11 +229,11 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) { char dbFName[TSDB_DB_FNAME_LEN]; (void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != 0) { - tscError("0x%" PRIx64 " failed to refresh db vg info", pRequest->requestId); + tscError("QID:0x%" PRIx64 " failed to refresh db vg info", pRequest->requestId); } (void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != 0) { - tscError("0x%" PRIx64 " failed to refresh db vg info", pRequest->requestId); + tscError("QID:0x%" PRIx64 " failed to refresh db vg info", pRequest->requestId); } } } @@ -254,7 +254,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { TSDB_CODE_MND_DB_IN_DROPPING == code) { SUseDbRsp usedbRsp = {0}; if (tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp) != 0) { - tscError("0x%" PRIx64 " deserialize SUseDbRsp failed", pRequest->requestId); + tscError("QID:0x%" PRIx64 " deserialize SUseDbRsp failed", pRequest->requestId); } struct SCatalog* pCatalog = NULL; @@ -262,11 +262,11 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { int64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId; int32_t code1 = catalogGetHandle(clusterId, &pCatalog); if (code1 != TSDB_CODE_SUCCESS) { - tscWarn("0x%" PRIx64 "catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->requestId, clusterId, + tscWarn("QID:0x%" PRIx64 "catalogGetHandle failed, clusterId:0x%" PRIx64 ", error:%s", pRequest->requestId, clusterId, tstrerror(code1)); } else { if (catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid) != 0) { - tscError("0x%" PRIx64 "catalogRemoveDB failed, db:%s, uid:%" PRId64, pRequest->requestId, usedbRsp.db, + tscError("QID:0x%" PRIx64 "catalogRemoveDB failed, db:%s, uid:%" PRId64, pRequest->requestId, usedbRsp.db, usedbRsp.uid); } } @@ -293,7 +293,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { SUseDbRsp usedbRsp = {0}; if (tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp) != 0) { - tscError("0x%" PRIx64 " deserialize SUseDbRsp failed", pRequest->requestId); + tscError("QID:0x%" PRIx64 " deserialize SUseDbRsp failed", pRequest->requestId); } if (strlen(usedbRsp.db) == 0) { @@ -321,7 +321,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { SName name = {0}; if (tNameFromString(&name, usedbRsp.db, T_NAME_ACCT | T_NAME_DB) != TSDB_CODE_SUCCESS) { - tscError("0x%" PRIx64 " failed to parse db name:%s", pRequest->requestId, usedbRsp.db); + tscError("QID:0x%" PRIx64 " failed to parse db name:%s", pRequest->requestId, usedbRsp.db); } SUseDbOutput output = {0}; @@ -330,17 +330,17 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { terrno = code; if (output.dbVgroup) taosHashCleanup(output.dbVgroup->vgHash); - tscError("0x%" PRIx64 " failed to build use db output since %s", pRequest->requestId, terrstr()); + tscError("QID:0x%" PRIx64 " failed to build use db output since %s", pRequest->requestId, terrstr()); } else if (output.dbVgroup && output.dbVgroup->vgHash) { struct SCatalog* pCatalog = NULL; int32_t code1 = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (code1 != TSDB_CODE_SUCCESS) { - tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId, + tscWarn("catalogGetHandle failed, clusterId:0x%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId, tstrerror(code1)); } else { if (catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup) != 0) { - tscError("0x%" PRIx64 " failed to update db vg info, db:%s, dbId:%" PRId64, pRequest->requestId, output.db, + tscError("QID:0x%" PRIx64 " failed to update db vg info, db:%s, dbId:%" PRId64, pRequest->requestId, output.db, output.dbId); } output.dbVgroup = NULL; @@ -352,7 +352,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { char db[TSDB_DB_NAME_LEN] = {0}; if (tNameGetDbName(&name, db) != TSDB_CODE_SUCCESS) { - tscError("0x%" PRIx64 " failed to get db name since %s", pRequest->requestId, tstrerror(code)); + tscError("QID:0x%" PRIx64 " failed to get db name since %s", pRequest->requestId, tstrerror(code)); } setConnectionDB(pRequest->pTscObj, db); @@ -434,13 +434,13 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { } else { SDropDbRsp dropdbRsp = {0}; if (tDeserializeSDropDbRsp(pMsg->pData, pMsg->len, &dropdbRsp) != 0) { - tscError("0x%" PRIx64 " deserialize SDropDbRsp failed", pRequest->requestId); + tscError("QID:0x%" PRIx64 " deserialize SDropDbRsp failed", pRequest->requestId); } struct SCatalog* pCatalog = NULL; code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { if (catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid) != 0) { - tscError("0x%" PRIx64 " failed to remove db:%s", pRequest->requestId, dropdbRsp.db); + tscError("QID:0x%" PRIx64 " failed to remove db:%s", pRequest->requestId, dropdbRsp.db); } STscObj* pTscObj = pRequest->pTscObj; @@ -451,11 +451,11 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { char dbFName[TSDB_DB_FNAME_LEN] = {0}; (void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != TSDB_CODE_SUCCESS) { - tscError("0x%" PRIx64 " failed to refresh db vg info, db:%s", pRequest->requestId, dbFName); + tscError("QID:0x%" PRIx64 " failed to refresh db vg info, db:%s", pRequest->requestId, dbFName); } (void)snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); if (catalogRefreshDBVgInfo(pCatalog, &conn, dbFName) != 0) { - tscError("0x%" PRIx64 " failed to refresh db vg info, db:%s", pRequest->requestId, dbFName); + tscError("QID:0x%" PRIx64 " failed to refresh db vg info, db:%s", pRequest->requestId, dbFName); } } } diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 0a3543ac07..54f086569e 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -37,7 +37,7 @@ static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) { auditSetDnodeId(pCfg->dnodeId); code = dmWriteEps(pMgmt->pData); if (code != 0) { - dInfo("failed to set local info, dnodeId:%d clusterId:%" PRId64 " reason:%s", pCfg->dnodeId, pCfg->clusterId, + dInfo("failed to set local info, dnodeId:%d clusterId:0x%" PRIx64 " reason:%s", pCfg->dnodeId, pCfg->clusterId, tstrerror(code)); } (void)taosThreadRwlockUnlock(&pMgmt->pData->lock); diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmInt.c b/source/dnode/mgmt/mgmt_mnode/src/mmInt.c index b1b7a90db8..5a7825c808 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmInt.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmInt.c @@ -34,7 +34,7 @@ static int32_t mmRequire(const SMgmtInputOpt *pInput, bool *required) { if (!option.deploy) { *required = mmDeployRequired(pInput); if (*required) { - dInfo("deploy mnode required. dnodeId:%d<=0, clusterId:%" PRId64 "<=0, localEp:%s==firstEp", + dInfo("deploy mnode required. dnodeId:%d<=0, clusterId:0x%" PRIx64 "<=0, localEp:%s==firstEp", pInput->pData->dnodeId, pInput->pData->clusterId, tsLocalEp); } } else { diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index a0c68f8b00..ef5f59b456 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -2835,7 +2835,7 @@ int32_t mndProcessConsensusInTmr(SRpcMsg *pMsg) { if (taosArrayGetSize(pInfo->pTaskList) == 0) { mndClearConsensusRspEntry(pInfo); if (streamId == -1) { - mError("streamId is -1, streamId:%" PRIx64" in consensus-checkpointId hashMap, cont", pInfo->streamId); + mError("streamId is -1, streamId:%" PRIx64 " in consensus-checkpointId hashMap, cont", pInfo->streamId); } void *p = taosArrayPush(pStreamList, &streamId); diff --git a/source/dnode/vnode/src/tsdb/tsdbFile2.c b/source/dnode/vnode/src/tsdb/tsdbFile2.c index cdf87d5f19..ae78511e8b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile2.c @@ -249,14 +249,14 @@ int32_t tsdbTFileObjRef(STFileObj *fobj) { (void)taosThreadMutexLock(&fobj->mutex); if (fobj->ref <= 0 || fobj->state != TSDB_FSTATE_LIVE) { - tsdbError("file %s, fobj:%p ref %d", fobj->fname, fobj, fobj->ref); + tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, fobj->ref); (void)taosThreadMutexUnlock(&fobj->mutex); return TSDB_CODE_FAILED; } nRef = ++fobj->ref; (void)taosThreadMutexUnlock(&fobj->mutex); - tsdbTrace("ref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef); + tsdbTrace("ref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef); return 0; } @@ -266,11 +266,11 @@ int32_t tsdbTFileObjUnref(STFileObj *fobj) { (void)taosThreadMutexUnlock(&fobj->mutex); if (nRef < 0) { - tsdbError("file %s, fobj:%p ref %d", fobj->fname, fobj, nRef); + tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef); return TSDB_CODE_FAILED; } - tsdbTrace("unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef); + tsdbTrace("unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef); if (nRef == 0) { if (fobj->state == TSDB_FSTATE_DEAD) { tsdbRemoveFile(fobj->fname); @@ -335,14 +335,14 @@ static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) { int32_t tsdbTFileObjRemove(STFileObj *fobj) { (void)taosThreadMutexLock(&fobj->mutex); if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) { - tsdbError("file %s, fobj:%p ref %d", fobj->fname, fobj, fobj->ref); + tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, fobj->ref); (void)taosThreadMutexUnlock(&fobj->mutex); return TSDB_CODE_FAILED; } fobj->state = TSDB_FSTATE_DEAD; int32_t nRef = --fobj->ref; (void)taosThreadMutexUnlock(&fobj->mutex); - tsdbTrace("remove unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef); + tsdbTrace("remove unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef); if (nRef == 0) { tsdbTFileObjRemoveLC(fobj, true); taosMemoryFree(fobj); @@ -355,14 +355,14 @@ int32_t tsdbTFileObjRemoveUpdateLC(STFileObj *fobj) { if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) { (void)taosThreadMutexUnlock(&fobj->mutex); - tsdbError("file %s, fobj:%p ref %d", fobj->fname, fobj, fobj->ref); + tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, fobj->ref); return TSDB_CODE_FAILED; } fobj->state = TSDB_FSTATE_DEAD; int32_t nRef = --fobj->ref; (void)taosThreadMutexUnlock(&fobj->mutex); - tsdbTrace("remove unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef); + tsdbTrace("remove unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef); if (nRef == 0) { tsdbTFileObjRemoveLC(fobj, false); taosMemoryFree(fobj); diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 08b4ce240e..3d0283f857 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -292,7 +292,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) { SqlFunctionCtx* pCtx = pOperator->exprSupp.pCtx; int32_t numOfGroupCols = taosArrayGetSize(pInfo->pGroupCols); // if (type == TSDB_DATA_TYPE_FLOAT || type == TSDB_DATA_TYPE_DOUBLE) { - // qError("QInfo:0x%"PRIx64" group by not supported on double/float columns, abort", GET_TASKID(pRuntimeEnv)); + // qError("QInfo:0x%"PRIx64 " group by not supported on double/float columns, abort", GET_TASKID(pRuntimeEnv)); // return; // } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 50dfa4737f..0ca9740e7a 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -5193,7 +5193,7 @@ static int32_t doTagScanFromMetaEntryNext(SOperatorInfo* pOperator, SSDataBlock* setOperatorCompleted(pOperator); } - // qDebug("QInfo:0x%"PRIx64" create tag values results completed, rows:%d", GET_TASKID(pRuntimeEnv), count); + // qDebug("QInfo:0x%"PRIx64 " create tag values results completed, rows:%d", GET_TASKID(pRuntimeEnv), count); if (pOperator->status == OP_EXEC_DONE) { setTaskStatus(pTaskInfo, TASK_COMPLETED); } diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index 7a95087c07..8b4225f98f 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -23,7 +23,7 @@ #include "trpc.h" FORCE_INLINE int32_t schAcquireJob(int64_t refId, SSchJob **ppJob) { - qTrace("sch acquire jobId:0x%" PRIx64, refId); + qTrace("jobId:0x%" PRIx64 ", sch acquire", refId); *ppJob = (SSchJob *)taosAcquireRef(schMgmt.jobRef, refId); if (NULL == *ppJob) { return terrno; @@ -37,7 +37,7 @@ FORCE_INLINE int32_t schReleaseJob(int64_t refId) { return TSDB_CODE_SUCCESS; } - qTrace("sch release jobId:0x%" PRIx64, refId); + qTrace("jobId:0x%" PRIx64 ", sch release", refId); return taosReleaseRef(schMgmt.jobRef, refId); } @@ -46,7 +46,7 @@ FORCE_INLINE int32_t schReleaseJobEx(int64_t refId, int32_t *released) { return TSDB_CODE_SUCCESS; } - qTrace("sch release ex jobId:0x%" PRIx64, refId); + qTrace("jobId:0x%" PRIx64 ", sch release ex", refId); return taosReleaseRefEx(schMgmt.jobRef, refId, released); } @@ -122,7 +122,7 @@ int32_t schRemoveHbConnection(SSchJob *pJob, SSchTask *pTask, SQueryNodeEpId *ep SSchHbTrans *hb = taosHashGet(schMgmt.hbConnections, epId, sizeof(SQueryNodeEpId)); if (NULL == hb) { SCH_UNLOCK(SCH_WRITE, &schMgmt.hbLock); - SCH_TASK_ELOG("nodeId %d fqdn %s port %d not in hb connections", epId->nodeId, epId->ep.fqdn, epId->ep.port); + SCH_TASK_ELOG("nodeId:%d fqdn:%s port:%d not in hb connections", epId->nodeId, epId->ep.fqdn, epId->ep.port); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index ee34648a47..22a14c29ed 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -122,7 +122,7 @@ static int32_t doAppendPullOverBlock(SStreamTask* pTask, int32_t* pNumOfBlocks, pTask->info.selfChildId, pRetrieveBlock->reqId); } else { code = terrno; - stError("s-task:%s failed to append pull over block for retrieve data, QID:0x%" PRIx64" code:%s", pTask->id.idStr, + stError("s-task:%s failed to append pull over block for retrieve data, QID:0x%" PRIx64 " code:%s", pTask->id.idStr, pRetrieveBlock->reqId, tstrerror(code)); } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index f9bb48e1e0..cbdd2cd5c8 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2922,12 +2922,12 @@ void syncNodeLogConfigInfo(SSyncNode* ths, SSyncCfg* cfg, char* str) { ths->vgId, str, ths->replicaNum, ths->peersNum, ths->raftCfg.lastConfigIndex, ths->raftCfg.cfg.changeVersion, ths->restoreFinish); - sInfo("vgId:%d, %s, myNodeInfo, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str, + sInfo("vgId:%d, %s, myNodeInfo, clusterId:0x%" PRIx64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str, ths->myNodeInfo.clusterId, ths->myNodeInfo.nodeId, ths->myNodeInfo.nodeFqdn, ths->myNodeInfo.nodePort, ths->myNodeInfo.nodeRole); for (int32_t i = 0; i < ths->peersNum; ++i) { - sInfo("vgId:%d, %s, peersNodeInfo%d, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str, + sInfo("vgId:%d, %s, peersNodeInfo%d, clusterId:0x%" PRIx64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str, i, ths->peersNodeInfo[i].clusterId, ths->peersNodeInfo[i].nodeId, ths->peersNodeInfo[i].nodeFqdn, ths->peersNodeInfo[i].nodePort, ths->peersNodeInfo[i].nodeRole); } @@ -2951,7 +2951,7 @@ void syncNodeLogConfigInfo(SSyncNode* ths, SSyncCfg* cfg, char* str) { } for (int32_t i = 0; i < ths->raftCfg.cfg.totalReplicaNum; ++i) { - sInfo("vgId:%d, %s, nodeInfo%d, clusterId:%" PRId64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str, i, + sInfo("vgId:%d, %s, nodeInfo%d, clusterId:0x%" PRIx64 ", nodeId:%d, Fqdn:%s, port:%d, role:%d", ths->vgId, str, i, ths->raftCfg.cfg.nodeInfo[i].clusterId, ths->raftCfg.cfg.nodeInfo[i].nodeId, ths->raftCfg.cfg.nodeInfo[i].nodeFqdn, ths->raftCfg.cfg.nodeInfo[i].nodePort, ths->raftCfg.cfg.nodeInfo[i].nodeRole); diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index b3b69d81c0..6507476713 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -160,7 +160,7 @@ void* rpcMallocCont(int64_t contLen) { tError("failed to malloc msg, size:%" PRId64, size); return NULL; } else { - tTrace("malloc mem:%p size:%" PRId64, start, size); + tTrace("cont:%p, rpc malloc size:%" PRId64, start, size); } return start + TRANS_MSG_OVERHEAD; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e90fe9297a..000e12cc66 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -2160,7 +2160,7 @@ static FORCE_INLINE void destroyReq(void* arg) { removeReqFromSendQ(pReq); STraceId* trace = &pReq->msg.info.traceId; - tGTrace("free memory:%p, free ctx:%p", pReq, pReq->ctx); + tGTrace("free mem:%p, free ctx:%p", pReq, pReq->ctx); if (pReq->ctx) { destroyReqCtx(pReq->ctx); @@ -2938,7 +2938,7 @@ void transRefCliHandle(void* handle) { SCliConn* conn = (SCliConn*)handle; conn->ref++; - tTrace("%s conn:%p, ref %d", CONN_GET_INST_LABEL(conn), conn, conn->ref); + tTrace("%s conn:%p, ref:%d", CONN_GET_INST_LABEL(conn), conn, conn->ref); } int32_t transUnrefCliHandle(void* handle) { if (handle == NULL) { @@ -3023,7 +3023,7 @@ int32_t transReleaseCliHandle(void* handle, int32_t status) { cmsg->ctx = pCtx; STraceId* trace = &tmsg.info.traceId; - tGDebug("send release request at thread:%08" PRId64 ", malloc memory:%p", pThrd->pid, cmsg); + tGDebug("send release request at thread:%08" PRId64 ", malloc mem:%p", pThrd->pid, cmsg); if ((code = transAsyncSend(pThrd->asyncPool, &cmsg->q)) != 0) { destroyReq(cmsg); diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 73e14ebed4..57bf59dfe8 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -126,7 +126,7 @@ void transFreeMsg(void* msg) { if (msg == NULL) { return; } - tTrace("rpc free cont:%p", (char*)msg - TRANS_MSG_OVERHEAD); + tTrace("cont:%p, rpc free", (char*)msg - TRANS_MSG_OVERHEAD); taosMemoryFree((char*)msg - sizeof(STransMsgHead)); } void transSockInfo2Str(struct sockaddr* sockname, char* dst) { diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 003150bde1..e56896144f 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -408,7 +408,7 @@ int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int64_t inMem goto _error; } - // qDebug("QInfo:0x%"PRIx64" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", qId, + // qDebug("QInfo:0x%"PRIx64 " create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", qId, // pPBuf->pageSize, pPBuf->inMemPages, pPBuf->path); *pBuf = pPBuf; diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c index 0b4ed6dbc2..d2a2cab21e 100644 --- a/source/util/src/tqueue.c +++ b/source/util/src/tqueue.c @@ -214,14 +214,14 @@ int32_t taosWriteQitem(STaosQueue *queue, void *pItem) { (void)taosThreadMutexLock(&queue->mutex); if (queue->memLimit > 0 && (queue->memOfItems + pNode->size + pNode->dataSize) > queue->memLimit) { code = TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY; - uError("item:%p failed to put into queue:%p, queue mem limit: %" PRId64 ", reason: %s" PRId64, pItem, queue, + uError("item:%p, failed to put into queue:%p, queue mem limit:%" PRId64 ", reason:%s" PRId64, pItem, queue, queue->memLimit, tstrerror(code)); (void)taosThreadMutexUnlock(&queue->mutex); return code; } else if (queue->itemLimit > 0 && queue->numOfItems + 1 > queue->itemLimit) { code = TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY; - uError("item:%p failed to put into queue:%p, queue size limit: %" PRId64 ", reason: %s" PRId64, pItem, queue, + uError("item:%p, failed to put into queue:%p, queue size limit:%" PRId64 ", reason:%s" PRId64, pItem, queue, queue->itemLimit, tstrerror(code)); (void)taosThreadMutexUnlock(&queue->mutex); return code; @@ -240,7 +240,7 @@ int32_t taosWriteQitem(STaosQueue *queue, void *pItem) { (void)atomic_add_fetch_32(&queue->qset->numOfItems, 1); } - uTrace("item:%p is put into queue:%p, items:%d mem:%" PRId64, pItem, queue, queue->numOfItems, queue->memOfItems); + uTrace("item:%p, is put into queue:%p, items:%d mem:%" PRId64, pItem, queue, queue->numOfItems, queue->memOfItems); (void)taosThreadMutexUnlock(&queue->mutex); @@ -269,7 +269,7 @@ void taosReadQitem(STaosQueue *queue, void **ppItem) { if (queue->qset) { (void)atomic_sub_fetch_32(&queue->qset->numOfItems, 1); } - uTrace("item:%p is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems, + uTrace("item:%p, is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems, queue->memOfItems); } @@ -341,7 +341,7 @@ int32_t taosGetQitem(STaosQall *qall, void **ppItem) { qall->unAccessedNumOfItems -= 1; qall->unAccessMemOfItems -= pNode->dataSize; - uTrace("item:%p is fetched", *ppItem); + uTrace("item:%p, is fetched", *ppItem); } else { *ppItem = NULL; } @@ -491,7 +491,7 @@ int32_t taosReadQitemFromQset(STaosQset *qset, void **ppItem, SQueueInfo *qinfo) queue->memOfItems -= (pNode->size + pNode->dataSize); (void)atomic_sub_fetch_32(&qset->numOfItems, 1); code = 1; - uTrace("item:%p is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems - 1, + uTrace("item:%p, is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems - 1, queue->memOfItems); } diff --git a/source/util/src/tref.c b/source/util/src/tref.c index f3597b5586..dd5e820182 100644 --- a/source/util/src/tref.c +++ b/source/util/src/tref.c @@ -98,7 +98,7 @@ int32_t taosOpenRef(int32_t max, RefFp fp) { taosIncRsetCount(pSet); tsRefSetNum++; - uTrace("rsetId:%d is opened, max:%d, fp:%p refSetNum:%d", rsetId, max, fp, tsRefSetNum); + uTrace("rsetId:%d, is opened, max:%d, fp:%p refSetNum:%d", rsetId, max, fp, tsRefSetNum); } else { rsetId = TSDB_CODE_REF_FULL; taosMemoryFree(nodeList); @@ -116,7 +116,7 @@ void taosCloseRef(int32_t rsetId) { int32_t deleted = 0; if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) { - uTrace("rsetId:%d is invalid, out of range", rsetId); + uTrace("rsetId:%d, is invalid, out of range", rsetId); return; } @@ -127,9 +127,9 @@ void taosCloseRef(int32_t rsetId) { if (pSet->state == TSDB_REF_STATE_ACTIVE) { pSet->state = TSDB_REF_STATE_DELETED; deleted = 1; - uTrace("rsetId:%d is closed, count:%d", rsetId, pSet->count); + uTrace("rsetId:%d, is closed, count:%d", rsetId, pSet->count); } else { - uTrace("rsetId:%d is already closed, count:%d", rsetId, pSet->count); + uTrace("rsetId:%d, is already closed, count:%d", rsetId, pSet->count); } (void)taosThreadMutexUnlock(&tsRefMutex); @@ -144,7 +144,7 @@ int64_t taosAddRef(int32_t rsetId, void *p) { int64_t rid = 0; if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) { - uTrace("rsetId:%d p:%p failed to add, rsetId not valid", rsetId, p); + uTrace("rsetId:%d, p:%p failed to add, rsetId not valid", rsetId, p); return terrno = TSDB_CODE_REF_INVALID_ID; } @@ -152,14 +152,14 @@ int64_t taosAddRef(int32_t rsetId, void *p) { taosIncRsetCount(pSet); if (pSet->state != TSDB_REF_STATE_ACTIVE) { taosDecRsetCount(pSet); - uTrace("rsetId:%d p:%p failed to add, not active", rsetId, p); + uTrace("rsetId:%d, p:%p failed to add, not active", rsetId, p); return terrno = TSDB_CODE_REF_ID_REMOVED; } pNode = taosMemoryCalloc(sizeof(SRefNode), 1); if (pNode == NULL) { taosDecRsetCount(pSet); - uError("rsetId:%d p:%p failed to add, out of memory", rsetId, p); + uError("rsetId:%d, p:%p failed to add, out of memory", rsetId, p); return terrno; } @@ -176,7 +176,7 @@ int64_t taosAddRef(int32_t rsetId, void *p) { if (pSet->nodeList[hash]) pSet->nodeList[hash]->prev = pNode; pSet->nodeList[hash] = pNode; - uTrace("rsetId:%d p:%p rid:%" PRId64 " is added, count:%d, remain count:%d", rsetId, p, rid, pSet->count, + uTrace("rsetId:%d, p:%p rid:0x%" PRIx64 " is added, count:%d, remain count:%d", rsetId, p, rid, pSet->count, pNode->count); taosUnlockList(pSet->lockedBy + hash); @@ -195,13 +195,13 @@ void *taosAcquireRef(int32_t rsetId, int64_t rid) { void *p = NULL; if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) { - // uTrace("rsetId:%d rid:%" PRId64 " failed to acquire, rsetId not valid", rsetId, rid); + // uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to acquire, rsetId not valid", rsetId, rid); terrno = TSDB_CODE_REF_INVALID_ID; return NULL; } if (rid <= 0) { - uTrace("rsetId:%d rid:%" PRId64 " failed to acquire, rid not valid", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to acquire, rid not valid", rsetId, rid); terrno = TSDB_CODE_REF_NOT_EXIST; return NULL; } @@ -209,7 +209,7 @@ void *taosAcquireRef(int32_t rsetId, int64_t rid) { pSet = tsRefSetList + rsetId; taosIncRsetCount(pSet); if (pSet->state != TSDB_REF_STATE_ACTIVE) { - uTrace("rsetId:%d rid:%" PRId64 " failed to acquire, not active", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to acquire, not active", rsetId, rid); taosDecRsetCount(pSet); terrno = TSDB_CODE_REF_ID_REMOVED; return NULL; @@ -229,21 +229,21 @@ void *taosAcquireRef(int32_t rsetId, int64_t rid) { } if (iter >= TSDB_REF_ITER_THRESHOLD) { - uWarn("rsetId:%d rid:%" PRId64 " iter:%d", rsetId, rid, iter); + uWarn("rsetId:%d, rid:0x%" PRIx64 " iter:%d", rsetId, rid, iter); } if (pNode) { if (pNode->removed == 0) { pNode->count++; p = pNode->p; - uTrace("rsetId:%d p:%p rid:%" PRId64 " is acquired, remain count:%d", rsetId, pNode->p, rid, pNode->count); + uTrace("rsetId:%d, p:%p rid:0x%" PRIx64 " is acquired, remain count:%d", rsetId, pNode->p, rid, pNode->count); } else { terrno = TSDB_CODE_REF_NOT_EXIST; - uTrace("rsetId:%d p:%p rid:%" PRId64 " is already removed, failed to acquire", rsetId, pNode->p, rid); + uTrace("rsetId:%d, p:%p rid:0x%" PRIx64 " is already removed, failed to acquire", rsetId, pNode->p, rid); } } else { terrno = TSDB_CODE_REF_NOT_EXIST; - uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to acquire", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " is not there, failed to acquire", rsetId, rid); } taosUnlockList(pSet->lockedBy + hash); @@ -264,13 +264,13 @@ void *taosIterateRef(int32_t rsetId, int64_t rid) { SRefSet *pSet; if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) { - uTrace("rsetId:%d rid:%" PRId64 " failed to iterate, rsetId not valid", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to iterate, rsetId not valid", rsetId, rid); terrno = TSDB_CODE_REF_INVALID_ID; return NULL; } if (rid < 0) { - uTrace("rsetId:%d rid:%" PRId64 " failed to iterate, rid not valid", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to iterate, rid not valid", rsetId, rid); terrno = TSDB_CODE_REF_NOT_EXIST; return NULL; } @@ -279,7 +279,7 @@ void *taosIterateRef(int32_t rsetId, int64_t rid) { pSet = tsRefSetList + rsetId; taosIncRsetCount(pSet); if (pSet->state != TSDB_REF_STATE_ACTIVE) { - uTrace("rsetId:%d rid:%" PRId64 " failed to iterate, rset not active", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to iterate, rset not active", rsetId, rid); terrno = TSDB_CODE_REF_ID_REMOVED; taosDecRsetCount(pSet); return NULL; @@ -301,11 +301,11 @@ void *taosIterateRef(int32_t rsetId, int64_t rid) { } if (iter >= TSDB_REF_ITER_THRESHOLD) { - uWarn("rsetId:%d rid:%" PRId64 " iter:%d", rsetId, rid, iter); + uWarn("rsetId:%d, rid:0x%" PRIx64 " iter:%d", rsetId, rid, iter); } if (pNode == NULL) { - uError("rsetId:%d rid:%" PRId64 " not there, quit", rsetId, rid); + uError("rsetId:%d, rid:0x%" PRIx64 " not there, quit", rsetId, rid); terrno = TSDB_CODE_REF_NOT_EXIST; taosUnlockList(pSet->lockedBy + hash); taosDecRsetCount(pSet); @@ -345,9 +345,9 @@ void *taosIterateRef(int32_t rsetId, int64_t rid) { pNode->count++; // acquire it newP = pNode->p; taosUnlockList(pSet->lockedBy + hash); - uTrace("rsetId:%d p:%p rid:%" PRId64 " is returned", rsetId, newP, rid); + uTrace("rsetId:%d, p:%p rid:0x%" PRIx64 " is returned", rsetId, newP, rid); } else { - uTrace("rsetId:%d the list is over", rsetId); + uTrace("rsetId:%d, the list is over", rsetId); } if (rid > 0) taosReleaseRef(rsetId, rid); // release the current one @@ -371,13 +371,13 @@ int32_t taosListRef() { if (pSet->state == TSDB_REF_STATE_EMPTY) continue; - uInfo("rsetId:%d state:%d count:%d", i, pSet->state, pSet->count); + uInfo("rsetId:%d, state:%d count:%d", i, pSet->state, pSet->count); for (int32_t j = 0; j < pSet->max; ++j) { pNode = pSet->nodeList[j]; while (pNode) { - uInfo("rsetId:%d p:%p rid:%" PRId64 "count:%d", i, pNode->p, pNode->rid, pNode->count); + uInfo("rsetId:%d, p:%p rid:0x%" PRIx64 "count:%d", i, pNode->p, pNode->rid, pNode->count); pNode = pNode->next; num++; } @@ -398,18 +398,18 @@ static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int3 int32_t code = 0; if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) { - uTrace("rsetId:%d rid:%" PRId64 " failed to remove, rsetId not valid", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to remove, rsetId not valid", rsetId, rid); return terrno = TSDB_CODE_REF_INVALID_ID; } if (rid <= 0) { - uTrace("rsetId:%d rid:%" PRId64 " failed to remove, rid not valid", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to remove, rid not valid", rsetId, rid); return terrno = TSDB_CODE_REF_NOT_EXIST; } pSet = tsRefSetList + rsetId; if (pSet->state == TSDB_REF_STATE_EMPTY) { - uTrace("rsetId:%d rid:%" PRId64 " failed to remove, cleaned", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " failed to remove, cleaned", rsetId, rid); return terrno = TSDB_CODE_REF_ID_REMOVED; } @@ -425,7 +425,7 @@ static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int3 } if (iter >= TSDB_REF_ITER_THRESHOLD) { - uWarn("rsetId:%d rid:%" PRId64 " iter:%d", rsetId, rid, iter); + uWarn("rsetId:%d, rid:0x%" PRIx64 " iter:%d", rsetId, rid, iter); } if (pNode) { @@ -444,10 +444,10 @@ static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int3 } released = 1; } else { - uTrace("rsetId:%d p:%p rid:%" PRId64 " is released, remain count %d", rsetId, pNode->p, rid, pNode->count); + uTrace("rsetId:%d, p:%p rid:0x%" PRIx64 " is released, remain count %d", rsetId, pNode->p, rid, pNode->count); } } else { - uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to release/remove", rsetId, rid); + uTrace("rsetId:%d, rid:0x%" PRIx64 " is not there, failed to release/remove", rsetId, rid); terrno = TSDB_CODE_REF_NOT_EXIST; code = terrno; } @@ -455,7 +455,7 @@ static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int3 taosUnlockList(pSet->lockedBy + hash); if (released) { - uTrace("rsetId:%d p:%p rid:%" PRId64 " is removed, count:%d, free mem: %p", rsetId, pNode->p, rid, pSet->count, + uTrace("rsetId:%d, p:%p rid:0x%" PRIx64 " is removed, count:%d, free mem: %p", rsetId, pNode->p, rid, pSet->count, pNode); (*pSet->fp)(pNode->p); taosMemoryFree(pNode); @@ -489,12 +489,12 @@ static void taosInitRefModule(void) { (void)taosThreadMutexInit(&tsRefMutex, NUL static void taosIncRsetCount(SRefSet *pSet) { (void)atomic_add_fetch_32(&pSet->count, 1); - // uTrace("rsetId:%d inc count:%d", pSet->rsetId, count); + // uTrace("rsetId:%d, inc count:%d", pSet->rsetId, count); } static void taosDecRsetCount(SRefSet *pSet) { int32_t count = atomic_sub_fetch_32(&pSet->count, 1); - // uTrace("rsetId:%d dec count:%d", pSet->rsetId, count); + // uTrace("rsetId:%d, dec count:%d", pSet->rsetId, count); if (count > 0) return; @@ -509,7 +509,7 @@ static void taosDecRsetCount(SRefSet *pSet) { taosMemoryFreeClear(pSet->lockedBy); tsRefSetNum--; - uTrace("rsetId:%d is cleaned, refSetNum:%d count:%d", pSet->rsetId, tsRefSetNum, pSet->count); + uTrace("rsetId:%d, is cleaned, refSetNum:%d count:%d", pSet->rsetId, tsRefSetNum, pSet->count); } (void)taosThreadMutexUnlock(&tsRefMutex); From 42e39a59dfeeda2dcb7fe17549cdec5ee772413b Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 19:15:35 +0800 Subject: [PATCH 18/22] enh: adjust log format --- source/client/src/clientEnv.c | 4 ++-- source/client/src/clientImpl.c | 11 ++++++----- source/client/src/clientMain.c | 4 ++-- source/dnode/vnode/src/sma/smaRollup.c | 10 +++++----- source/dnode/vnode/src/tsdb/tsdbRead2.c | 2 +- source/libs/catalog/src/catalog.c | 2 +- source/libs/executor/src/aggregateoperator.c | 4 ++-- source/libs/executor/src/executil.c | 2 +- source/libs/executor/src/executor.c | 2 +- source/libs/executor/src/operator.c | 6 +++--- source/libs/function/src/tudf.c | 6 +++--- source/libs/function/src/udfd.c | 6 +++--- source/libs/parser/src/parInsertStmt.c | 16 ++++++++-------- source/libs/parser/src/parInsertUtil.c | 6 +++--- source/libs/parser/src/parTranslater.c | 10 +++++----- source/libs/qcom/src/queryUtil.c | 2 +- source/libs/qworker/src/qwDbg.c | 2 +- source/libs/scheduler/src/schJob.c | 10 +++++----- source/libs/scheduler/src/scheduler.c | 2 +- 19 files changed, 54 insertions(+), 53 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 84864766f9..e9c35f2599 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -262,14 +262,14 @@ static void deregisterRequest(SRequestObj *pRequest) { if ((pRequest->pQuery && pRequest->pQuery->pRoot && QUERY_NODE_VNODE_MODIFY_STMT == pRequest->pQuery->pRoot->type && (0 == ((SVnodeModifyOpStmt *)pRequest->pQuery->pRoot)->sqlNodeType)) || QUERY_NODE_VNODE_MODIFY_STMT == pRequest->stmtType) { - tscDebug("req:0x%" PRIx64 ", insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 + tscDebug("req:0x%" PRIx64 ", insert duration:%" PRId64 "us, parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", pRequest->self, duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, pRequest->metric.planCostUs, pRequest->metric.execCostUs); (void)atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration); reqType = SLOW_LOG_TYPE_INSERT; } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { - tscDebug("req:0x%" PRIx64 ", query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 + tscDebug("req:0x%" PRIx64 ", query duration:%" PRId64 "us, parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", pRequest->self, duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, pRequest->metric.planCostUs, pRequest->metric.execCostUs); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 3efa0a2130..42bebd5675 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -264,7 +264,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, } } - tscDebugL("req:0x%" PRIx64 ", SQL:%s, QID:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); + tscDebugL("req:0x%" PRIx64 ", QID:0x%" PRIx64 ", build request", (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); return TSDB_CODE_SUCCESS; } @@ -1030,7 +1030,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { break; } default: - tscError("req:0x%" PRIx64 ", invalid exec result for request type %d, QID:0x%" PRIx64, pRequest->self, pRequest->type, + tscError("req:0x%" PRIx64 ", invalid exec result for request type:%d, QID:0x%" PRIx64, pRequest->self, pRequest->type, pRequest->requestId); code = TSDB_CODE_APP_ERROR; } @@ -1212,7 +1212,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { pRequest->requestId); if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) { - tscDebug("re:0x%" PRIx64 ", client retry to handle the error, code:%s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, + tscDebug("req:0x%" PRIx64 ", client retry to handle the error, code:%s, tryCount:%d, QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->retry, pRequest->requestId); if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) { tscError("req:0x%" PRIx64 ", remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); @@ -1221,7 +1221,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { return; } - tscDebug("req:0x%" PRIx64 ", schedulerExecCb request type %s", pRequest->self, TMSG_INFO(pRequest->type)); + tscTrace("req:0x%" PRIx64 ", scheduler exec cb, request type:%s", pRequest->self, TMSG_INFO(pRequest->type)); if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) { if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) { tscError("req:0x%" PRIx64 ", remove meta failed, QID:0x%" PRIx64, pRequest->self, pRequest->requestId); @@ -2983,7 +2983,8 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s } taosMemoryFree(param); - tscDebug("connObj:0x%" PRIx64 ", res:%p created, taos_query end with sql:%s", *(int64_t*)taos, pRequest, sql); + tscDebug("connObj:0x%" PRIx64 ", res:%p created, taos_query end, affectRows:%" PRId64, *(int64_t*)taos, pRequest, + pRequest->body.resInfo.numOfRows); return pRequest; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 8540bf9449..184fd4a112 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -539,7 +539,7 @@ void taos_free_result(TAOS_RES *res) { if (TD_RES_QUERY(res)) { SRequestObj *pRequest = (SRequestObj *)res; - tscDebug("QID:0x%" PRIx64 ", taos_free_result start to free query", pRequest->requestId); + tscDebug("QID:0x%" PRIx64 ", call taos_free_result to free query", pRequest->requestId); destroyRequest(pRequest); return; } @@ -1470,7 +1470,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { code = pRequest->prevCode; terrno = code; pRequest->code = code; - tscDebug("req:0x%" PRIx64 ", call sync query cb with code: %s", pRequest->self, tstrerror(code)); + tscDebug("req:0x%" PRIx64 ", call sync query cb with code:%s", pRequest->self, tstrerror(code)); doRequestCallback(pRequest, code); return; } diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 3c5634f763..1a33a69f2b 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -1017,20 +1017,20 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, int64_t version, void *pReq, void *pMsg, int32_t code = 0; if ((code = atomic_load_32(&SMA_RSMA_STAT(pSma)->execStat))) { - smaError("vgId:%d, failed to process rsma submit since invalid exec code: %s", SMA_VID(pSma), tstrerror(code)); + smaError("vgId:%d, failed to process rsma submit since invalid exec code:%s", SMA_VID(pSma), tstrerror(code)); goto _exit; } STbUidStore uidStore = {0}; if ((code = tdFetchSubmitReqSuids(pReq, &uidStore)) < 0) { - smaError("vgId:%d, failed to process rsma submit fetch suid since: %s", SMA_VID(pSma), tstrerror(code)); + smaError("vgId:%d, failed to process rsma submit fetch suid since %s", SMA_VID(pSma), tstrerror(code)); goto _exit; } if (uidStore.suid != 0) { if ((code = tdExecuteRSmaAsync(pSma, version, pMsg, len, STREAM_INPUT__DATA_SUBMIT, uidStore.suid)) < 0) { - smaError("vgId:%d, failed to process rsma submit exec 1 since: %s", SMA_VID(pSma), tstrerror(code)); + smaError("vgId:%d, failed to process rsma submit exec 1 since %s", SMA_VID(pSma), tstrerror(code)); goto _exit; } @@ -1054,13 +1054,13 @@ int32_t tdProcessRSmaDelete(SSma *pSma, int64_t version, void *pReq, void *pMsg, int32_t code = 0; if ((code = atomic_load_32(&SMA_RSMA_STAT(pSma)->execStat))) { - smaError("vgId:%d, failed to process rsma delete since invalid exec code: %s", SMA_VID(pSma), tstrerror(code)); + smaError("vgId:%d, failed to process rsma delete since invalid exec code:%s", SMA_VID(pSma), tstrerror(code)); goto _exit; } SDeleteRes *pDelRes = pReq; if ((code = tdExecuteRSmaAsync(pSma, version, pMsg, len, STREAM_INPUT__REF_DATA_BLOCK, pDelRes->suid)) < 0) { - smaError("vgId:%d, failed to process rsma submit exec 1 since: %s", SMA_VID(pSma), tstrerror(code)); + smaError("vgId:%d, failed to process rsma submit exec 1 since %s", SMA_VID(pSma), tstrerror(code)); goto _exit; } _exit: diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 57041e851a..8baf08ef94 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -230,7 +230,7 @@ static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pC if (IS_VAR_DATA_TYPE(pCols[i].type)) { pSupInfo->buildBuf[i] = taosMemoryMalloc(pCols[i].bytes); if (pSupInfo->buildBuf[i] == NULL) { - tsdbError("failed to prepare memory for set columnId slot list, size:%d, code: %s", pCols[i].bytes, + tsdbError("failed to prepare memory for set columnId slot list, size:%d, code:%s", pCols[i].bytes, tstrerror(terrno)); } TSDB_CHECK_NULL(pSupInfo->buildBuf[i], code, lino, _end, terrno); diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index b70c018110..c775893e53 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -1973,7 +1973,7 @@ int32_t catalogClearCache(void) { int32_t code = ctgClearCacheEnqueue(NULL, false, false, false, true); - qInfo("clear catalog cache end, code: %s", tstrerror(code)); + qInfo("clear catalog cache end, code:%s", tstrerror(code)); CTG_API_LEAVE_NOLOCK(code); } diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c index 1b8e8298b4..55166d8c27 100644 --- a/source/libs/executor/src/aggregateoperator.c +++ b/source/libs/executor/src/aggregateoperator.c @@ -360,7 +360,7 @@ int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) { if (pCtx[k].fpSet.cleanup != NULL) { pCtx[k].fpSet.cleanup(&pCtx[k]); } - qError("%s aggregate function error happens, code: %s", GET_TASKID(pOperator->pTaskInfo), tstrerror(code)); + qError("%s aggregate function error happens, code:%s", GET_TASKID(pOperator->pTaskInfo), tstrerror(code)); return code; } } @@ -803,7 +803,7 @@ int32_t applyAggFunctionOnPartialTuples(SExecTaskInfo* taskInfo, SqlFunctionCtx* if (pCtx[k].fpSet.cleanup != NULL) { pCtx[k].fpSet.cleanup(&pCtx[k]); } - qError("%s apply functions error, code: %s", GET_TASKID(taskInfo), tstrerror(code)); + qError("%s apply functions error, code:%s", GET_TASKID(taskInfo), tstrerror(code)); taskInfo->code = code; return code; } diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 7bff5550df..ac6b089de1 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -2911,7 +2911,7 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags int32_t code = getTableList(pHandle->vnode, pScanNode, pTagCond, pTagIndexCond, pTableListInfo, digest, idStr, &pTaskInfo->storageAPI); if (code != TSDB_CODE_SUCCESS) { - qError("failed to getTableList, code: %s", tstrerror(code)); + qError("failed to getTableList, code:%s", tstrerror(code)); return code; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index efe0792a76..ce23a9063f 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -645,7 +645,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, int32_t code = createExecTaskInfo(pSubplan, pTask, readHandle, taskId, vgId, sql, model); if (code != TSDB_CODE_SUCCESS || NULL == *pTask) { - qError("failed to createExecTaskInfo, code: %s", tstrerror(code)); + qError("failed to createExecTaskInfo, code:%s", tstrerror(code)); goto _error; } diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c index 5d25a81f6f..057deed038 100644 --- a/source/libs/executor/src/operator.c +++ b/source/libs/executor/src/operator.c @@ -349,7 +349,7 @@ int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHand if (code) { pTaskInfo->code = code; tableListDestroy(pTableListInfo); - qError("failed to createScanTableListInfo, code: %s", tstrerror(code)); + qError("failed to createScanTableListInfo, code:%s", tstrerror(code)); return code; } @@ -387,7 +387,7 @@ int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHand if (code) { pTaskInfo->code = code; tableListDestroy(pTableListInfo); - qError("failed to createScanTableListInfo, code: %s", tstrerror(code)); + qError("failed to createScanTableListInfo, code:%s", tstrerror(code)); return code; } } @@ -417,7 +417,7 @@ int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHand pTagIndexCond, pTaskInfo); if (code != TSDB_CODE_SUCCESS) { pTaskInfo->code = code; - qError("failed to getTableList, code: %s", tstrerror(code)); + qError("failed to getTableList, code:%s", tstrerror(code)); tableListDestroy(pTableListInfo); return code; } diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 3ee35b921d..5c5a98cb2e 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -1733,7 +1733,7 @@ void onUdfcPipeWrite(uv_write_t *write, int32_t status) { void onUdfcPipeConnect(uv_connect_t *connect, int32_t status) { SClientUvTaskNode *uvTask = connect->data; if (status != 0) { - fnError("client connect error, task seq: %" PRId64 ", code: %s", uvTask->seqNum, uv_strerror(status)); + fnError("client connect error, task seq: %" PRId64 ", code:%s", uvTask->seqNum, uv_strerror(status)); } uvTask->errCode = status; @@ -1812,7 +1812,7 @@ int32_t udfcQueueUvTask(SClientUvTaskNode *uvTask) { uv_mutex_unlock(&udfc->taskQueueMutex); int32_t code = uv_async_send(&udfc->loopTaskAync); if (code != 0) { - fnError("udfc queue uv task to event loop failed. code: %s", uv_strerror(code)); + fnError("udfc queue uv task to event loop failed. code:%s", uv_strerror(code)); return TSDB_CODE_UDF_UV_EXEC_FAILURE; } @@ -1884,7 +1884,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) { int32_t err = uv_write(write, (uv_stream_t *)pipe, &uvTask->reqBuf, 1, onUdfcPipeWrite); if (err != 0) { taosMemoryFree(write); - fnError("udfc event loop start req_rsp task uv_write failed. uvtask: %p, code: %s", uvTask, uv_strerror(err)); + fnError("udfc event loop start req_rsp task uv_write failed. uvtask: %p, code:%s", uvTask, uv_strerror(err)); } code = err; } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index ecb24fc77a..80dfdc5ce3 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -1106,7 +1106,7 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { } if (pMsg->code != TSDB_CODE_SUCCESS) { - fnError("udfd rpc error. code: %s", tstrerror(pMsg->code)); + fnError("udfd rpc error. code:%s", tstrerror(pMsg->code)); msgInfo->code = pMsg->code; goto _return; } @@ -1312,7 +1312,7 @@ void udfdOnWrite(uv_write_t *req, int status) { TAOS_UDF_CHECK_PTR_RVOID(req); SUvUdfWork *work = (SUvUdfWork *)req->data; if (status < 0) { - fnError("udfd send response error, length: %zu code: %s", work->output.len, uv_err_name(status)); + fnError("udfd send response error, length: %zu code:%s", work->output.len, uv_err_name(status)); } // remove work from the connection work list if (work->conn != NULL) { @@ -1477,7 +1477,7 @@ void udfdPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { void udfdOnNewConnection(uv_stream_t *server, int status) { TAOS_UDF_CHECK_PTR_RVOID(server); if (status < 0) { - fnError("udfd new connection error. code: %s", uv_strerror(status)); + fnError("udfd new connection error. code:%s", uv_strerror(status)); return; } int32_t code = 0; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index 9f9077d1b6..f2783480c1 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -370,7 +370,7 @@ int32_t qBindStmtStbColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind code = tRowBuildFromBind(pBindInfos, boundInfo->numOfBound, colInOrder, *pTSchema, pCols, &pDataBlock->ordered, &pDataBlock->duplicateTs); - qDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum); + parserDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum); _return: @@ -423,7 +423,7 @@ int32_t qBindStmtColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, c } } - qDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum); + parserDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum); _return: @@ -472,7 +472,7 @@ int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bi IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1, initCtxAsText, checkWKB); - qDebug("stmt col %d bind %d rows data", colIdx, rowNum); + parserDebug("stmt col %d bind %d rows data", colIdx, rowNum); _return: @@ -750,7 +750,7 @@ int32_t qBindStmtStbColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bin code = tRowBuildFromBind2(pBindInfos, boundInfo->numOfBound, colInOrder, *pTSchema, pCols, &pDataBlock->ordered, &pDataBlock->duplicateTs); - qDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum); + parserDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum); _return: if (ncharBinds) { @@ -867,7 +867,7 @@ int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, } } - qDebug("stmt2 all %d columns bind %d rows data as col format", boundInfo->numOfBound, rowNum); + parserDebug("stmt2 all %d columns bind %d rows data as col format", boundInfo->numOfBound, rowNum); _return: @@ -916,7 +916,7 @@ int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* b IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1, initCtxAsText, checkWKB); - qDebug("stmt col %d bind %d rows data", colIdx, rowNum); + parserDebug("stmt col %d bind %d rows data", colIdx, rowNum); _return: @@ -1096,7 +1096,7 @@ int32_t qResetStmtColumns(SArray* pCols, bool deepClear) { for (int32_t i = 0; i < colNum; ++i) { SColData* pCol = (SColData*)taosArrayGet(pCols, i); if (pCol == NULL) { - qError("qResetStmtColumns column is NULL"); + parserError("qResetStmtColumns column is NULL"); return terrno; } if (deepClear) { @@ -1116,7 +1116,7 @@ int32_t qResetStmtDataBlock(STableDataCxt* block, bool deepClear) { for (int32_t i = 0; i < colNum; ++i) { SColData* pCol = (SColData*)taosArrayGet(pBlock->pData->aCol, i); if (pCol == NULL) { - qError("qResetStmtDataBlock column is NULL"); + parserError("qResetStmtDataBlock column is NULL"); return terrno; } if (deepClear) { diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 127155d105..9c7ce74072 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -298,7 +298,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat } if (TSDB_CODE_SUCCESS == code) { *pOutput = pTableCxt; - qDebug("uid:%" PRId64 ", create table data context, code:%d, vgId:%d", pTableMeta->uid, code, pTableMeta->vgId); + parserDebug("uid:%" PRId64 ", create table data context, code:%d, vgId:%d", pTableMeta->uid, code, pTableMeta->vgId); } else { insDestroyTableDataCxt(pTableCxt); } @@ -478,7 +478,7 @@ static int32_t fillVgroupDataCxt(STableDataCxt* pTableCxt, SVgroupDataCxt* pVgCx taosMemoryFreeClear(pTableCxt->pData); } - qDebug("uid:%" PRId64 ", add table data context to vgId:%d", pTableCxt->pMeta->uid, pVgCxt->vgId); + parserDebug("uid:%" PRId64 ", add table data context to vgId:%d", pTableCxt->pMeta->uid, pVgCxt->vgId); return code; } @@ -760,7 +760,7 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks, bool // skip the table has no data to insert // eg: import a csv without valid data // if (0 == taosArrayGetSize(pTableCxt->pData->aRowP)) { - // qWarn("no row in tableDataCxt uid:%" PRId64 " ", pTableCxt->pMeta->uid); + // parserWarn("no row in tableDataCxt uid:%" PRId64 " ", pTableCxt->pMeta->uid); // p = taosHashIterate(pTableHash, p); // continue; // } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index e715611df2..d47391f358 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -7015,7 +7015,7 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* bool stableQuery = false; SEqCondTbNameTableInfo* pInfo = NULL; - qDebug("start to update stable vg for tbname optimize, aTableNum:%d", aTableNum); + parserDebug("start to update stable vg for tbname optimize, aTableNum:%d", aTableNum); for (int i = 0; i < aTableNum; ++i) { pInfo = taosArrayGet(aTables, i); int32_t numOfVgs = pInfo->pRealTable->pVgroupList->numOfVgroups; @@ -7084,7 +7084,7 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* } } - qDebug("before ctbname optimize, code:%d, aTableNum:%d, nTbls:%d, stableQuery:%d", code, aTableNum, nTbls, + parserDebug("before ctbname optimize, code:%d, aTableNum:%d, nTbls:%d, stableQuery:%d", code, aTableNum, nTbls, stableQuery); if (TSDB_CODE_SUCCESS == code && 1 == aTableNum && 1 == nTbls && stableQuery && NULL == pInfo->pRealTable->pTsmas) { @@ -13001,7 +13001,7 @@ static int32_t readFromFile(char* pName, int32_t* len, char** buf) { int64_t s = taosReadFile(tfile, *buf, *len); if (s != *len) { int32_t code = taosCloseFile(&tfile); - qError("failed to close file: %s in %s:%d, err: %s", pName, __func__, __LINE__, tstrerror(code)); + parserError("failed to close file: %s in %s:%d, err: %s", pName, __func__, __LINE__, tstrerror(code)); taosMemoryFreeClear(*buf); return TSDB_CODE_APP_ERROR; } @@ -15835,7 +15835,7 @@ int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut code = serializeVgroupCreateTableBatch(pTbBatch, pBufArray); if (TSDB_CODE_SUCCESS != code) { - qError("failed to serialize create table batch msg, since:%s", tstrerror(code)); + parserError("failed to serialize create table batch msg, since:%s", tstrerror(code)); taosHashCancelIterate(pVgroupHashmap, pTbBatch); break; } @@ -15914,7 +15914,7 @@ static int32_t rewriteCreateTableFromFile(STranslateContext* pCxt, SQuery* pQuer taosHashClear(pModifyStmt->pVgroupsHashObj); if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_INVALID_MSG_LEN == code) { - qError("maxInsertBatchRows may need to be reduced, current:%d", tsMaxInsertBatchRows); + parserError("maxInsertBatchRows may need to be reduced, current:%d", tsMaxInsertBatchRows); } taosHashCleanup(pModifyStmt->pVgroupsHashObj); return code; diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 35f258c554..74bb75077c 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -343,7 +343,7 @@ void destroyQueryExecRes(SExecResult* pRes) { break; } default: - qError("invalid exec result for request type %d", pRes->msgType); + qError("invalid exec result for request type:%d", pRes->msgType); } } // clang-format on diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c index e430990c0d..a3dd91d512 100644 --- a/source/libs/qworker/src/qwDbg.c +++ b/source/libs/qworker/src/qwDbg.c @@ -237,7 +237,7 @@ int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int tmsgSendRsp(&rpcRsp); - qDebug("response %s msg, code: %s", TMSG_INFO(rspType), tstrerror(code)); + qDebug("response %s msg, code:%s", TMSG_INFO(rspType), tstrerror(code)); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index e8135efce5..bd79d06b2f 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -465,7 +465,7 @@ void schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes) { pJob->execRes.res = NULL; SCH_UNLOCK(SCH_WRITE, &pJob->resLock); - SCH_JOB_DLOG("execRes dumped, code: %s", tstrerror(pRes->code)); + SCH_JOB_DLOG("execRes dumped, code:%s", tstrerror(pRes->code)); } int32_t schDumpJobFetchRes(SSchJob *pJob, void **pData) { @@ -519,9 +519,9 @@ int32_t schNotifyUserExecRes(SSchJob *pJob) { schDumpJobExecRes(pJob, pRes); - SCH_JOB_DLOG("sch start to invoke exec cb, code: %s", tstrerror(pJob->errCode)); + SCH_JOB_DLOG("sch start to invoke exec cb, code:%s", tstrerror(pJob->errCode)); (*pJob->userRes.execFp)(pRes, pJob->userRes.cbParam, atomic_load_32(&pJob->errCode)); - SCH_JOB_DLOG("sch end from exec cb, code: %s", tstrerror(pJob->errCode)); + SCH_JOB_DLOG("sch end from exec cb, code:%s", tstrerror(pJob->errCode)); return TSDB_CODE_SUCCESS; } @@ -534,9 +534,9 @@ int32_t schNotifyUserFetchRes(SSchJob *pJob) { atomic_store_32(&pJob->errCode, code); } - SCH_JOB_DLOG("sch start to invoke fetch cb, code: %s", tstrerror(pJob->errCode)); + SCH_JOB_DLOG("sch start to invoke fetch cb, code:%s", tstrerror(pJob->errCode)); (*pJob->userRes.fetchFp)(pRes, pJob->userRes.cbParam, atomic_load_32(&pJob->errCode)); - SCH_JOB_DLOG("sch end from fetch cb, code: %s", tstrerror(pJob->errCode)); + SCH_JOB_DLOG("sch end from fetch cb, code:%s", tstrerror(pJob->errCode)); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 9437bf73d6..541a0b99f7 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -171,7 +171,7 @@ void schedulerFreeJob(int64_t *jobId, int32_t errCode) { return; } - SCH_JOB_DLOG("start to free job 0x%" PRIx64 ", code:%s", *jobId, tstrerror(errCode)); + SCH_JOB_DLOG("jobId:0x%" PRIx64 ", start to free, code:%s", *jobId, tstrerror(errCode)); (void)schHandleJobDrop(pJob, errCode); // ignore any error int32_t released = false; From d031e32019a9220775a311e28954db7ecde30836 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 19:41:30 +0800 Subject: [PATCH 19/22] enh: adjust log format --- source/client/src/clientImpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 42bebd5675..83cf924a02 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -264,7 +264,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, } } - tscDebugL("req:0x%" PRIx64 ", QID:0x%" PRIx64 ", build request", (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); + tscDebugL("req:0x%" PRIx64 ", QID:0x%" PRIx64 ", build request", (*pRequest)->self, (*pRequest)->requestId); return TSDB_CODE_SUCCESS; } From db763d692301c5501cbef7386ce54281f6963d75 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 20:23:58 +0800 Subject: [PATCH 20/22] enh: adjust log format --- source/client/src/clientEnv.c | 8 ++++---- source/client/src/clientImpl.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index e9c35f2599..33d0909d81 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -458,7 +458,7 @@ void destroyTscObj(void *pObj) { STscObj *pTscObj = pObj; int64_t tscId = pTscObj->id; - tscTrace("connObj:%" PRIx64 ", begin to destroy, p:%p", tscId, pTscObj); + tscTrace("connObj:%" PRIx64 ", begin destroy, p:%p", tscId, pTscObj); SClientHbKey connKey = {.tscRid = pTscObj->id, .connType = pTscObj->connType}; hbDeregisterConn(pTscObj, connKey); @@ -476,7 +476,7 @@ void destroyTscObj(void *pObj) { (void)taosThreadMutexDestroy(&pTscObj->mutex); taosMemoryFree(pTscObj); - tscTrace("connObj:0x%" PRIx64 ", end to destroy, p:%p", tscId, pTscObj); + tscTrace("connObj:0x%" PRIx64 ", end destroy, p:%p", tscId, pTscObj); } int32_t createTscObj(const char *user, const char *auth, const char *db, int32_t connType, SAppInstInfo *pAppInfo, @@ -682,7 +682,7 @@ void doDestroyRequest(void *p) { SRequestObj *pRequest = (SRequestObj *)p; uint64_t reqId = pRequest->requestId; - tscDebug("QID:0x%" PRIx64 ", begin to destroy request p:%p", reqId, pRequest); + tscDebug("QID:0x%" PRIx64 ", begin destroy request p:%p", reqId, pRequest); int64_t nextReqRefId = pRequest->relation.nextRefId; @@ -724,7 +724,7 @@ void doDestroyRequest(void *p) { taosMemoryFreeClear(pRequest->effectiveUser); taosMemoryFreeClear(pRequest->sqlstr); taosMemoryFree(pRequest); - tscDebug("QID:0x%" PRIx64 ", end to destroy request p:%p", reqId, pRequest); + tscDebug("QID:0x%" PRIx64 ", end destroy request p:%p", reqId, pRequest); destroyNextReq(nextReqRefId); } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 83cf924a02..8a27b84612 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2983,8 +2983,7 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s } taosMemoryFree(param); - tscDebug("connObj:0x%" PRIx64 ", res:%p created, taos_query end, affectRows:%" PRId64, *(int64_t*)taos, pRequest, - pRequest->body.resInfo.numOfRows); + tscDebug("connObj:0x%" PRIx64 ", res:%p created, taos_query end", *(int64_t*)taos, pRequest); return pRequest; } From fa36c140571741dda0a4e61998d5ec570f1c1002 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 20:33:22 +0800 Subject: [PATCH 21/22] fix: compile errors --- include/libs/function/taosudf.h | 8 ++++---- include/libs/qcom/query.h | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h index ece98ac243..cef0eee84b 100644 --- a/include/libs/function/taosudf.h +++ b/include/libs/function/taosudf.h @@ -347,10 +347,10 @@ typedef int32_t (*TScriptCloseFunc)(); extern int32_t udfDebugFlag; #define udfFatal(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF FATAL ", 1, 255, __VA_ARGS__); }} #define udfError(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF ERROR ", 1, 255, __VA_ARGS__); }} - #define udfWarn(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF WARN ", 2, 255, __VA_ARGS__); }} - #define udfInfo(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF INFO ", 2, 255, __VA_ARGS__); }} - #define udfDebug(...) { if (udfDebugFlag & 4) { taosPrintLog("UDF DEBUG ", 4, udfDebugFlag, __VA_ARGS__); }} - #define udfTrace(...) { if (udfDebugFlag & 8) { taosPrintLog("UDF TRACE ", 8, udfDebugFlag, __VA_ARGS__); }} + #define udfWarn(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF WARN ", 2, 255, __VA_ARGS__); }} + #define udfInfo(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF INFO ", 2, 255, __VA_ARGS__); }} + #define udfDebug(...) { if (udfDebugFlag & 4) { taosPrintLog("UDF DEBUG ", 4, udfDebugFlag, __VA_ARGS__); }} + #define udfTrace(...) { if (udfDebugFlag & 8) { taosPrintLog("UDF TRACE ", 8, udfDebugFlag, __VA_ARGS__); }} #endif // clang-format on diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 065c7f92e8..6cb44ac13b 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -410,14 +410,14 @@ void* getTaskPoolWorkerCb(); ((*(_ctbname) == 't') && (0 == strncmp(_ctbname, TSDB_AUDIT_CTB_OPERATION, TSDB_AUDIT_CTB_OPERATION_LEN))) // clang-format off -#define qFatal(...) { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} -#define qError(...) { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} -#define qWarn(...) { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} -#define qInfo(...) { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} -#define qDebug(...) { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} -#define qTrace(...) { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY TRACE ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); }} -#define qDebugL(...){ if (qDebugFlag & DEBUG_DEBUG) { taosPrintLongString("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} -#define qInfoL(...) { if (qDebugFlag & DEBUG_INFO) { taosPrintLongString("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} +#define qFatal(...) do { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0) +#define qError(...) do { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0) +#define qWarn(...) do { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0) +#define qInfo(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0) +#define qDebug(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} while(0) +#define qTrace(...) do { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY TRACE ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); }} while(0) +#define qDebugL(...)do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLongString("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} while(0) +#define qInfoL(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLongString("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0) // clang-format on #define QRY_ERR_RET(c) \ From cdef618c950b8016413a8e74c0495d05aa1d96f4 Mon Sep 17 00:00:00 2001 From: Simon Guan Date: Wed, 26 Feb 2025 20:41:04 +0800 Subject: [PATCH 22/22] fix: adjust log format --- source/client/jni/jniCommon.h | 44 +++++++--------------------------- source/client/src/clientImpl.c | 2 +- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/source/client/jni/jniCommon.h b/source/client/jni/jniCommon.h index f636a11aef..690ccb1e61 100644 --- a/source/client/jni/jniCommon.h +++ b/source/client/jni/jniCommon.h @@ -22,42 +22,14 @@ #ifndef TDENGINE_JNICOMMON_H #define TDENGINE_JNICOMMON_H -#define jniFatal(...) \ - { \ - if (jniDebugFlag & DEBUG_FATAL) { \ - taosPrintLog("JNI FATAL ", DEBUG_FATAL, jniDebugFlag, __VA_ARGS__); \ - } \ - } -#define jniError(...) \ - { \ - if (jniDebugFlag & DEBUG_ERROR) { \ - taosPrintLog("JNI ERROR ", DEBUG_ERROR, jniDebugFlag, __VA_ARGS__); \ - } \ - } -#define jniWarn(...) \ - { \ - if (jniDebugFlag & DEBUG_WARN) { \ - taosPrintLog("JNI WARN ", DEBUG_WARN, jniDebugFlag, __VA_ARGS__); \ - } \ - } -#define jniInfo(...) \ - { \ - if (jniDebugFlag & DEBUG_INFO) { \ - taosPrintLog("JNI INFO ", DEBUG_INFO, jniDebugFlag, __VA_ARGS__); \ - } \ - } -#define jniDebug(...) \ - { \ - if (jniDebugFlag & DEBUG_DEBUG) { \ - taosPrintLog("JNI DEBUG ", DEBUG_DEBUG, jniDebugFlag, __VA_ARGS__); \ - } \ - } -#define jniTrace(...) \ - { \ - if (jniDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("JNI TRACE ", DEBUG_TRACE, jniDebugFlag, __VA_ARGS__); \ - } \ - } +// clang-format off +#define jniFatal(...) do { if (jniDebugFlag & DEBUG_FATAL) { taosPrintLog("JNI FATAL ", DEBUG_FATAL, jniDebugFlag, __VA_ARGS__); }} while(0) +#define jniError(...) do { if (jniDebugFlag & DEBUG_ERROR) { taosPrintLog("JNI ERROR ", DEBUG_ERROR, jniDebugFlag, __VA_ARGS__); }} while(0) +#define jniWarn(...) do { if (jniDebugFlag & DEBUG_WARN) { taosPrintLog("JNI WARN ", DEBUG_WARN, jniDebugFlag, __VA_ARGS__); }} while(0) +#define jniInfo(...) do { if (jniDebugFlag & DEBUG_INFO) { taosPrintLog("JNI INFO ", DEBUG_INFO, jniDebugFlag, __VA_ARGS__); }} while(0) +#define jniDebug(...) do { if (jniDebugFlag & DEBUG_DEBUG) { taosPrintLog("JNI DEBUG ", DEBUG_DEBUG, jniDebugFlag, __VA_ARGS__); }} while(0) +#define jniTrace(...) do { if (jniDebugFlag & DEBUG_TRACE) { taosPrintLog("JNI TRACE ", DEBUG_TRACE, jniDebugFlag, __VA_ARGS__); }} while(0) +// clang-format on extern jclass g_arrayListClass; extern jmethodID g_arrayListConstructFp; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 8a27b84612..5cb8e83b28 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1659,7 +1659,7 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta *pTscObj = NULL; return terrno; } else { - tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, QID:0x%" PRIx64, (*pTscObj)->id, + tscDebug("connObj:0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, QID:0x%" PRIx64, (*pTscObj)->id, (*pTscObj)->connId, (*pTscObj)->pAppInfo->pTransporter, pRequest->requestId); destroyRequest(pRequest); }