Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KASAKI11
TDengine
提交
66af9af1
T
TDengine
项目概览
KASAKI11
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
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,发现更多精彩内容 >>
提交
66af9af1
编写于
3月 19, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-34
上级
0dde6985
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
17 deletion
+26
-17
src/vnode/tsdb/inc/tsdbFile.h
src/vnode/tsdb/inc/tsdbFile.h
+4
-3
src/vnode/tsdb/src/tsdbFile.c
src/vnode/tsdb/src/tsdbFile.c
+5
-11
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+17
-3
未找到文件。
src/vnode/tsdb/inc/tsdbFile.h
浏览文件 @
66af9af1
...
...
@@ -61,9 +61,10 @@ typedef struct {
#define IS_VALID_TSDB_FILE_TYPE(type) ((type) >= TSDB_FILE_TYPE_HEAD && (type) < TSDB_FILE_TYPE_MAX)
STsdbFileH
*
tsdbInitFile
(
char
*
dataDir
,
int32_t
daysPerFile
,
int32_t
keep
,
int32_t
minRowsPerFBlock
,
int32_t
maxRowsPerFBlock
);
void
tsdbCloseFile
(
STsdbFileH
*
pFileH
);
int
tsdbCreateFileGroup
(
char
*
dataDir
,
int
fileId
,
SFileGroup
*
pFGroup
,
int
maxTables
);
int32_t
maxRowsPerFBlock
,
int32_t
maxTables
);
void
tsdbCloseFile
(
STsdbFileH
*
pFileH
);
int
tsdbCreateFileGroup
(
char
*
dataDir
,
int
fileId
,
SFileGroup
*
pFGroup
,
int
maxTables
);
#ifdef __cplusplus
}
#endif
...
...
src/vnode/tsdb/src/tsdbFile.c
浏览文件 @
66af9af1
...
...
@@ -161,9 +161,10 @@ static int tsdbCreateFile(char *dataDir, int fileId, int8_t type, int maxTables,
return
0
;
}
/**
*
*/
static
int
tsdbRemoveFile
(
SFile
*
pFile
)
{
if
(
pFile
==
NULL
)
return
-
1
;
return
remove
(
pFile
->
fname
);
}
// Create a file group with fileId and return a SFileGroup object
int
tsdbCreateFileGroup
(
char
*
dataDir
,
int
fileId
,
SFileGroup
*
pFGroup
,
int
maxTables
)
{
...
...
@@ -187,7 +188,7 @@ int tsdbCreateFileGroup(char *dataDir, int fileId, SFileGroup *pFGroup, int maxT
* Initialize the TSDB file handle
*/
STsdbFileH
*
tsdbInitFile
(
char
*
dataDir
,
int32_t
daysPerFile
,
int32_t
keep
,
int32_t
minRowsPerFBlock
,
int32_t
maxRowsPerFBlock
)
{
int32_t
maxRowsPerFBlock
,
int32_t
maxTables
)
{
STsdbFileH
*
pTsdbFileH
=
(
STsdbFileH
*
)
calloc
(
1
,
sizeof
(
STsdbFileH
)
+
sizeof
(
SFileGroup
)
*
tsdbGetMaxNumOfFiles
(
keep
,
daysPerFile
));
if
(
pTsdbFileH
==
NULL
)
return
NULL
;
...
...
@@ -225,13 +226,6 @@ STsdbFileH *tsdbInitFile(char *dataDir, int32_t daysPerFile, int32_t keep, int32
return
pTsdbFileH
;
}
/**
* Closet the file handle
*/
void
tsdbCloseFile
(
STsdbFileH
*
pFileH
)
{
// TODO
}
static
void
tsdbGetKeyRangeOfFileId
(
int32_t
daysPerFile
,
int8_t
precision
,
int32_t
fileId
,
TSKEY
*
minKey
,
TSKEY
*
maxKey
)
{
*
minKey
=
fileId
*
daysPerFile
*
tsMsPerDay
[
precision
];
...
...
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
66af9af1
...
...
@@ -58,12 +58,12 @@ typedef struct _tsdb_repo {
// The cache Handle
STsdbCache
*
tsdbCache
;
// The TSDB file handle
STsdbFileH
*
tsdbFileH
;
// Disk tier handle for multi-tier storage
void
*
diskTier
;
// File Store
void
*
tsdbFiles
;
pthread_mutex_t
tsdbMutex
;
// A limiter to monitor the resources used by tsdb
...
...
@@ -79,6 +79,7 @@ static int32_t tsdbDestroyRepoEnv(STsdbRepo *pRepo);
static
int
tsdbOpenMetaFile
(
char
*
tsdbDir
);
static
int32_t
tsdbInsertDataToTable
(
tsdb_repo_t
*
repo
,
SSubmitBlk
*
pBlock
);
static
int32_t
tsdbRestoreCfg
(
STsdbRepo
*
pRepo
,
STsdbCfg
*
pCfg
);
static
int32_t
tsdbGetDataDirName
(
STsdbRepo
*
pRepo
,
char
*
fname
);
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
...
...
@@ -171,6 +172,19 @@ tsdb_repo_t *tsdbCreateRepo(char *rootDir, STsdbCfg *pCfg, void *limiter /* TODO
}
pRepo
->
tsdbCache
=
pCache
;
// Initialize file handle
char
dataDir
[
128
]
=
"
\0
"
;
tsdbGetDataDirName
(
pRepo
,
dataDir
);
pRepo
->
tsdbFileH
=
tsdbInitFile
(
dataDir
,
pCfg
->
daysPerFile
,
pCfg
->
keep
,
pCfg
->
minRowsPerFileBlock
,
pCfg
->
maxRowsPerFileBlock
,
pCfg
->
maxTables
);
if
(
pRepo
->
tsdbFileH
==
NULL
)
{
free
(
pRepo
->
rootDir
);
tsdbFreeCache
(
pRepo
->
tsdbCache
);
tsdbFreeMeta
(
pRepo
->
tsdbMeta
);
free
(
pRepo
);
return
NULL
;
}
pRepo
->
state
=
TSDB_REPO_STATE_ACTIVE
;
return
(
tsdb_repo_t
*
)
pRepo
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录