From 0fd0c641571e33117cc848cb6a884c5983ccc1e0 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 13 Feb 2023 13:28:52 +0800 Subject: [PATCH] fix: fix filter error result --- source/dnode/vnode/src/meta/metaQuery.c | 30 ++++++++++-------------- tests/script/tsim/tagindex/add_index.sim | 2 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 18bd2e0241..8734b20014 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -1302,24 +1302,23 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) { if (valid < 0) { break; } + if (count >= TRY_ERROR_LIMIT) { + break; + } + STagIdxKey *p = entryKey; if (p == NULL) break; - if (count >= TRY_ERROR_LIMIT) { - if (p->type != pCursor->type || p->suid != pCursor->suid || p->cid != pCursor->cid) { + if (p->type != pCursor->type || p->suid != pCursor->suid || p->cid != pCursor->cid) { + count++; + valid = param->reverse ? tdbTbcMoveToPrev(pCursor->pCur) : tdbTbcMoveToNext(pCursor->pCur); + if (valid < 0) { break; - } - } else { - if (p->type != pCursor->type || p->suid != pCursor->suid || p->cid != pCursor->cid) { - count++; - valid = param->reverse ? tdbTbcMoveToPrev(pCursor->pCur) : tdbTbcMoveToNext(pCursor->pCur); - if (valid < 0) { - break; - } else { - continue; - } + } else { + continue; } } + int32_t cmp = (*param->filterFunc)(p->data, pKey->data, pKey->type); if (cmp == 0) { // match @@ -1331,13 +1330,8 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) { } taosArrayPush(pUids, &tuid); } else { - if (count >= TRY_ERROR_LIMIT) { - if (param->equal == false) { - break; - } - } + // opt later } - count++; valid = param->reverse ? tdbTbcMoveToPrev(pCursor->pCur) : tdbTbcMoveToNext(pCursor->pCur); if (valid < 0) { break; diff --git a/tests/script/tsim/tagindex/add_index.sim b/tests/script/tsim/tagindex/add_index.sim index c60176c324..4f40aa7397 100644 --- a/tests/script/tsim/tagindex/add_index.sim +++ b/tests/script/tsim/tagindex/add_index.sim @@ -7,7 +7,7 @@ print ======== step0 $dbPrefix = ta_3_db $tbPrefix = ta_3_tb $mtPrefix = ta_3_mt -$tbNum = 10 +$tbNum = 101 $rowNum = 20 $totalNum = 200