Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
codyshao
TDengine
提交
83f9c368
T
TDengine
项目概览
codyshao
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
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,发现更多精彩内容 >>
提交
83f9c368
编写于
4月 30, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-166
上级
e242b4fd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
10 deletion
+13
-10
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+11
-8
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+2
-2
未找到文件。
src/tsdb/src/tsdbMain.c
浏览文件 @
83f9c368
...
@@ -158,7 +158,7 @@ static int tsdbRestoreInfo(STsdbRepo *pRepo) {
...
@@ -158,7 +158,7 @@ static int tsdbRestoreInfo(STsdbRepo *pRepo) {
tsdbInitFileGroupIter
(
pFileH
,
&
iter
,
TSDB_ORDER_ASC
);
tsdbInitFileGroupIter
(
pFileH
,
&
iter
,
TSDB_ORDER_ASC
);
while
((
pFGroup
=
tsdbGetFileGroupNext
(
&
iter
))
!=
NULL
)
{
while
((
pFGroup
=
tsdbGetFileGroupNext
(
&
iter
))
!=
NULL
)
{
if
(
tsdbSetAndOpenHelperFile
(
&
rhelper
,
pFGroup
)
<
0
)
goto
_err
;
if
(
tsdbSetAndOpenHelperFile
(
&
rhelper
,
pFGroup
)
<
0
)
goto
_err
;
for
(
int
i
=
0
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
STable
*
pTable
=
pMeta
->
tables
[
i
];
STable
*
pTable
=
pMeta
->
tables
[
i
];
SCompIdx
*
pIdx
=
&
rhelper
.
pCompIdx
[
i
];
SCompIdx
*
pIdx
=
&
rhelper
.
pCompIdx
[
i
];
...
@@ -260,7 +260,7 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
...
@@ -260,7 +260,7 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
}
}
pRepo
->
commit
=
1
;
pRepo
->
commit
=
1
;
// Loop to move pData to iData
// Loop to move pData to iData
for
(
int
i
=
0
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
STable
*
pTable
=
pRepo
->
tsdbMeta
->
tables
[
i
];
STable
*
pTable
=
pRepo
->
tsdbMeta
->
tables
[
i
];
if
(
pTable
!=
NULL
&&
pTable
->
mem
!=
NULL
)
{
if
(
pTable
!=
NULL
&&
pTable
->
mem
!=
NULL
)
{
pTable
->
imem
=
pTable
->
mem
;
pTable
->
imem
=
pTable
->
mem
;
...
@@ -313,7 +313,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) {
...
@@ -313,7 +313,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) {
}
}
pRepo
->
commit
=
1
;
pRepo
->
commit
=
1
;
// Loop to move pData to iData
// Loop to move pData to iData
for
(
int
i
=
0
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
STable
*
pTable
=
pRepo
->
tsdbMeta
->
tables
[
i
];
STable
*
pTable
=
pRepo
->
tsdbMeta
->
tables
[
i
];
if
(
pTable
!=
NULL
&&
pTable
->
mem
!=
NULL
)
{
if
(
pTable
!=
NULL
&&
pTable
->
mem
!=
NULL
)
{
pTable
->
imem
=
pTable
->
mem
;
pTable
->
imem
=
pTable
->
mem
;
...
@@ -611,6 +611,10 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -611,6 +611,10 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
if
(
pCfg
->
maxTables
<
TSDB_MIN_TABLES
||
pCfg
->
maxTables
>
TSDB_MAX_TABLES
)
return
-
1
;
if
(
pCfg
->
maxTables
<
TSDB_MIN_TABLES
||
pCfg
->
maxTables
>
TSDB_MAX_TABLES
)
return
-
1
;
}
}
// Since tableId starts from 1, we increase maxTables by 1
// TODO: take a fancier way to do this
pCfg
->
maxTables
++
;
// Check daysPerFile
// Check daysPerFile
if
(
pCfg
->
daysPerFile
==
-
1
)
{
if
(
pCfg
->
daysPerFile
==
-
1
)
{
pCfg
->
daysPerFile
=
TSDB_DEFAULT_DAYS_PER_FILE
;
pCfg
->
daysPerFile
=
TSDB_DEFAULT_DAYS_PER_FILE
;
...
@@ -833,7 +837,7 @@ static int tsdbReadRowsFromCache(SSkipListIterator *pIter, TSKEY maxKey, int max
...
@@ -833,7 +837,7 @@ static int tsdbReadRowsFromCache(SSkipListIterator *pIter, TSKEY maxKey, int max
static
void
tsdbDestroyTableIters
(
SSkipListIterator
**
iters
,
int
maxTables
)
{
static
void
tsdbDestroyTableIters
(
SSkipListIterator
**
iters
,
int
maxTables
)
{
if
(
iters
==
NULL
)
return
;
if
(
iters
==
NULL
)
return
;
for
(
int
tid
=
0
;
tid
<
maxTables
;
tid
++
)
{
for
(
int
tid
=
1
;
tid
<
maxTables
;
tid
++
)
{
if
(
iters
[
tid
]
==
NULL
)
continue
;
if
(
iters
[
tid
]
==
NULL
)
continue
;
tSkipListDestroyIter
(
iters
[
tid
]);
tSkipListDestroyIter
(
iters
[
tid
]);
}
}
...
@@ -845,7 +849,7 @@ static SSkipListIterator **tsdbCreateTableIters(STsdbMeta *pMeta, int maxTables)
...
@@ -845,7 +849,7 @@ static SSkipListIterator **tsdbCreateTableIters(STsdbMeta *pMeta, int maxTables)
SSkipListIterator
**
iters
=
(
SSkipListIterator
**
)
calloc
(
maxTables
,
sizeof
(
SSkipListIterator
*
));
SSkipListIterator
**
iters
=
(
SSkipListIterator
**
)
calloc
(
maxTables
,
sizeof
(
SSkipListIterator
*
));
if
(
iters
==
NULL
)
return
NULL
;
if
(
iters
==
NULL
)
return
NULL
;
for
(
int
tid
=
0
;
tid
<
maxTables
;
tid
++
)
{
for
(
int
tid
=
1
;
tid
<
maxTables
;
tid
++
)
{
STable
*
pTable
=
pMeta
->
tables
[
tid
];
STable
*
pTable
=
pMeta
->
tables
[
tid
];
if
(
pTable
==
NULL
||
pTable
->
imem
==
NULL
)
continue
;
if
(
pTable
==
NULL
||
pTable
->
imem
==
NULL
)
continue
;
...
@@ -912,7 +916,7 @@ _exit:
...
@@ -912,7 +916,7 @@ _exit:
free
(
pCache
->
imem
);
free
(
pCache
->
imem
);
pCache
->
imem
=
NULL
;
pCache
->
imem
=
NULL
;
pRepo
->
commit
=
0
;
pRepo
->
commit
=
0
;
for
(
int
i
=
0
;
i
<
pCfg
->
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pCfg
->
maxTables
;
i
++
)
{
STable
*
pTable
=
pMeta
->
tables
[
i
];
STable
*
pTable
=
pMeta
->
tables
[
i
];
if
(
pTable
&&
pTable
->
imem
)
{
if
(
pTable
&&
pTable
->
imem
)
{
tsdbFreeMemTable
(
pTable
->
imem
);
tsdbFreeMemTable
(
pTable
->
imem
);
...
@@ -946,7 +950,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
...
@@ -946,7 +950,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
if
(
tsdbSetAndOpenHelperFile
(
pHelper
,
pGroup
)
<
0
)
goto
_err
;
if
(
tsdbSetAndOpenHelperFile
(
pHelper
,
pGroup
)
<
0
)
goto
_err
;
// Loop to commit data in each table
// Loop to commit data in each table
for
(
int
tid
=
0
;
tid
<
pCfg
->
maxTables
;
tid
++
)
{
for
(
int
tid
=
1
;
tid
<
pCfg
->
maxTables
;
tid
++
)
{
STable
*
pTable
=
pMeta
->
tables
[
tid
];
STable
*
pTable
=
pMeta
->
tables
[
tid
];
if
(
pTable
==
NULL
)
continue
;
if
(
pTable
==
NULL
)
continue
;
...
@@ -984,7 +988,6 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
...
@@ -984,7 +988,6 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
// Write the SCompBlock part
// Write the SCompBlock part
if
(
tsdbWriteCompInfo
(
pHelper
)
<
0
)
goto
_err
;
if
(
tsdbWriteCompInfo
(
pHelper
)
<
0
)
goto
_err
;
}
}
if
(
tsdbWriteCompIdx
(
pHelper
)
<
0
)
goto
_err
;
if
(
tsdbWriteCompIdx
(
pHelper
)
<
0
)
goto
_err
;
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
83f9c368
...
@@ -129,7 +129,7 @@ int tsdbRestoreTable(void *pHandle, void *cont, int contLen) {
...
@@ -129,7 +129,7 @@ int tsdbRestoreTable(void *pHandle, void *cont, int contLen) {
void
tsdbOrgMeta
(
void
*
pHandle
)
{
void
tsdbOrgMeta
(
void
*
pHandle
)
{
STsdbMeta
*
pMeta
=
(
STsdbMeta
*
)
pHandle
;
STsdbMeta
*
pMeta
=
(
STsdbMeta
*
)
pHandle
;
for
(
int
i
=
0
;
i
<
pMeta
->
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pMeta
->
maxTables
;
i
++
)
{
STable
*
pTable
=
pMeta
->
tables
[
i
];
STable
*
pTable
=
pMeta
->
tables
[
i
];
if
(
pTable
!=
NULL
&&
pTable
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
pTable
!=
NULL
&&
pTable
->
type
==
TSDB_CHILD_TABLE
)
{
tsdbAddTableIntoIndex
(
pMeta
,
pTable
);
tsdbAddTableIntoIndex
(
pMeta
,
pTable
);
...
@@ -179,7 +179,7 @@ int32_t tsdbFreeMeta(STsdbMeta *pMeta) {
...
@@ -179,7 +179,7 @@ int32_t tsdbFreeMeta(STsdbMeta *pMeta) {
tsdbCloseMetaFile
(
pMeta
->
mfh
);
tsdbCloseMetaFile
(
pMeta
->
mfh
);
for
(
int
i
=
0
;
i
<
pMeta
->
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pMeta
->
maxTables
;
i
++
)
{
if
(
pMeta
->
tables
[
i
]
!=
NULL
)
{
if
(
pMeta
->
tables
[
i
]
!=
NULL
)
{
tsdbFreeTable
(
pMeta
->
tables
[
i
]);
tsdbFreeTable
(
pMeta
->
tables
[
i
]);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录