fix: add perf debug info

This commit is contained in:
dapan1121 2023-07-17 15:26:59 +08:00
parent 2e0b4236e3
commit c22619ab67
4 changed files with 27 additions and 11 deletions

View File

@ -138,7 +138,7 @@ static int32_t buildStbJoinOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SStbJ
int32_t* rightVg = (int32_t*)(pVg1->pData + pVg1->info.bytes * rowIdx); int32_t* rightVg = (int32_t*)(pVg1->pData + pVg1->info.bytes * rowIdx);
int64_t* rightUid = (int64_t*)(pUid1->pData + pUid1->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); int32_t code = buildExchangeOperatorParam(&pExcParam0, 0, leftVg, leftUid, NULL);
if (TSDB_CODE_SUCCESS == code) { 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); T_LONG_JMP(pOperator->pTaskInfo->env, pOperator->pTaskInfo->code);
} }
qError("dynamic post task begin");
*ppRes = pOperator->pDownstream[1]->fpSet.getNextExtFn(pOperator->pDownstream[1], pParam); *ppRes = pOperator->pDownstream[1]->fpSet.getNextExtFn(pOperator->pDownstream[1], pParam);
if (*ppRes) { if (*ppRes) {
pPost->isStarted = true; pPost->isStarted = true;
pInfo->execInfo.postBlkNum++; pInfo->execInfo.postBlkNum++;
pInfo->execInfo.postBlkRows += (*ppRes)->info.rows; pInfo->execInfo.postBlkRows += (*ppRes)->info.rows;
qDebug("join res block retrieved"); qError("join res block retrieved");
} else { } else {
qDebug("Empty join res block retrieved"); qError("Empty join res block retrieved");
} }
} }

View File

@ -685,6 +685,8 @@ static void setHJoinDone(struct SOperatorInfo* pOperator) {
SHJoinOperatorInfo* pInfo = pOperator->info; SHJoinOperatorInfo* pInfo = pOperator->info;
destroyHJoinKeyHash(&pInfo->pKeyHash); destroyHJoinKeyHash(&pInfo->pKeyHash);
qError("hash Join done");
} }
static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) { static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) {
@ -693,9 +695,14 @@ static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SSDataBlock* pRes = pJoin->pRes; SSDataBlock* pRes = pJoin->pRes;
pRes->info.rows = 0; pRes->info.rows = 0;
int64_t st = 0;
if (pOperator->cost.openCost == 0) {
st = taosGetTimestampUs();
}
if (pOperator->status == OP_EXEC_DONE) { if (pOperator->status == OP_EXEC_DONE) {
return NULL; goto _return;
} }
if (!pJoin->keyHashBuilt) { if (!pJoin->keyHashBuilt) {
@ -709,7 +716,7 @@ static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) {
if (tSimpleHashGetSize(pJoin->pKeyHash) <= 0) { if (tSimpleHashGetSize(pJoin->pKeyHash) <= 0) {
setHJoinDone(pOperator); setHJoinDone(pOperator);
return NULL; goto _return;
} }
} }
@ -748,6 +755,12 @@ static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) {
break; break;
} }
} }
_return:
if (pOperator->cost.openCost == 0) {
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
}
return (pRes->info.rows > 0) ? pRes : NULL; 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); pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doHashJoin, NULL, destroyHashJoinOperator, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
qError("create hash Join operator done");
return pOperator; return pOperator;
_error: _error:

View File

@ -656,11 +656,11 @@ static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs
pJoinInfo->leftPos = 0; pJoinInfo->leftPos = 0;
if (pJoinInfo->pLeft == NULL) { if (pJoinInfo->pLeft == NULL) {
qDebug("merge join left got empty block"); qError("merge join left got empty block");
setMergeJoinDone(pOperator); setMergeJoinDone(pOperator);
return false; return false;
} else { } 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; pJoinInfo->rightPos = 0;
if (pJoinInfo->pRight == NULL) { if (pJoinInfo->pRight == NULL) {
qDebug("merge join right got empty block"); qError("merge join right got empty block");
setMergeJoinDone(pOperator); setMergeJoinDone(pOperator);
return false; return false;
} else { } else {
qDebug("merge join right got block"); qError("merge join right got block");
} }
} }
// only the timestamp match support for ordinary table // only the timestamp match support for ordinary table

View File

@ -797,7 +797,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) {
return TSDB_CODE_INVALID_PARA; 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; pListInfo->oneTableForEachGroup = true;
@ -812,7 +812,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) {
taosHashPut(pListInfo->map, pUid, sizeof(uint64_t), &i, sizeof(int32_t)); 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; return code;