Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c94331fc
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
c94331fc
编写于
3月 30, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-34
上级
c2a06454
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
6 deletion
+28
-6
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+22
-1
src/vnode/tsdb/tests/tsdbTests.cpp
src/vnode/tsdb/tests/tsdbTests.cpp
+6
-5
未找到文件。
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
c94331fc
...
@@ -287,8 +287,29 @@ int32_t tsdbCloseRepo(tsdb_repo_t *repo) {
...
@@ -287,8 +287,29 @@ int32_t tsdbCloseRepo(tsdb_repo_t *repo) {
if
(
pRepo
==
NULL
)
return
0
;
if
(
pRepo
==
NULL
)
return
0
;
pRepo
->
state
=
TSDB_REPO_STATE_CLOSED
;
pRepo
->
state
=
TSDB_REPO_STATE_CLOSED
;
tsdbLockRepo
(
repo
);
if
(
pRepo
->
commit
)
{
tsdbUnLockRepo
(
repo
);
return
-
1
;
}
pRepo
->
commit
=
1
;
// Loop to move pData to iData
for
(
int
i
=
0
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
STable
*
pTable
=
pRepo
->
tsdbMeta
->
tables
[
i
];
if
(
pTable
!=
NULL
&&
pTable
->
mem
!=
NULL
)
{
pTable
->
imem
=
pTable
->
mem
;
pTable
->
mem
=
NULL
;
}
}
// TODO: Loop to move mem to imem
pRepo
->
tsdbCache
->
imem
=
pRepo
->
tsdbCache
->
mem
;
pRepo
->
tsdbCache
->
mem
=
NULL
;
pRepo
->
tsdbCache
->
curBlock
=
NULL
;
tsdbUnLockRepo
(
repo
);
tsdbCommitData
((
void
*
)
repo
);
tsdb
FlushCache
(
pRepo
);
tsdb
CloseFileH
(
pRepo
->
tsdbFileH
);
tsdbFreeMeta
(
pRepo
->
tsdbMeta
);
tsdbFreeMeta
(
pRepo
->
tsdbMeta
);
...
...
src/vnode/tsdb/tests/tsdbTests.cpp
浏览文件 @
c94331fc
...
@@ -78,7 +78,7 @@ TEST(TsdbTest, createRepo) {
...
@@ -78,7 +78,7 @@ TEST(TsdbTest, createRepo) {
tsdbCreateTable
(
pRepo
,
&
tCfg
);
tsdbCreateTable
(
pRepo
,
&
tCfg
);
// // 3. Loop to write some simple data
// // 3. Loop to write some simple data
int
nRows
=
1000000
0
;
int
nRows
=
1000000
;
int
rowsPerSubmit
=
10
;
int
rowsPerSubmit
=
10
;
int64_t
start_time
=
1584081000000
;
int64_t
start_time
=
1584081000000
;
...
@@ -87,6 +87,7 @@ TEST(TsdbTest, createRepo) {
...
@@ -87,6 +87,7 @@ TEST(TsdbTest, createRepo) {
double
stime
=
getCurTime
();
double
stime
=
getCurTime
();
for
(
int
k
=
0
;
k
<
nRows
/
rowsPerSubmit
;
k
++
)
{
for
(
int
k
=
0
;
k
<
nRows
/
rowsPerSubmit
;
k
++
)
{
memset
((
void
*
)
pMsg
,
0
,
sizeof
(
SSubmitMsg
));
SSubmitBlk
*
pBlock
=
pMsg
->
blocks
;
SSubmitBlk
*
pBlock
=
pMsg
->
blocks
;
pBlock
->
uid
=
987607499877672L
;
pBlock
->
uid
=
987607499877672L
;
pBlock
->
tid
=
0
;
pBlock
->
tid
=
0
;
...
@@ -108,6 +109,9 @@ TEST(TsdbTest, createRepo) {
...
@@ -108,6 +109,9 @@ TEST(TsdbTest, createRepo) {
}
}
pBlock
->
len
+=
dataRowLen
(
row
);
pBlock
->
len
+=
dataRowLen
(
row
);
}
}
pMsg
->
length
=
pMsg
->
length
+
sizeof
(
SSubmitBlk
)
+
pBlock
->
len
;
pMsg
->
numOfBlocks
=
1
;
pBlock
->
len
=
htonl
(
pBlock
->
len
);
pBlock
->
len
=
htonl
(
pBlock
->
len
);
pBlock
->
numOfRows
=
htonl
(
pBlock
->
numOfRows
);
pBlock
->
numOfRows
=
htonl
(
pBlock
->
numOfRows
);
pBlock
->
uid
=
htobe64
(
pBlock
->
uid
);
pBlock
->
uid
=
htobe64
(
pBlock
->
uid
);
...
@@ -116,7 +120,6 @@ TEST(TsdbTest, createRepo) {
...
@@ -116,7 +120,6 @@ TEST(TsdbTest, createRepo) {
pBlock
->
sversion
=
htonl
(
pBlock
->
sversion
);
pBlock
->
sversion
=
htonl
(
pBlock
->
sversion
);
pBlock
->
padding
=
htonl
(
pBlock
->
padding
);
pBlock
->
padding
=
htonl
(
pBlock
->
padding
);
pMsg
->
length
=
pMsg
->
length
+
sizeof
(
SSubmitBlk
)
+
pBlock
->
len
;
pMsg
->
length
=
htonl
(
pMsg
->
length
);
pMsg
->
length
=
htonl
(
pMsg
->
length
);
pMsg
->
numOfBlocks
=
htonl
(
pMsg
->
numOfBlocks
);
pMsg
->
numOfBlocks
=
htonl
(
pMsg
->
numOfBlocks
);
pMsg
->
compressed
=
htonl
(
pMsg
->
numOfBlocks
);
pMsg
->
compressed
=
htonl
(
pMsg
->
numOfBlocks
);
...
@@ -128,9 +131,7 @@ TEST(TsdbTest, createRepo) {
...
@@ -128,9 +131,7 @@ TEST(TsdbTest, createRepo) {
printf
(
"Spent %f seconds to write %d records
\n
"
,
etime
-
stime
,
nRows
);
printf
(
"Spent %f seconds to write %d records
\n
"
,
etime
-
stime
,
nRows
);
tsdbCloseRepo
(
pRepo
);
// tsdbTriggerCommit(pRepo);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录