Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
58ed42b0
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
58ed42b0
编写于
4月 12, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
3f8f7bb4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
142 addition
and
6 deletion
+142
-6
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
+2
-0
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
+44
-5
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
+67
-0
source/dnode/vnode/src/tsdb/dev/tsdbFSet.h
source/dnode/vnode/src/tsdb/dev/tsdbFSet.h
+4
-1
source/dnode/vnode/src/tsdb/dev/tsdbFile.c
source/dnode/vnode/src/tsdb/dev/tsdbFile.c
+22
-0
source/dnode/vnode/src/tsdb/dev/tsdbFile.h
source/dnode/vnode/src/tsdb/dev/tsdbFile.h
+2
-0
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
+1
-0
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
浏览文件 @
58ed42b0
...
...
@@ -368,6 +368,8 @@ static int32_t close_committer(SCommitter *pCommiter, int32_t eno) {
ASSERTS
(
0
,
"TODO: Not implemented yet"
);
}
// TODO: clear the committer
_exit:
if
(
code
)
{
tsdbError
(
//
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
浏览文件 @
58ed42b0
...
...
@@ -20,7 +20,10 @@ static int32_t create_file_system(STsdb *pTsdb, struct STFileSystem **ppFS) {
return
TSDB_CODE_OUT_OF_MEMORY
;
}
if
((
ppFS
[
0
]
->
aFileSet
=
taosArrayInit
(
16
,
sizeof
(
struct
SFileSet
)))
==
NULL
)
{
if
((
ppFS
[
0
]
->
aFileSet
=
taosArrayInit
(
16
,
sizeof
(
struct
SFileSet
)))
==
NULL
||
(
ppFS
[
0
]
->
nState
=
taosArrayInit
(
16
,
sizeof
(
struct
SFileSet
)))
==
NULL
)
{
taosArrayDestroy
(
ppFS
[
0
]
->
nState
);
taosArrayDestroy
(
ppFS
[
0
]
->
aFileSet
);
taosMemoryFree
(
ppFS
[
0
]);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -351,12 +354,19 @@ static int32_t apply_edit(struct STFileSystem *pFS) {
return
code
;
}
static
int32_t
fset_cmpr_fn
(
const
struct
SFileSet
*
pSet1
,
const
struct
SFileSet
*
pSet2
)
{
if
(
pSet1
->
fid
<
pSet2
->
fid
)
{
return
-
1
;
}
else
if
(
pSet1
->
fid
>
pSet2
->
fid
)
{
return
1
;
}
return
0
;
}
static
int32_t
edit_fs
(
struct
STFileSystem
*
pFS
,
const
SArray
*
aFileOp
)
{
int32_t
code
=
0
;
int32_t
lino
;
ASSERTS
(
0
,
"TODO: Not implemented yet"
);
taosArrayClearEx
(
pFS
->
nState
,
NULL
/* TODO */
);
// TODO: copy current state to new state
...
...
@@ -364,9 +374,38 @@ static int32_t edit_fs(struct STFileSystem *pFS, const SArray *aFileOp) {
for
(
int32_t
iop
=
0
;
iop
<
taosArrayGetSize
(
aFileOp
);
iop
++
)
{
struct
SFileOp
*
pOp
=
taosArrayGet
(
aFileOp
,
iop
);
struct
SFileSet
*
pSet
=
taosArraySearch
(
pFS
->
nState
,
NULL
/* TODO */
,
NULL
/* TODO */
,
TD_EQ
);
struct
SFileSet
tmpSet
=
{.
fid
=
pOp
->
fid
};
int32_t
idx
=
taosArraySearchIdx
(
//
pFS
->
nState
,
//
&
tmpSet
,
//
(
__compar_fn_t
)
fset_cmpr_fn
,
//
TD_GE
);
struct
SFileSet
*
pSet
;
if
(
idx
<
0
)
{
pSet
=
NULL
;
idx
=
taosArrayGetSize
(
pFS
->
nState
);
}
else
{
pSet
=
taosArrayGet
(
pFS
->
nState
,
idx
);
}
if
(
pSet
==
NULL
||
pSet
->
fid
!=
pOp
->
fid
)
{
ASSERTS
(
pOp
->
op
==
TSDB_FOP_CREATE
,
"BUG: Invalid file operation"
);
TSDB_CHECK_CODE
(
//
code
=
tsdbFileSetCreate
(
pOp
->
fid
,
&
pSet
),
//
lino
,
//
_exit
);
if
(
taosArrayInsert
(
pFS
->
nState
,
idx
,
pSet
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
// do opration on file set
TSDB_CHECK_CODE
(
//
code
=
tsdb
EditFileSe
t
(
pSet
,
pOp
),
//
code
=
tsdb
FileSetEdi
t
(
pSet
,
pOp
),
//
lino
,
//
_exit
);
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
浏览文件 @
58ed42b0
...
...
@@ -15,6 +15,73 @@
#include "dev.h"
int32_t
tsdbFileSetCreate
(
int32_t
fid
,
struct
SFileSet
**
ppSet
)
{
int32_t
code
=
0
;
ppSet
[
0
]
=
taosMemoryCalloc
(
1
,
sizeof
(
struct
SFileSet
));
if
(
ppSet
[
0
]
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
ppSet
[
0
]
->
fid
=
fid
;
ppSet
[
0
]
->
nextid
=
1
;
// TODO
_exit:
return
code
;
}
int32_t
tsdbFileSetEdit
(
struct
SFileSet
*
pSet
,
struct
SFileOp
*
pOp
)
{
int32_t
code
=
0
;
int32_t
lino
;
switch
(
pOp
->
op
)
{
case
TSDB_FOP_CREATE
:
{
struct
STFile
**
ppFile
;
switch
(
pOp
->
nState
.
type
)
{
case
TSDB_FTYPE_HEAD
:
{
ppFile
=
&
pSet
->
fHead
;
}
break
;
case
TSDB_FTYPE_DATA
:
{
ppFile
=
&
pSet
->
fData
;
}
break
;
case
TSDB_FTYPE_SMA
:
{
ppFile
=
&
pSet
->
fSma
;
}
break
;
case
TSDB_FTYPE_TOMB
:
{
ppFile
=
&
pSet
->
fTomb
;
}
break
;
case
TSDB_FTYPE_STT
:
{
ppFile
=
&
pSet
->
lStt
[
0
].
fStt
;
}
break
;
default:
{
ASSERTS
(
0
,
"Invalid file type"
);
}
break
;
}
TSDB_CHECK_CODE
(
//
code
=
tsdbTFileCreate
(
&
pOp
->
nState
,
ppFile
),
//
lino
,
//
_exit
);
}
break
;
case
TSDB_FOP_DELETE
:
{
ASSERTS
(
0
,
"TODO: Not implemented yet"
);
}
break
;
case
TSDB_FOP_TRUNCATE
:
{
ASSERTS
(
0
,
"TODO: Not implemented yet"
);
}
break
;
case
TSDB_FOP_EXTEND
:
{
ASSERTS
(
0
,
"TODO: Not implemented yet"
);
}
break
;
default:
{
ASSERTS
(
0
,
"Invalid file operation"
);
}
break
;
}
_exit:
return
code
;
}
int32_t
tsdbFileSetToJson
(
SJson
*
pJson
,
const
struct
SFileSet
*
pSet
)
{
int32_t
code
=
0
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFSet.h
浏览文件 @
58ed42b0
...
...
@@ -34,6 +34,7 @@ typedef enum {
struct
SFileOp
{
tsdb_fop_t
op
;
int32_t
fid
;
struct
STFile
oState
;
// old file state
struct
STFile
nState
;
// new file state
};
...
...
@@ -48,10 +49,12 @@ struct SFileSet {
struct
{
int32_t
level
;
int32_t
nFile
;
struct
STFile
*
f
ileLis
t
;
struct
STFile
*
f
St
t
;
}
lStt
[
TSDB_STT_FILE_LEVEL_MAX
];
};
int32_t
tsdbFileSetCreate
(
int32_t
fid
,
struct
SFileSet
**
ppSet
);
int32_t
tsdbFileSetEdit
(
struct
SFileSet
*
pSet
,
struct
SFileOp
*
pOp
);
int32_t
tsdbFileSetToJson
(
SJson
*
pJson
,
const
struct
SFileSet
*
pSet
);
int32_t
tsdbEditFileSet
(
struct
SFileSet
*
pFileSet
,
const
struct
SFileOp
*
pOp
);
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFile.c
浏览文件 @
58ed42b0
...
...
@@ -24,6 +24,28 @@ const char *tsdb_ftype_suffix[] = {
".stt"
,
// TSDB_FTYPE_STT
};
int32_t
tsdbTFileCreate
(
const
struct
STFile
*
config
,
struct
STFile
**
ppFile
)
{
int32_t
code
=
0
;
int32_t
lino
;
ppFile
[
0
]
=
(
struct
STFile
*
)
taosMemoryCalloc
(
1
,
sizeof
(
struct
STFile
));
if
(
ppFile
[
0
]
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
ppFile
[
0
][
0
]
=
config
[
0
];
_exit:
return
code
;
}
int32_t
tsdbTFileDestroy
(
struct
STFile
*
pFile
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbTFileInit
(
STsdb
*
pTsdb
,
struct
STFile
*
pFile
)
{
SVnode
*
pVnode
=
pTsdb
->
pVnode
;
STfs
*
pTfs
=
pVnode
->
pTfs
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFile.h
浏览文件 @
58ed42b0
...
...
@@ -42,6 +42,8 @@ struct STFile {
char
fname
[
TSDB_FILENAME_LEN
];
};
int32_t
tsdbTFileCreate
(
const
struct
STFile
*
config
,
struct
STFile
**
ppFile
);
int32_t
tsdbTFileDestroy
(
struct
STFile
*
pFile
);
int32_t
tsdbTFileInit
(
STsdb
*
pTsdb
,
struct
STFile
*
pFile
);
int32_t
tsdbTFileClear
(
struct
STFile
*
pFile
);
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
浏览文件 @
58ed42b0
...
...
@@ -538,6 +538,7 @@ int32_t tsdbSttFWriterClose(struct SSttFWriter **ppWriter, int8_t abort, struct
_exit
);
if
(
op
)
{
op
->
fid
=
ppWriter
[
0
]
->
config
.
file
.
fid
;
op
->
oState
=
ppWriter
[
0
]
->
config
.
file
;
op
->
nState
=
ppWriter
[
0
]
->
tFile
;
if
(
op
->
oState
.
size
==
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录