Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8e376984
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8e376984
编写于
9月 03, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
other: merge
上级
1c89972f
82f0ba36
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
12 deletion
+13
-12
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+8
-7
source/util/src/trbtree.c
source/util/src/trbtree.c
+5
-5
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
8e376984
...
@@ -273,8 +273,8 @@ SRowInfo *tLDataIterGet(SLDataIter *pIter) { return &pIter->rInfo; }
...
@@ -273,8 +273,8 @@ SRowInfo *tLDataIterGet(SLDataIter *pIter) { return &pIter->rInfo; }
// SMergeTree =================================================
// SMergeTree =================================================
static
FORCE_INLINE
int32_t
tLDataIterCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
static
FORCE_INLINE
int32_t
tLDataIterCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
SLDataIter
*
pIter1
=
(
SLDataIter
*
)(
p1
-
sizeof
(
SRBTreeNode
));
SLDataIter
*
pIter1
=
(
SLDataIter
*
)(
((
uint8_t
*
)
p1
)
-
sizeof
(
SRBTreeNode
));
SLDataIter
*
pIter2
=
(
SLDataIter
*
)(
p2
-
sizeof
(
SRBTreeNode
));
SLDataIter
*
pIter2
=
(
SLDataIter
*
)(
((
uint8_t
*
)
p2
)
-
sizeof
(
SRBTreeNode
));
TSDBKEY
key1
=
TSDBROW_KEY
(
&
pIter1
->
rInfo
.
row
);
TSDBKEY
key1
=
TSDBROW_KEY
(
&
pIter1
->
rInfo
.
row
);
TSDBKEY
key2
=
TSDBROW_KEY
(
&
pIter2
->
rInfo
.
row
);
TSDBKEY
key2
=
TSDBROW_KEY
(
&
pIter2
->
rInfo
.
row
);
...
@@ -294,7 +294,8 @@ static FORCE_INLINE int32_t tLDataIterCmprFn(const void *p1, const void *p2) {
...
@@ -294,7 +294,8 @@ static FORCE_INLINE int32_t tLDataIterCmprFn(const void *p1, const void *p2) {
}
}
}
}
int32_t
tMergeTreeOpen
(
SMergeTree
*
pMTree
,
int8_t
backward
,
SDataFReader
*
pFReader
,
uint64_t
uid
,
STimeWindow
*
pTimeWindow
,
SVersionRange
*
pVerRange
)
{
int32_t
tMergeTreeOpen
(
SMergeTree
*
pMTree
,
int8_t
backward
,
SDataFReader
*
pFReader
,
uint64_t
uid
,
STimeWindow
*
pTimeWindow
,
SVersionRange
*
pVerRange
)
{
pMTree
->
backward
=
backward
;
pMTree
->
backward
=
backward
;
pMTree
->
pIter
=
NULL
;
pMTree
->
pIter
=
NULL
;
pMTree
->
pIterList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pMTree
->
pIterList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
...
@@ -305,8 +306,8 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader* pFRead
...
@@ -305,8 +306,8 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader* pFRead
tRBTreeCreate
(
&
pMTree
->
rbt
,
tLDataIterCmprFn
);
tRBTreeCreate
(
&
pMTree
->
rbt
,
tLDataIterCmprFn
);
int32_t
code
=
TSDB_CODE_OUT_OF_MEMORY
;
int32_t
code
=
TSDB_CODE_OUT_OF_MEMORY
;
struct
SLDataIter
*
pIterList
[
TSDB_DEFAULT_LAST_FILE
]
=
{
0
};
struct
SLDataIter
*
pIterList
[
TSDB_DEFAULT_LAST_FILE
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
pFReader
->
pSet
->
nSstF
;
++
i
)
{
// open all last file
for
(
int32_t
i
=
0
;
i
<
pFReader
->
pSet
->
nSstF
;
++
i
)
{
// open all last file
code
=
tLDataIterOpen
(
&
pIterList
[
i
],
pFReader
,
i
,
pMTree
->
backward
,
uid
,
pTimeWindow
,
pVerRange
);
code
=
tLDataIterOpen
(
&
pIterList
[
i
],
pFReader
,
i
,
pMTree
->
backward
,
uid
,
pTimeWindow
,
pVerRange
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_end
;
goto
_end
;
...
@@ -323,7 +324,7 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader* pFRead
...
@@ -323,7 +324,7 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader* pFRead
return
code
;
return
code
;
_end:
_end:
tMergeTreeClose
(
pMTree
);
tMergeTreeClose
(
pMTree
);
return
code
;
return
code
;
}
}
...
@@ -343,7 +344,7 @@ bool tMergeTreeNext(SMergeTree *pMTree) {
...
@@ -343,7 +344,7 @@ bool tMergeTreeNext(SMergeTree *pMTree) {
// compare with min in RB Tree
// compare with min in RB Tree
pIter
=
(
SLDataIter
*
)
tRBTreeMin
(
&
pMTree
->
rbt
);
pIter
=
(
SLDataIter
*
)
tRBTreeMin
(
&
pMTree
->
rbt
);
if
(
pMTree
->
pIter
&&
pIter
)
{
if
(
pMTree
->
pIter
&&
pIter
)
{
int32_t
c
=
pMTree
->
rbt
.
cmprFn
(
pMTree
->
pIter
->
node
.
payload
,
pIter
->
node
.
payload
);
int32_t
c
=
pMTree
->
rbt
.
cmprFn
(
RBTREE_NODE_PAYLOAD
(
&
pMTree
->
pIter
->
node
),
RBTREE_NODE_PAYLOAD
(
&
pIter
->
node
)
);
if
(
c
>
0
)
{
if
(
c
>
0
)
{
tRBTreePut
(
&
pMTree
->
rbt
,
(
SRBTreeNode
*
)
pMTree
->
pIter
);
tRBTreePut
(
&
pMTree
->
rbt
,
(
SRBTreeNode
*
)
pMTree
->
pIter
);
pMTree
->
pIter
=
NULL
;
pMTree
->
pIter
=
NULL
;
...
...
source/util/src/trbtree.c
浏览文件 @
8e376984
...
@@ -219,7 +219,7 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
...
@@ -219,7 +219,7 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
while
(
temp
!=
pTree
->
NIL
)
{
while
(
temp
!=
pTree
->
NIL
)
{
y
=
temp
;
y
=
temp
;
int32_t
c
=
pTree
->
cmprFn
(
z
->
payload
,
temp
->
payload
);
int32_t
c
=
pTree
->
cmprFn
(
RBTREE_NODE_PAYLOAD
(
z
),
RBTREE_NODE_PAYLOAD
(
temp
)
);
if
(
c
<
0
)
{
if
(
c
<
0
)
{
temp
=
temp
->
left
;
temp
=
temp
->
left
;
}
else
if
(
c
>
0
)
{
}
else
if
(
c
>
0
)
{
...
@@ -232,7 +232,7 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
...
@@ -232,7 +232,7 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
if
(
y
==
pTree
->
NIL
)
{
if
(
y
==
pTree
->
NIL
)
{
pTree
->
root
=
z
;
pTree
->
root
=
z
;
}
else
if
(
pTree
->
cmprFn
(
z
->
payload
,
y
->
payload
)
<
0
)
{
}
else
if
(
pTree
->
cmprFn
(
RBTREE_NODE_PAYLOAD
(
z
),
RBTREE_NODE_PAYLOAD
(
y
)
)
<
0
)
{
y
->
left
=
z
;
y
->
left
=
z
;
}
else
{
}
else
{
y
->
right
=
z
;
y
->
right
=
z
;
...
@@ -245,10 +245,10 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
...
@@ -245,10 +245,10 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
tRBTreePutFix
(
pTree
,
z
);
tRBTreePutFix
(
pTree
,
z
);
// update min/max node
// update min/max node
if
(
pTree
->
min
==
pTree
->
NIL
||
pTree
->
cmprFn
(
pTree
->
min
->
payload
,
z
->
payload
)
>
0
)
{
if
(
pTree
->
min
==
pTree
->
NIL
||
pTree
->
cmprFn
(
RBTREE_NODE_PAYLOAD
(
pTree
->
min
),
RBTREE_NODE_PAYLOAD
(
z
)
)
>
0
)
{
pTree
->
min
=
z
;
pTree
->
min
=
z
;
}
}
if
(
pTree
->
max
==
pTree
->
NIL
||
pTree
->
cmprFn
(
pTree
->
max
->
payload
,
z
->
payload
)
<
0
)
{
if
(
pTree
->
max
==
pTree
->
NIL
||
pTree
->
cmprFn
(
RBTREE_NODE_PAYLOAD
(
pTree
->
max
),
RBTREE_NODE_PAYLOAD
(
z
)
)
<
0
)
{
pTree
->
max
=
z
;
pTree
->
max
=
z
;
}
}
pTree
->
n
++
;
pTree
->
n
++
;
...
@@ -313,7 +313,7 @@ SRBTreeNode *tRBTreeGet(SRBTree *pTree, void *pKey) {
...
@@ -313,7 +313,7 @@ SRBTreeNode *tRBTreeGet(SRBTree *pTree, void *pKey) {
SRBTreeNode
*
pNode
=
pTree
->
root
;
SRBTreeNode
*
pNode
=
pTree
->
root
;
while
(
pNode
!=
pTree
->
NIL
)
{
while
(
pNode
!=
pTree
->
NIL
)
{
int32_t
c
=
pTree
->
cmprFn
(
pKey
,
pNode
->
payload
);
int32_t
c
=
pTree
->
cmprFn
(
pKey
,
RBTREE_NODE_PAYLOAD
(
pNode
)
);
if
(
c
<
0
)
{
if
(
c
<
0
)
{
pNode
=
pNode
->
left
;
pNode
=
pNode
->
left
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录