Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8b58508e
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8b58508e
编写于
8月 26, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
3d50b623
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
5 deletion
+34
-5
include/util/trbtree.h
include/util/trbtree.h
+1
-0
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+29
-4
source/util/src/trbtree.c
source/util/src/trbtree.c
+3
-0
未找到文件。
include/util/trbtree.h
浏览文件 @
8b58508e
...
...
@@ -56,6 +56,7 @@ struct SRBTreeNode {
struct
SRBTree
{
tRBTreeCmprFn
cmprFn
;
int64_t
n
;
SRBTreeNode
*
root
;
SRBTreeNode
*
min
;
SRBTreeNode
*
max
;
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
8b58508e
...
...
@@ -68,7 +68,7 @@ typedef struct SBlockCol SBlockCol;
#define TSDB_FILE_DLMT ((uint32_t)0xF00AFA0F)
#define TSDB_MAX_SUBBLOCKS 8
#define TSDB_MAX_LAST_FILE 16
#define TSDB_DEFAULT_LAST_FILE
8
#define TSDB_DEFAULT_LAST_FILE
1
#define TSDB_FHDR_SIZE 512
#define HAS_NONE ((int8_t)0x1)
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
8b58508e
...
...
@@ -78,6 +78,7 @@ typedef struct {
SRBTree
rbt
;
SDataIter
dataIter
;
SDataIter
aDataIter
[
TSDB_MAX_LAST_FILE
];
int8_t
toLast
;
};
struct
{
SDataFWriter
*
pWriter
;
...
...
@@ -454,6 +455,10 @@ static int32_t tsdbOpenCommitIter(SCommitter *pCommitter) {
tRBTreePut
(
&
pCommitter
->
rbt
,
(
SRBTreeNode
*
)
pIter
);
iIter
++
;
}
pCommitter
->
toLast
=
0
;
}
else
{
pCommitter
->
toLast
=
1
;
}
code
=
tsdbNextCommitRow
(
pCommitter
);
...
...
@@ -1206,7 +1211,7 @@ _err:
static
int32_t
tsdbCommitDataStart
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
//
R
eader
//
r
eader
pCommitter
->
dReader
.
aBlockIdx
=
taosArrayInit
(
0
,
sizeof
(
SBlockIdx
));
if
(
pCommitter
->
dReader
.
aBlockIdx
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1216,7 +1221,20 @@ static int32_t tsdbCommitDataStart(SCommitter *pCommitter) {
code
=
tBlockDataCreate
(
&
pCommitter
->
dReader
.
bData
);
if
(
code
)
goto
_exit
;
// Writer
// merger
for
(
int32_t
iLast
=
0
;
iLast
<
TSDB_MAX_LAST_FILE
;
iLast
++
)
{
SDataIter
*
pIter
=
&
pCommitter
->
aDataIter
[
iLast
];
pIter
->
aBlockL
=
taosArrayInit
(
0
,
sizeof
(
SBlockL
));
if
(
pIter
->
aBlockL
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
code
=
tBlockDataCreate
(
&
pIter
->
bData
);
if
(
code
)
goto
_exit
;
}
// writer
pCommitter
->
dWriter
.
aBlockIdx
=
taosArrayInit
(
0
,
sizeof
(
SBlockIdx
));
if
(
pCommitter
->
dWriter
.
aBlockIdx
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1240,12 +1258,19 @@ _exit:
}
static
void
tsdbCommitDataEnd
(
SCommitter
*
pCommitter
)
{
//
R
eader
//
r
eader
taosArrayDestroy
(
pCommitter
->
dReader
.
aBlockIdx
);
tMapDataClear
(
&
pCommitter
->
dReader
.
mBlock
);
tBlockDataDestroy
(
&
pCommitter
->
dReader
.
bData
,
1
);
// Writer
// merger
for
(
int32_t
iLast
=
0
;
iLast
<
TSDB_MAX_LAST_FILE
;
iLast
++
)
{
SDataIter
*
pIter
=
&
pCommitter
->
aDataIter
[
iLast
];
taosArrayDestroy
(
pIter
->
aBlockL
);
tBlockDataDestroy
(
&
pIter
->
bData
,
1
);
}
// writer
taosArrayDestroy
(
pCommitter
->
dWriter
.
aBlockIdx
);
taosArrayDestroy
(
pCommitter
->
dWriter
.
aBlockL
);
tMapDataClear
(
&
pCommitter
->
dWriter
.
mBlock
);
...
...
source/util/src/trbtree.c
浏览文件 @
8b58508e
...
...
@@ -201,6 +201,7 @@ static SRBTreeNode *tRBTreePredecessor(SRBTree *pTree, SRBTreeNode *pNode) {
void
tRBTreeCreate
(
SRBTree
*
pTree
,
tRBTreeCmprFn
cmprFn
)
{
pTree
->
cmprFn
=
cmprFn
;
pTree
->
n
=
0
;
pTree
->
NIL
=
&
pTree
->
NILNODE
;
pTree
->
NIL
->
color
=
BLACK
;
pTree
->
NIL
->
parent
=
NULL
;
...
...
@@ -250,6 +251,7 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
if
(
pTree
->
max
==
pTree
->
NIL
||
pTree
->
cmprFn
(
pTree
->
max
->
payload
,
z
->
payload
)
<
0
)
{
pTree
->
max
=
z
;
}
pTree
->
n
++
;
return
z
;
}
...
...
@@ -294,6 +296,7 @@ void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z) {
if
(
y_orignal_color
==
BLACK
)
{
tRBTreeDropFix
(
pTree
,
x
);
}
pTree
->
n
--
;
}
SRBTreeNode
*
tRBTreeDropByKey
(
SRBTree
*
pTree
,
void
*
pKey
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录