From c2a7c37b00f8b5fab45d75225777982277d114ab Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 30 Jun 2023 18:22:20 +0800 Subject: [PATCH] fix(tsdb): opt perf for reading data from stt files. --- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 17 +---------------- source/dnode/vnode/src/tsdb/tsdbSttFileRW.c | 8 +++++++- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index f0debf5d71..c5b35cfd36 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -187,22 +187,7 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) { int64_t st = taosGetTimestampUs(); SBlockData *pBlock = &pInfo->blockData[pInfo->currentLoadBlockIndex]; - - TABLEID id = {0}; - if (pIter->pSttBlk->suid != 0) { - id.suid = pIter->pSttBlk->suid; - } else { - id.uid = pIter->uid; - } - - code = tBlockDataInit(pBlock, &id, pInfo->pSchema, pInfo->colIds, pInfo->numOfCols); -// code = tBlockDataInit(pBlock, &id, pInfo->pSchema, &pInfo->colIds[1], pInfo->numOfCols-1); - if (code != TSDB_CODE_SUCCESS) { - goto _exit; - } - - code = tsdbSttFileReadBlockData(pIter->pReader, pIter->pSttBlk, pBlock); -// code = tsdbSttFileReadBlockDataByColumn(pIter->pReader, pIter->pSttBlk, pBlock, pInfo->pSchema, &pInfo->colIds[1], pInfo->numOfCols - 1); + code = tsdbSttFileReadBlockDataByColumn(pIter->pReader, pIter->pSttBlk, pBlock, pInfo->pSchema, &pInfo->colIds[1], pInfo->numOfCols - 1); if (code != TSDB_CODE_SUCCESS) { goto _exit; } diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c index d3c99496c9..187d22f348 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c @@ -194,7 +194,13 @@ int32_t tsdbSttFileReadBlockDataByColumn(SSttFileReader *reader, const SSttBlk * int32_t code = 0; int32_t lino = 0; - TABLEID tbid = {.suid = sttBlk->suid, .uid = 0}; + TABLEID tbid = {.suid = sttBlk->suid}; + if (tbid.suid == 0) { + tbid.uid = sttBlk->minUid; + } else { + tbid.uid = 0; + } + code = tBlockDataInit(bData, &tbid, pTSchema, cids, ncid); TSDB_CHECK_CODE(code, lino, _exit); -- GitLab