From 0ea38a15a8c9edd6a2b146698171f086d40d4f06 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Sat, 14 Sep 2024 10:26:14 +0800 Subject: [PATCH] fix: (last) nextRowIterGet compare pk --- source/dnode/vnode/src/tsdb/tsdbCache.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 6b61248d3a..9cdd4dcdb5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -2939,17 +2939,19 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI TSDBROW *max[4] = {0}; int iMax[4] = {-1, -1, -1, -1}; int nMax = 0; - TSKEY maxKey = TSKEY_MIN; + SRowKey maxKey = {.ts = TSKEY_MIN}; for (int i = 0; i < 3; ++i) { if (!pIter->input[i].stop && pIter->input[i].pRow != NULL) { - TSDBKEY key = TSDBROW_KEY(pIter->input[i].pRow); + STsdbRowKey tsdbRowKey = {0}; + tsdbRowGetKey(pIter->input[i].pRow, &tsdbRowKey); // merging & deduplicating on client side - if (maxKey <= key.ts) { - if (maxKey < key.ts) { + int c = tRowKeyCompare(&maxKey, &tsdbRowKey.key); + if (c <= 0) { + if (c < 0) { nMax = 0; - maxKey = key.ts; + maxKey = tsdbRowKey.key; } iMax[nMax] = i;