From c13cea4f444d538267259d1eb411667784175082 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 27 Feb 2023 14:34:38 +0800 Subject: [PATCH] fix: avoid filter slow when filter not exist value --- source/dnode/vnode/src/meta/metaQuery.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 4b1163bb11..d338237314 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -1301,6 +1301,7 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) { /// src: [[suid, cid1, type1]....[suid, cid2, type2]....[suid, cid3, type3]...] /// target: [suid, cid2, type2] + int diffCidCount = 0; do { void *entryKey = NULL, *entryVal = NULL; int32_t nEntryKey, nEntryVal; @@ -1317,7 +1318,9 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) { if (p == NULL) break; if (p->type != pCursor->type || p->suid != pCursor->suid || p->cid != pCursor->cid) { - if (found == true) break; + if (found == true) break; // + if (diffCidCount > TRY_ERROR_LIMIT) break; + diffCidCount++; count++; valid = param->reverse ? tdbTbcMoveToPrev(pCursor->pCur) : tdbTbcMoveToNext(pCursor->pCur); if (valid < 0) { -- GitLab