Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b6a567f9
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
b6a567f9
编写于
6月 15, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
eacd2ac2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
9 deletion
+51
-9
source/dnode/vnode/src/tsdb/tsdbFS2.c
source/dnode/vnode/src/tsdb/tsdbFS2.c
+8
-7
source/dnode/vnode/src/tsdb/tsdbFSet2.c
source/dnode/vnode/src/tsdb/tsdbFSet2.c
+41
-1
source/dnode/vnode/src/tsdb/tsdbFSet2.h
source/dnode/vnode/src/tsdb/tsdbFSet2.h
+2
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbFS2.c
浏览文件 @
b6a567f9
...
...
@@ -260,7 +260,7 @@ static int32_t apply_commit(STFileSystem *fs) {
TARRAY2_REMOVE
(
fsetArray1
,
i1
,
tsdbTFileSetRemove
);
}
else
if
(
fset1
->
fid
>
fset2
->
fid
)
{
// create new file set with fid of fset2->fid
code
=
tsdbTFileSetInit
Ex
(
fs
->
tsdb
,
fset2
,
&
fset1
);
code
=
tsdbTFileSetInit
Dup
(
fs
->
tsdb
,
fset2
,
&
fset1
);
if
(
code
)
return
code
;
code
=
TARRAY2_SORT_INSERT
(
fsetArray1
,
fset1
,
tsdbTFileSetCmprFn
);
if
(
code
)
return
code
;
...
...
@@ -278,7 +278,7 @@ static int32_t apply_commit(STFileSystem *fs) {
TARRAY2_REMOVE
(
fsetArray1
,
i1
,
tsdbTFileSetRemove
);
}
else
{
// create new file set with fid of fset2->fid
code
=
tsdbTFileSetInit
Ex
(
fs
->
tsdb
,
fset2
,
&
fset1
);
code
=
tsdbTFileSetInit
Dup
(
fs
->
tsdb
,
fset2
,
&
fset1
);
if
(
code
)
return
code
;
code
=
TARRAY2_SORT_INSERT
(
fsetArray1
,
fset1
,
tsdbTFileSetCmprFn
);
if
(
code
)
return
code
;
...
...
@@ -383,7 +383,7 @@ static int32_t tsdbFSDupState(STFileSystem *fs) {
const
STFileSet
*
fset1
;
TARRAY2_FOREACH
(
src
,
fset1
)
{
STFileSet
*
fset2
;
code
=
tsdbTFileSetInit
Ex
(
fs
->
tsdb
,
fset1
,
&
fset2
);
code
=
tsdbTFileSetInit
Dup
(
fs
->
tsdb
,
fset1
,
&
fset2
);
if
(
code
)
return
code
;
code
=
TARRAY2_APPEND
(
dst
,
fset2
);
if
(
code
)
return
code
;
...
...
@@ -656,7 +656,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
taosThreadRwlockRdlock
(
&
fs
->
tsdb
->
rwLock
);
TARRAY2_FOREACH
(
fs
->
fSetArr
,
fset
)
{
code
=
tsdbTFileSetInit
Ex
(
fs
->
tsdb
,
fset
,
&
fset1
);
code
=
tsdbTFileSetInit
Dup
(
fs
->
tsdb
,
fset
,
&
fset1
);
if
(
code
)
break
;
code
=
TARRAY2_APPEND
(
fsetArr
[
0
],
fset1
);
...
...
@@ -689,7 +689,8 @@ int32_t tsdbFSCreateRefSnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
taosThreadRwlockRdlock
(
&
fs
->
tsdb
->
rwLock
);
TARRAY2_FOREACH
(
fs
->
fSetArr
,
fset
)
{
// TODO: create ref fset of fset1
code
=
tsdbTFileSetInitRef
(
fs
->
tsdb
,
fset
,
&
fset1
);
if
(
code
)
break
;
code
=
TARRAY2_APPEND
(
fsetArr
[
0
],
fset1
);
if
(
code
)
break
;
...
...
@@ -697,7 +698,7 @@ int32_t tsdbFSCreateRefSnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
taosThreadRwlockUnlock
(
&
fs
->
tsdb
->
rwLock
);
if
(
code
)
{
TARRAY2_DESTROY
(
fsetArr
[
0
],
NULL
/* TODO */
);
TARRAY2_DESTROY
(
fsetArr
[
0
],
tsdbTFileSetClear
);
fsetArr
[
0
]
=
NULL
;
}
return
code
;
...
...
@@ -705,7 +706,7 @@ int32_t tsdbFSCreateRefSnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
int32_t
tsdbFSDestroyRefSnapshot
(
TFileSetArray
**
fsetArr
)
{
if
(
fsetArr
[
0
])
{
TARRAY2_DESTROY
(
fsetArr
[
0
],
NULL
/* TODO */
);
TARRAY2_DESTROY
(
fsetArr
[
0
],
tsdbTFileSetClear
);
fsetArr
[
0
]
=
NULL
;
}
return
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbFSet2.c
浏览文件 @
b6a567f9
...
...
@@ -48,6 +48,19 @@ static int32_t tsdbSttLvlInitEx(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lvl
return
0
;
}
static
int32_t
tsdbSttLvlInitRef
(
STsdb
*
pTsdb
,
const
SSttLvl
*
lvl1
,
SSttLvl
**
lvl
)
{
int32_t
code
=
tsdbSttLvlInit
(
lvl1
->
level
,
lvl
);
if
(
code
)
return
code
;
STFileObj
*
fobj1
;
TARRAY2_FOREACH
(
lvl1
->
fobjArr
,
fobj1
)
{
tsdbTFileObjRef
(
fobj1
);
code
=
TARRAY2_APPEND
(
lvl
[
0
]
->
fobjArr
,
fobj1
);
if
(
code
)
return
code
;
}
return
0
;
}
static
void
tsdbSttLvlRemoveFObj
(
void
*
data
)
{
tsdbTFileObjRemove
(
*
(
STFileObj
**
)
data
);
}
static
void
tsdbSttLvlRemove
(
SSttLvl
**
lvl
)
{
TARRAY2_DESTROY
(
lvl
[
0
]
->
fobjArr
,
tsdbSttLvlRemoveFObj
);
...
...
@@ -405,7 +418,7 @@ int32_t tsdbTFileSetInit(int32_t fid, STFileSet **fset) {
return
0
;
}
int32_t
tsdbTFileSetInit
Ex
(
STsdb
*
pTsdb
,
const
STFileSet
*
fset1
,
STFileSet
**
fset
)
{
int32_t
tsdbTFileSetInit
Dup
(
STsdb
*
pTsdb
,
const
STFileSet
*
fset1
,
STFileSet
**
fset
)
{
int32_t
code
=
tsdbTFileSetInit
(
fset1
->
fid
,
fset
);
if
(
code
)
return
code
;
...
...
@@ -435,6 +448,33 @@ int32_t tsdbTFileSetInitEx(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fse
return
0
;
}
int32_t
tsdbTFileSetInitRef
(
STsdb
*
pTsdb
,
const
STFileSet
*
fset1
,
STFileSet
**
fset
)
{
int32_t
code
=
tsdbTFileSetInit
(
fset1
->
fid
,
fset
);
if
(
code
)
return
code
;
for
(
int32_t
ftype
=
TSDB_FTYPE_MIN
;
ftype
<
TSDB_FTYPE_MAX
;
++
ftype
)
{
if
(
fset1
->
farr
[
ftype
]
==
NULL
)
continue
;
tsdbTFileObjRef
(
fset1
->
farr
[
ftype
]);
fset
[
0
]
->
farr
[
ftype
]
=
fset1
->
farr
[
ftype
];
}
const
SSttLvl
*
lvl1
;
TARRAY2_FOREACH
(
fset1
->
lvlArr
,
lvl1
)
{
SSttLvl
*
lvl
;
code
=
tsdbSttLvlInitRef
(
pTsdb
,
lvl1
,
&
lvl
);
if
(
code
)
{
tsdbTFileSetClear
(
fset
);
return
code
;
}
code
=
TARRAY2_APPEND
(
fset
[
0
]
->
lvlArr
,
lvl
);
if
(
code
)
return
code
;
}
return
0
;
}
int32_t
tsdbTFileSetClear
(
STFileSet
**
fset
)
{
if
(
!
fset
[
0
])
return
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbFSet2.h
浏览文件 @
b6a567f9
...
...
@@ -41,7 +41,8 @@ typedef enum {
// init/clear
int32_t
tsdbTFileSetInit
(
int32_t
fid
,
STFileSet
**
fset
);
int32_t
tsdbTFileSetInitEx
(
STsdb
*
pTsdb
,
const
STFileSet
*
fset1
,
STFileSet
**
fset
);
int32_t
tsdbTFileSetInitDup
(
STsdb
*
pTsdb
,
const
STFileSet
*
fset1
,
STFileSet
**
fset
);
int32_t
tsdbTFileSetInitRef
(
STsdb
*
pTsdb
,
const
STFileSet
*
fset1
,
STFileSet
**
fset
);
int32_t
tsdbTFileSetClear
(
STFileSet
**
fset
);
int32_t
tsdbTFileSetRemove
(
STFileSet
**
fset
);
// to/from json
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录