Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
acf8a270
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
acf8a270
编写于
7月 09, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
7月 09, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2606 from taosdata/feature/query
[td-225] fix bug in skiplist.
上级
a45f3dd6
fe4b5832
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
3 addition
and
14 deletion
+3
-14
src/util/inc/tskiplist.h
src/util/inc/tskiplist.h
+1
-1
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+2
-13
未找到文件。
src/util/inc/tskiplist.h
浏览文件 @
acf8a270
...
...
@@ -51,6 +51,7 @@ typedef struct SSkipListNode {
#define SL_GET_NODE_KEY(s, n) ((s)->keyFn(SL_GET_NODE_DATA(n)))
#define SL_GET_SL_MIN_KEY(s) (SL_GET_NODE_KEY((s), SL_GET_FORWARD_POINTER((s)->pHead, 0)))
#define SL_GET_SL_MAX_KEY(s) (SL_GET_NODE_KEY((s), SL_GET_BACKWARD_POINTER((s)->pTail, 0)))
#define SL_GET_NODE_LEVEL(n) *(uint8_t *)((n))
...
...
@@ -119,7 +120,6 @@ typedef struct SSkipList {
pthread_rwlock_t
*
lock
;
SSkipListNode
*
pHead
;
// point to the first element
SSkipListNode
*
pTail
;
// point to the last element
void
*
lastKey
;
// last key in the skiplist
#if SKIP_LIST_RECORD_PERFORMANCE
tSkipListState
state
;
// skiplist state
#endif
...
...
src/util/src/tskiplist.c
浏览文件 @
acf8a270
...
...
@@ -5,6 +5,7 @@
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
...
...
@@ -238,7 +239,7 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode) {
// if the new key is greater than the maximum key of skip list, push back this node at the end of skip list
char
*
newDatakey
=
SL_GET_NODE_KEY
(
pSkipList
,
pNode
);
if
(
pSkipList
->
size
==
0
||
pSkipList
->
comparFn
(
pSkipList
->
lastKey
,
newDatakey
)
<
0
)
{
if
(
pSkipList
->
size
==
0
||
pSkipList
->
comparFn
(
SL_GET_SL_MAX_KEY
(
pSkipList
)
,
newDatakey
)
<
0
)
{
return
tSkipListPushBack
(
pSkipList
,
pNode
);
}
...
...
@@ -499,16 +500,6 @@ void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNode) {
pthread_rwlock_wrlock
(
pSkipList
->
lock
);
}
if
(
pSkipList
->
size
==
1
)
{
assert
(
pSkipList
->
lastKey
==
SL_GET_NODE_KEY
(
pSkipList
,
pNode
));
pSkipList
->
lastKey
=
0
;
}
else
{
if
(
pSkipList
->
lastKey
==
SL_GET_NODE_KEY
(
pSkipList
,
pNode
))
{
SSkipListNode
*
prev
=
SL_GET_BACKWARD_POINTER
(
pNode
,
0
);
pSkipList
->
lastKey
=
SL_GET_NODE_KEY
(
pSkipList
,
prev
);
}
}
for
(
int32_t
j
=
level
-
1
;
j
>=
0
;
--
j
)
{
SSkipListNode
*
prev
=
SL_GET_BACKWARD_POINTER
(
pNode
,
j
);
SSkipListNode
*
next
=
SL_GET_FORWARD_POINTER
(
pNode
,
j
);
...
...
@@ -709,8 +700,6 @@ SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode) {
SL_GET_BACKWARD_POINTER
(
pSkipList
->
pTail
,
i
)
=
pNode
;
}
pSkipList
->
lastKey
=
SL_GET_NODE_KEY
(
pSkipList
,
pNode
);
atomic_add_fetch_32
(
&
pSkipList
->
size
,
1
);
if
(
pSkipList
->
lock
)
{
pthread_rwlock_unlock
(
pSkipList
->
lock
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录