Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
TDengine
提交
431998ee
T
TDengine
项目概览
dgr6878
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
431998ee
编写于
5月 14, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add to commit option to tsdbCloseRepo
上级
b9ac23bc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
10 deletion
+25
-10
src/inc/tsdb.h
src/inc/tsdb.h
+1
-1
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+22
-7
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+2
-2
未找到文件。
src/inc/tsdb.h
浏览文件 @
431998ee
...
@@ -72,7 +72,7 @@ typedef void TsdbRepoT; // use void to hide implementation details from outside
...
@@ -72,7 +72,7 @@ typedef void TsdbRepoT; // use void to hide implementation details from outside
int
tsdbCreateRepo
(
char
*
rootDir
,
STsdbCfg
*
pCfg
,
void
*
limiter
);
int
tsdbCreateRepo
(
char
*
rootDir
,
STsdbCfg
*
pCfg
,
void
*
limiter
);
int32_t
tsdbDropRepo
(
TsdbRepoT
*
repo
);
int32_t
tsdbDropRepo
(
TsdbRepoT
*
repo
);
TsdbRepoT
*
tsdbOpenRepo
(
char
*
tsdbDir
,
STsdbAppH
*
pAppH
);
TsdbRepoT
*
tsdbOpenRepo
(
char
*
tsdbDir
,
STsdbAppH
*
pAppH
);
int32_t
tsdbCloseRepo
(
TsdbRepoT
*
repo
);
int32_t
tsdbCloseRepo
(
TsdbRepoT
*
repo
,
int
toCommit
);
int32_t
tsdbConfigRepo
(
TsdbRepoT
*
repo
,
STsdbCfg
*
pCfg
);
int32_t
tsdbConfigRepo
(
TsdbRepoT
*
repo
,
STsdbCfg
*
pCfg
);
// --------- TSDB TABLE DEFINITION
// --------- TSDB TABLE DEFINITION
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
431998ee
...
@@ -258,7 +258,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
...
@@ -258,7 +258,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
*
*
* @return 0 for success, -1 for failure and the error number is set
* @return 0 for success, -1 for failure and the error number is set
*/
*/
int32_t
tsdbCloseRepo
(
TsdbRepoT
*
repo
)
{
int32_t
tsdbCloseRepo
(
TsdbRepoT
*
repo
,
int
toCommit
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
if
(
pRepo
==
NULL
)
return
0
;
if
(
pRepo
==
NULL
)
return
0
;
int
id
=
pRepo
->
config
.
tsdbId
;
int
id
=
pRepo
->
config
.
tsdbId
;
...
@@ -285,7 +285,7 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
...
@@ -285,7 +285,7 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
tsdbUnLockRepo
(
repo
);
tsdbUnLockRepo
(
repo
);
if
(
pRepo
->
appH
.
notifyStatus
)
pRepo
->
appH
.
notifyStatus
(
pRepo
->
appH
.
appH
,
TSDB_STATUS_COMMIT_START
);
if
(
pRepo
->
appH
.
notifyStatus
)
pRepo
->
appH
.
notifyStatus
(
pRepo
->
appH
.
appH
,
TSDB_STATUS_COMMIT_START
);
tsdbCommitData
((
void
*
)
repo
);
if
(
toCommit
)
tsdbCommitData
((
void
*
)
repo
);
tsdbCloseFileH
(
pRepo
->
tsdbFileH
);
tsdbCloseFileH
(
pRepo
->
tsdbFileH
);
...
@@ -1018,10 +1018,16 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
...
@@ -1018,10 +1018,16 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
// Create and open files for commit
// Create and open files for commit
tsdbGetDataDirName
(
pRepo
,
dataDir
);
tsdbGetDataDirName
(
pRepo
,
dataDir
);
if
((
pGroup
=
tsdbCreateFGroup
(
pFileH
,
dataDir
,
fid
,
pCfg
->
maxTables
))
==
NULL
)
goto
_err
;
if
((
pGroup
=
tsdbCreateFGroup
(
pFileH
,
dataDir
,
fid
,
pCfg
->
maxTables
))
==
NULL
)
{
tsdbError
(
"vgId:%d, failed to create file group %d"
,
pRepo
->
config
.
tsdbId
,
fid
);
goto
_err
;
}
// Open files for write/read
// Open files for write/read
if
(
tsdbSetAndOpenHelperFile
(
pHelper
,
pGroup
)
<
0
)
goto
_err
;
if
(
tsdbSetAndOpenHelperFile
(
pHelper
,
pGroup
)
<
0
)
{
tsdbError
(
"vgId:%d, failed to set helper file"
,
pRepo
->
config
.
tsdbId
);
goto
_err
;
}
// Loop to commit data in each table
// Loop to commit data in each table
for
(
int
tid
=
1
;
tid
<
pCfg
->
maxTables
;
tid
++
)
{
for
(
int
tid
=
1
;
tid
<
pCfg
->
maxTables
;
tid
++
)
{
...
@@ -1058,13 +1064,22 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
...
@@ -1058,13 +1064,22 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
ASSERT
(
pDataCols
->
numOfPoints
==
0
);
ASSERT
(
pDataCols
->
numOfPoints
==
0
);
// Move the last block to the new .l file if neccessary
// Move the last block to the new .l file if neccessary
if
(
tsdbMoveLastBlockIfNeccessary
(
pHelper
)
<
0
)
goto
_err
;
if
(
tsdbMoveLastBlockIfNeccessary
(
pHelper
)
<
0
)
{
tsdbError
(
"vgId:%d, failed to move last block"
,
pRepo
->
config
.
tsdbId
);
goto
_err
;
}
// Write the SCompBlock part
// Write the SCompBlock part
if
(
tsdbWriteCompInfo
(
pHelper
)
<
0
)
goto
_err
;
if
(
tsdbWriteCompInfo
(
pHelper
)
<
0
)
{
tsdbError
(
"vgId:%d, failed to write compInfo part"
,
pRepo
->
config
.
tsdbId
);
goto
_err
;
}
}
}
if
(
tsdbWriteCompIdx
(
pHelper
)
<
0
)
goto
_err
;
if
(
tsdbWriteCompIdx
(
pHelper
)
<
0
)
{
tsdbError
(
"vgId:%d, failed to write compIdx part"
,
pRepo
->
config
.
tsdbId
);
goto
_err
;
}
tsdbCloseHelperFile
(
pHelper
,
0
);
tsdbCloseHelperFile
(
pHelper
,
0
);
// TODO: make it atomic with some methods
// TODO: make it atomic with some methods
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
431998ee
...
@@ -376,7 +376,7 @@ static void vnodeCleanUp(SVnodeObj *pVnode) {
...
@@ -376,7 +376,7 @@ static void vnodeCleanUp(SVnodeObj *pVnode) {
cqClose
(
pVnode
->
cq
);
cqClose
(
pVnode
->
cq
);
pVnode
->
cq
=
NULL
;
pVnode
->
cq
=
NULL
;
tsdbCloseRepo
(
pVnode
->
tsdb
);
tsdbCloseRepo
(
pVnode
->
tsdb
,
1
);
pVnode
->
tsdb
=
NULL
;
pVnode
->
tsdb
=
NULL
;
walClose
(
pVnode
->
wal
);
walClose
(
pVnode
->
wal
);
...
@@ -427,7 +427,7 @@ static void vnodeNotifyFileSynced(void *ahandle) {
...
@@ -427,7 +427,7 @@ static void vnodeNotifyFileSynced(void *ahandle) {
char
rootDir
[
128
]
=
"
\0
"
;
char
rootDir
[
128
]
=
"
\0
"
;
sprintf
(
rootDir
,
"%s/tsdb"
,
pVnode
->
rootDir
);
sprintf
(
rootDir
,
"%s/tsdb"
,
pVnode
->
rootDir
);
// clsoe tsdb, then open tsdb
// clsoe tsdb, then open tsdb
tsdbCloseRepo
(
pVnode
->
tsdb
);
tsdbCloseRepo
(
pVnode
->
tsdb
,
0
);
STsdbAppH
appH
=
{
0
};
STsdbAppH
appH
=
{
0
};
appH
.
appH
=
(
void
*
)
pVnode
;
appH
.
appH
=
(
void
*
)
pVnode
;
appH
.
notifyStatus
=
vnodeProcessTsdbStatus
;
appH
.
notifyStatus
=
vnodeProcessTsdbStatus
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录