From c22619ab67a78dd31701d0edaa64e805a03a2c58 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 17 Jul 2023 15:26:59 +0800 Subject: [PATCH] fix: add perf debug info --- .../libs/executor/src/dynqueryctrloperator.c | 7 ++++--- source/libs/executor/src/hashjoinoperator.c | 19 +++++++++++++++++-- source/libs/executor/src/mergejoinoperator.c | 8 ++++---- source/libs/executor/src/scanoperator.c | 4 ++-- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c index a6ab5f5b49..a67aed6685 100755 --- a/source/libs/executor/src/dynqueryctrloperator.c +++ b/source/libs/executor/src/dynqueryctrloperator.c @@ -138,7 +138,7 @@ static int32_t buildStbJoinOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SStbJ int32_t* rightVg = (int32_t*)(pVg1->pData + pVg1->info.bytes * rowIdx); int64_t* rightUid = (int64_t*)(pUid1->pData + pUid1->info.bytes * rowIdx); - qDebug("start stbJoin, left:%d,%" PRIu64 " - right:%d,%" PRIu64, *leftVg, *leftUid, *rightVg, *rightUid); + qError("start stbJoin, left:%d,%" PRIu64 " - right:%d,%" PRIu64, *leftVg, *leftUid, *rightVg, *rightUid); int32_t code = buildExchangeOperatorParam(&pExcParam0, 0, leftVg, leftUid, NULL); if (TSDB_CODE_SUCCESS == code) { @@ -169,14 +169,15 @@ static void seqJoinLaunchPostJoin(SOperatorInfo* pOperator, SSDataBlock** ppRes) T_LONG_JMP(pOperator->pTaskInfo->env, pOperator->pTaskInfo->code); } + qError("dynamic post task begin"); *ppRes = pOperator->pDownstream[1]->fpSet.getNextExtFn(pOperator->pDownstream[1], pParam); if (*ppRes) { pPost->isStarted = true; pInfo->execInfo.postBlkNum++; pInfo->execInfo.postBlkRows += (*ppRes)->info.rows; - qDebug("join res block retrieved"); + qError("join res block retrieved"); } else { - qDebug("Empty join res block retrieved"); + qError("Empty join res block retrieved"); } } diff --git a/source/libs/executor/src/hashjoinoperator.c b/source/libs/executor/src/hashjoinoperator.c index 2feaa88aec..dfbc39252e 100755 --- a/source/libs/executor/src/hashjoinoperator.c +++ b/source/libs/executor/src/hashjoinoperator.c @@ -685,6 +685,8 @@ static void setHJoinDone(struct SOperatorInfo* pOperator) { SHJoinOperatorInfo* pInfo = pOperator->info; destroyHJoinKeyHash(&pInfo->pKeyHash); + + qError("hash Join done"); } static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) { @@ -693,9 +695,14 @@ static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) { int32_t code = TSDB_CODE_SUCCESS; SSDataBlock* pRes = pJoin->pRes; pRes->info.rows = 0; + int64_t st = 0; + + if (pOperator->cost.openCost == 0) { + st = taosGetTimestampUs(); + } if (pOperator->status == OP_EXEC_DONE) { - return NULL; + goto _return; } if (!pJoin->keyHashBuilt) { @@ -709,7 +716,7 @@ static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) { if (tSimpleHashGetSize(pJoin->pKeyHash) <= 0) { setHJoinDone(pOperator); - return NULL; + goto _return; } } @@ -748,6 +755,12 @@ static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) { break; } } + +_return: + + if (pOperator->cost.openCost == 0) { + pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; + } return (pRes->info.rows > 0) ? pRes : NULL; } @@ -828,6 +841,8 @@ SOperatorInfo* createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t n pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doHashJoin, NULL, destroyHashJoinOperator, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + qError("create hash Join operator done"); + return pOperator; _error: diff --git a/source/libs/executor/src/mergejoinoperator.c b/source/libs/executor/src/mergejoinoperator.c index 9eeb51a21c..f08f04b86f 100644 --- a/source/libs/executor/src/mergejoinoperator.c +++ b/source/libs/executor/src/mergejoinoperator.c @@ -656,11 +656,11 @@ static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs pJoinInfo->leftPos = 0; if (pJoinInfo->pLeft == NULL) { - qDebug("merge join left got empty block"); + qError("merge join left got empty block"); setMergeJoinDone(pOperator); return false; } else { - qDebug("merge join left got block"); + qError("merge join left got block"); } } @@ -669,11 +669,11 @@ static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs pJoinInfo->rightPos = 0; if (pJoinInfo->pRight == NULL) { - qDebug("merge join right got empty block"); + qError("merge join right got empty block"); setMergeJoinDone(pOperator); return false; } else { - qDebug("merge join right got block"); + qError("merge join right got block"); } } // only the timestamp match support for ordinary table diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index b967b317f6..a92080fbab 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -797,7 +797,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) { return TSDB_CODE_INVALID_PARA; } - qDebug("add total %d dynamic tables to scan, exist num:%" PRId64, num, (int64_t)taosArrayGetSize(pListInfo->pTableList)); + qError("add total %d dynamic tables to scan, exist num:%" PRId64, num, (int64_t)taosArrayGetSize(pListInfo->pTableList)); pListInfo->oneTableForEachGroup = true; @@ -812,7 +812,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) { taosHashPut(pListInfo->map, pUid, sizeof(uint64_t), &i, sizeof(int32_t)); - qTrace("add dynamic table scan uid:%" PRIu64 ", %s", info.uid, GET_TASKID(pTaskInfo)); + qError("add dynamic table scan uid:%" PRIu64 ", %s", info.uid, GET_TASKID(pTaskInfo)); } return code;