提交 90b41841 编写于 作者: H Haojun Liao

[TD-2482]<fix>: fix bug in the skiplist iteration during query processing.

上级 a6594efd
...@@ -280,7 +280,13 @@ bool tSkipListIterNext(SSkipListIterator *iter) { ...@@ -280,7 +280,13 @@ bool tSkipListIterNext(SSkipListIterator *iter) {
tSkipListRLock(pSkipList); tSkipListRLock(pSkipList);
if (iter->order == TSDB_ORDER_ASC) { if (iter->order == TSDB_ORDER_ASC) {
if (iter->cur == pSkipList->pTail) return false; // no data in the skip list
if (iter->cur == pSkipList->pTail || iter->next == NULL) {
iter->cur = pSkipList->pTail;
tSkipListUnlock(pSkipList);
return false;
}
iter->cur = SL_NODE_GET_FORWARD_POINTER(iter->cur, 0); iter->cur = SL_NODE_GET_FORWARD_POINTER(iter->cur, 0);
// a new node is inserted into between iter->cur and iter->next, ignore it // a new node is inserted into between iter->cur and iter->next, ignore it
...@@ -292,9 +298,11 @@ bool tSkipListIterNext(SSkipListIterator *iter) { ...@@ -292,9 +298,11 @@ bool tSkipListIterNext(SSkipListIterator *iter) {
iter->step++; iter->step++;
} else { } else {
if (iter->cur == pSkipList->pHead) { if (iter->cur == pSkipList->pHead) {
iter->cur = pSkipList->pHead;
tSkipListUnlock(pSkipList); tSkipListUnlock(pSkipList);
return false; return false;
} }
iter->cur = SL_NODE_GET_BACKWARD_POINTER(iter->cur, 0); iter->cur = SL_NODE_GET_BACKWARD_POINTER(iter->cur, 0);
// a new node is inserted into between iter->cur and iter->next, ignore it // a new node is inserted into between iter->cur and iter->next, ignore it
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册