Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e783609e
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
e783609e
编写于
5月 16, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
f8220e8b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
29 deletion
+31
-29
include/util/trbtree.h
include/util/trbtree.h
+3
-3
include/util/tutil.h
include/util/tutil.h
+2
-0
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
+1
-1
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
+23
-23
source/util/src/trbtree.c
source/util/src/trbtree.c
+2
-2
未找到文件。
include/util/trbtree.h
浏览文件 @
e783609e
...
...
@@ -67,9 +67,9 @@ struct SRBTree {
};
struct
SRBTreeIter
{
int8_t
asc
;
SRBTree
*
pTree
;
SRBTreeNode
*
pNode
;
int8_t
asc
;
const
SRBTree
*
pTree
;
SRBTreeNode
*
pNode
;
};
#ifdef __cplusplus
...
...
include/util/tutil.h
浏览文件 @
e783609e
...
...
@@ -118,6 +118,8 @@ static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen,
#define VND_CHECK_CODE(CODE, LINO, LABEL) TSDB_CHECK_CODE(CODE, LINO, LABEL)
#define TCONTAINER_OF(ptr, type, member) ((type *)((char *)(ptr)-offsetof(type, member)))
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
浏览文件 @
e783609e
...
...
@@ -60,7 +60,7 @@ typedef struct SSttLvl {
struct
STFileSet
{
int32_t
fid
;
STFileObj
*
farr
[
TSDB_FTYPE_MAX
];
// file array
SRBTree
lvlTree
;
// level tree of .stt
SRBTree
lvlTree
;
//
SRBTree<SSttLvl>,
level tree of .stt
};
#ifdef __cplusplus
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
浏览文件 @
e783609e
...
...
@@ -20,20 +20,24 @@ static int32_t stt_lvl_to_json(const SSttLvl *lvl, cJSON *json) {
return
TSDB_CODE_OUT_OF_MEMORY
;
}
cJSON
*
a
rr
=
cJSON_AddArrayToObject
(
json
,
"stt"
);
if
(
a
rr
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
cJSON
*
a
json
=
cJSON_AddArrayToObject
(
json
,
"stt"
);
if
(
a
json
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
// TODO: .stt files
// STFile *f;
// LISTD_FOREACH(&lvl->fstt, f, listNode) {
// cJSON *item = cJSON_CreateObject();
// if (item == NULL) return TSDB_CODE_OUT_OF_MEMORY;
SRBTreeIter
iter
=
tRBTreeIterCreate
(
&
lvl
->
sttTree
,
1
);
for
(
SRBTreeNode
*
node
=
tRBTreeIterNext
(
&
iter
);
node
;
node
=
tRBTreeIterNext
(
&
iter
))
{
STFileObj
*
fobj
=
TCONTAINER_OF
(
node
,
STFileObj
,
rbtn
);
// int32_t code = tsdbTFileToJson(f, item
);
// if (code) return code
;
cJSON
*
item
=
cJSON_CreateObject
(
);
if
(
item
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
// cJSON_AddItemToArray(arr, item);
// }
int32_t
code
=
tsdbTFileToJson
(
&
fobj
->
f
,
item
);
if
(
code
)
{
cJSON_Delete
(
item
);
return
code
;
}
cJSON_AddItemToArray
(
ajson
,
item
);
}
return
0
;
}
...
...
@@ -69,24 +73,20 @@ int32_t tsdbFileSetToJson(const STFileSet *fset, cJSON *json) {
continue
;
}
// code = tsdbTFileToJson(fset->farr[ftype]
, json);
//
if (code) return code;
code
=
tsdbTFileToJson
(
&
fset
->
farr
[
ftype
]
->
f
,
json
);
if
(
code
)
return
code
;
}
// each level
cJSON
*
ajson
=
cJSON_AddArrayToObject
(
json
,
"stt"
);
if
(
ajson
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
SSttLvl
*
sttLvl
;
// LISTD_FOREACH(&fset->lvl0, sttLvl, listNode) {
// cJSON *ljson = cJSON_CreateObject();
// if (ljson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
// code = stt_lvl_to_json(sttLvl, ljson);
// if (code) return code;
// cJSON_AddItemToArray(ajson, ljson);
// }
SRBTreeIter
iter
=
tRBTreeIterCreate
(
&
fset
->
lvlTree
,
1
);
for
(
SRBTreeNode
*
node
=
tRBTreeIterNext
(
&
iter
);
node
;
node
=
tRBTreeIterNext
(
&
iter
))
{
SSttLvl
*
lvl
=
TCONTAINER_OF
(
node
,
SSttLvl
,
rbtn
);
code
=
stt_lvl_to_json
(
lvl
,
ajson
);
if
(
code
)
return
code
;
}
return
0
;
}
...
...
source/util/src/trbtree.c
浏览文件 @
e783609e
...
...
@@ -105,7 +105,7 @@ static void tRBTreeTransplant(SRBTree *pTree, SRBTreeNode *u, SRBTreeNode *v) {
v
->
parent
=
u
->
parent
;
}
static
SRBTreeNode
*
tRBTreeSuccessor
(
SRBTree
*
pTree
,
SRBTreeNode
*
pNode
)
{
static
SRBTreeNode
*
tRBTreeSuccessor
(
const
SRBTree
*
pTree
,
SRBTreeNode
*
pNode
)
{
if
(
pNode
->
right
!=
pTree
->
NIL
)
{
pNode
=
pNode
->
right
;
while
(
pNode
->
left
!=
pTree
->
NIL
)
{
...
...
@@ -125,7 +125,7 @@ static SRBTreeNode *tRBTreeSuccessor(SRBTree *pTree, SRBTreeNode *pNode) {
return
pNode
;
}
static
SRBTreeNode
*
tRBTreePredecessor
(
SRBTree
*
pTree
,
SRBTreeNode
*
pNode
)
{
static
SRBTreeNode
*
tRBTreePredecessor
(
const
SRBTree
*
pTree
,
SRBTreeNode
*
pNode
)
{
if
(
pNode
->
left
!=
pTree
->
NIL
)
{
pNode
=
pNode
->
left
;
while
(
pNode
->
right
!=
pTree
->
NIL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录