diff --git a/src/util/src/tref.c b/src/util/src/tref.c index b32680efc4861b575021b064cb21b811c5814557..5c7bdec01eb57cb8ee561d10a8417daf15d90bcd 100644 --- a/src/util/src/tref.c +++ b/src/util/src/tref.c @@ -313,6 +313,11 @@ void *taosIterateRef(int rsetId, int64_t rid) { // rid is there pNode = pNode->next; + // check first place + while (pNode) { + if (!pNode->removed) break; + pNode = pNode->next; + } if (pNode == NULL) { taosUnlockList(pSet->lockedBy+hash); hash++; @@ -323,7 +328,14 @@ void *taosIterateRef(int rsetId, int64_t rid) { for (; hash < pSet->max; ++hash) { taosLockList(pSet->lockedBy+hash); pNode = pSet->nodeList[hash]; - if (pNode) break; + if (pNode) { + // check first place + while (pNode) { + if (!pNode->removed) break; + pNode = pNode->next; + } + if (pNode) break; + } taosUnlockList(pSet->lockedBy+hash); } }