From 9638f8d7fcb345d563f605c7d04cf03acc7f2afb Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 26 Mar 2024 00:14:46 +0800 Subject: [PATCH] fix(tsdb): set the correct sttkey --- source/dnode/vnode/src/tsdb/tsdbRead2.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 80c4514579..27e7da11df 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -1861,9 +1861,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader); TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader); - SRowKey* pSttKey = NULL; + SRowKey* pSttKey = &(SRowKey){0}; if (hasDataInSttBlock(pBlockScanInfo) && (!pBlockScanInfo->cleanSttBlocks)) { - pSttKey = getCurrentKeyInSttBlock(pSttBlockReader); + tRowKeyAssign(pSttKey, getCurrentKeyInSttBlock(pSttBlockReader)); + } else { + pSttKey = NULL; } SRowKey* pfKey = &(SRowKey){0}; @@ -1902,7 +1904,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } } - SRowKey minKey; + SRowKey minKey = {0}; if (ASCENDING_TRAVERSE(pReader->info.order)) { minKey = k; // let's find the minimum @@ -1910,11 +1912,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* minKey = ik; } - if (pfKey != NULL && (pkCompEx(compFn, pfKey, &minKey) < 0)) { + if ((pfKey != NULL) && (pkCompEx(compFn, pfKey, &minKey) < 0)) { minKey = *pfKey; } - if (pSttKey != NULL && (pkCompEx(compFn, pSttKey, &minKey) < 0)) { + if ((pSttKey != NULL) && (pkCompEx(compFn, pSttKey, &minKey) < 0)) { minKey = *pSttKey; } } else { @@ -1923,11 +1925,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* minKey = ik; } - if (pfKey != NULL && (pkCompEx(compFn, pfKey, &minKey) > 0)) { + if ((pfKey != NULL) && (pkCompEx(compFn, pfKey, &minKey) > 0)) { minKey = *pfKey; } - if (pSttKey != NULL && (pkCompEx(compFn, pSttKey, &minKey) > 0)) { + if ((pSttKey != NULL) && (pkCompEx(compFn, pSttKey, &minKey) > 0)) { minKey = *pSttKey; } }