Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
59cf3b3f
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看板
提交
59cf3b3f
编写于
5月 08, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add part of tsdb log
上级
db39eaec
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
8 deletion
+49
-8
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+49
-8
未找到文件。
src/tsdb/src/tsdbMain.c
浏览文件 @
59cf3b3f
...
...
@@ -90,6 +90,7 @@ void tsdbFreeCfg(STsdbCfg *pCfg) {
int32_t
tsdbCreateRepo
(
char
*
rootDir
,
STsdbCfg
*
pCfg
,
void
*
limiter
/* TODO */
)
{
if
(
mkdir
(
rootDir
,
0755
)
!=
0
)
{
tsdbError
(
"id %d: failed to create rootDir! rootDir %s, reason %s"
,
pCfg
->
tsdbId
,
rootDir
,
strerror
(
errno
));
if
(
errno
==
EACCES
)
{
return
TSDB_CODE_NO_DISK_PERMISSIONS
;
}
else
if
(
errno
==
ENOSPC
)
{
...
...
@@ -611,14 +612,20 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
if
(
pCfg
->
precision
==
-
1
)
{
pCfg
->
precision
=
TSDB_DEFAULT_PRECISION
;
}
else
{
if
(
!
IS_VALID_PRECISION
(
pCfg
->
precision
))
return
-
1
;
if
(
!
IS_VALID_PRECISION
(
pCfg
->
precision
))
{
tsdbError
(
"id %d: invalid precision configuration! precision %d"
,
pCfg
->
tsdbId
,
pCfg
->
precision
);
return
-
1
;
}
}
// Check compression
if
(
pCfg
->
compression
==
-
1
)
{
pCfg
->
compression
=
TSDB_DEFAULT_COMPRESSION
;
}
else
{
if
(
!
IS_VALID_COMPRESSION
(
pCfg
->
compression
))
return
-
1
;
if
(
!
IS_VALID_COMPRESSION
(
pCfg
->
compression
))
{
tsdbError
(
"id %d: invalid compression configuration! compression %d"
,
pCfg
->
tsdbId
,
pCfg
->
precision
);
return
-
1
;
}
}
// Check tsdbId
...
...
@@ -628,29 +635,49 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
if
(
pCfg
->
maxTables
==
-
1
)
{
pCfg
->
maxTables
=
TSDB_DEFAULT_TABLES
;
}
else
{
if
(
pCfg
->
maxTables
<
TSDB_MIN_TABLES
||
pCfg
->
maxTables
>
TSDB_MAX_TABLES
)
return
-
1
;
if
(
pCfg
->
maxTables
<
TSDB_MIN_TABLES
||
pCfg
->
maxTables
>
TSDB_MAX_TABLES
)
{
tsdbError
(
"id %d: invalid maxTables configuration! maxTables %d TSDB_MIN_TABLES %d TSDB_MAX_TABLES %d"
,
pCfg
->
tsdbId
,
pCfg
->
maxTables
,
TSDB_MIN_TABLES
,
TSDB_MAX_TABLES
);
return
-
1
;
}
}
// Check daysPerFile
if
(
pCfg
->
daysPerFile
==
-
1
)
{
pCfg
->
daysPerFile
=
TSDB_DEFAULT_DAYS_PER_FILE
;
}
else
{
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
return
-
1
;
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
{
tsdbError
(
"id %d: invalid daysPerFile configuration! daysPerFile %d TSDB_MIN_DAYS_PER_FILE %d TSDB_MAX_DAYS_PER_FILE "
"%d"
,
pCfg
->
tsdbId
,
pCfg
->
daysPerFile
,
TSDB_MIN_DAYS_PER_FILE
,
TSDB_MAX_DAYS_PER_FILE
);
return
-
1
;
}
}
// Check minRowsPerFileBlock and maxRowsPerFileBlock
if
(
pCfg
->
minRowsPerFileBlock
==
-
1
)
{
pCfg
->
minRowsPerFileBlock
=
TSDB_DEFAULT_MIN_ROW_FBLOCK
;
}
else
{
if
(
pCfg
->
minRowsPerFileBlock
<
TSDB_MIN_MIN_ROW_FBLOCK
||
pCfg
->
minRowsPerFileBlock
>
TSDB_MAX_MIN_ROW_FBLOCK
)
if
(
pCfg
->
minRowsPerFileBlock
<
TSDB_MIN_MIN_ROW_FBLOCK
||
pCfg
->
minRowsPerFileBlock
>
TSDB_MAX_MIN_ROW_FBLOCK
)
{
tsdbError
(
"id %d: invalid minRowsPerFileBlock configuration! minRowsPerFileBlock %d TSDB_MIN_MIN_ROW_FBLOCK %d "
"TSDB_MAX_MIN_ROW_FBLOCK %d"
,
pCfg
->
tsdbId
,
pCfg
->
minRowsPerFileBlock
,
TSDB_MIN_MIN_ROW_FBLOCK
,
TSDB_MAX_MIN_ROW_FBLOCK
);
return
-
1
;
}
}
if
(
pCfg
->
maxRowsPerFileBlock
==
-
1
)
{
pCfg
->
maxRowsPerFileBlock
=
TSDB_DEFAULT_MAX_ROW_FBLOCK
;
}
else
{
if
(
pCfg
->
maxRowsPerFileBlock
<
TSDB_MIN_MAX_ROW_FBLOCK
||
pCfg
->
maxRowsPerFileBlock
>
TSDB_MAX_MAX_ROW_FBLOCK
)
if
(
pCfg
->
maxRowsPerFileBlock
<
TSDB_MIN_MAX_ROW_FBLOCK
||
pCfg
->
maxRowsPerFileBlock
>
TSDB_MAX_MAX_ROW_FBLOCK
)
{
tsdbError
(
"id %d: invalid maxRowsPerFileBlock configuration! maxRowsPerFileBlock %d TSDB_MIN_MAX_ROW_FBLOCK %d "
"TSDB_MAX_MAX_ROW_FBLOCK %d"
,
pCfg
->
tsdbId
,
pCfg
->
maxRowsPerFileBlock
,
TSDB_MIN_MIN_ROW_FBLOCK
,
TSDB_MAX_MIN_ROW_FBLOCK
);
return
-
1
;
}
}
if
(
pCfg
->
minRowsPerFileBlock
>
pCfg
->
maxRowsPerFileBlock
)
return
-
1
;
...
...
@@ -659,7 +686,13 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
if
(
pCfg
->
keep
==
-
1
)
{
pCfg
->
keep
=
TSDB_DEFAULT_KEEP
;
}
else
{
if
(
pCfg
->
keep
<
TSDB_MIN_KEEP
||
pCfg
->
keep
>
TSDB_MAX_KEEP
)
return
-
1
;
if
(
pCfg
->
keep
<
TSDB_MIN_KEEP
||
pCfg
->
keep
>
TSDB_MAX_KEEP
)
{
tsdbError
(
"id %d: invalid keep configuration! keep %d TSDB_MIN_KEEP %d "
"TSDB_MAX_KEEP %d"
,
pCfg
->
tsdbId
,
pCfg
->
keep
,
TSDB_MIN_KEEP
,
TSDB_MAX_KEEP
);
return
-
1
;
}
}
return
0
;
...
...
@@ -716,15 +749,22 @@ static int32_t tsdbGetDataDirName(STsdbRepo *pRepo, char *fname) {
}
static
int32_t
tsdbSetRepoEnv
(
STsdbRepo
*
pRepo
)
{
STsdbCfg
*
pCfg
=
&
pRepo
->
config
;
if
(
tsdbSaveConfig
(
pRepo
)
<
0
)
return
-
1
;
char
dirName
[
128
]
=
"
\0
"
;
if
(
tsdbGetDataDirName
(
pRepo
,
dirName
)
<
0
)
return
-
1
;
if
(
mkdir
(
dirName
,
0755
)
<
0
)
{
tsdbError
(
"id %d: failed to create repository directory! reason %s"
,
pRepo
->
config
.
tsdbId
,
strerror
(
errno
));
return
-
1
;
}
tsdbError
(
"id %d: set up tsdb environment succeed! cacheBlockSize %d, totalBlocks %d, maxTables %d, daysPerFile %d, keep "
"%d, minRowsPerFileBlock %d, maxRowsPerFileBlock %d, precision %d, compression%d"
,
pRepo
->
config
.
tsdbId
,
pCfg
->
cacheBlockSize
,
pCfg
->
totalBlocks
,
pCfg
->
maxTables
,
pCfg
->
daysPerFile
,
pCfg
->
keep
,
pCfg
->
minRowsPerFileBlock
,
pCfg
->
maxRowsPerFileBlock
,
pCfg
->
precision
,
pCfg
->
compression
);
return
0
;
}
...
...
@@ -811,7 +851,8 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
STableId
tableId
=
{.
uid
=
pBlock
->
uid
,
.
tid
=
pBlock
->
tid
};
STable
*
pTable
=
tsdbIsValidTableToInsert
(
pRepo
->
tsdbMeta
,
tableId
);
if
(
pTable
==
NULL
)
{
tsdbError
(
"failed to get table for insert, uid:%"
PRIu64
", tid:%d"
,
tableId
.
uid
,
tableId
.
tid
);
tsdbError
(
"id %d: failed to get table for insert, uid:%"
PRIu64
", tid:%d"
,
pRepo
->
config
.
tsdbId
,
pBlock
->
uid
,
pBlock
->
tid
);
return
TSDB_CODE_INVALID_TABLE_ID
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录