Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mr、小李
TDengine
提交
5bbe41eb
T
TDengine
项目概览
Mr、小李
/
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,发现更多精彩内容 >>
提交
5bbe41eb
编写于
4月 29, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-183
上级
61a6a6d8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
15 deletion
+12
-15
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+2
-3
src/tsdb/src/tsdbCache.c
src/tsdb/src/tsdbCache.c
+4
-8
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+1
-1
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+5
-3
未找到文件。
src/tsdb/inc/tsdbMain.h
浏览文件 @
5bbe41eb
...
...
@@ -153,17 +153,16 @@ typedef struct {
}
SCacheMem
;
typedef
struct
{
int
maxBytes
;
int
cacheBlockSize
;
int
totalCacheBlocks
;
STsdbCachePool
pool
;
STsdbCacheBlock
*
curBlock
;
SCacheMem
*
mem
;
SCacheMem
*
imem
;
TsdbRepoT
*
pRepo
;
TsdbRepoT
*
pRepo
;
}
STsdbCache
;
STsdbCache
*
tsdbInitCache
(
int
maxBytes
,
int
cacheBlockSize
,
TsdbRepoT
*
pRepo
);
STsdbCache
*
tsdbInitCache
(
int
cacheBlockSize
,
int
totalBlocks
,
TsdbRepoT
*
pRepo
);
void
tsdbFreeCache
(
STsdbCache
*
pCache
);
void
*
tsdbAllocFromCache
(
STsdbCache
*
pCache
,
int
bytes
,
TSKEY
key
);
...
...
src/tsdb/src/tsdbCache.c
浏览文件 @
5bbe41eb
...
...
@@ -21,29 +21,25 @@ static int tsdbAllocBlockFromPool(STsdbCache *pCache);
static
void
tsdbFreeBlockList
(
SList
*
list
);
static
void
tsdbFreeCacheMem
(
SCacheMem
*
mem
);
STsdbCache
*
tsdbInitCache
(
int
maxBytes
,
int
cacheBlockSize
,
TsdbRepoT
*
pRepo
)
{
STsdbCache
*
tsdbInitCache
(
int
cacheBlockSize
,
int
totalBlocks
,
TsdbRepoT
*
pRepo
)
{
STsdbCache
*
pCache
=
(
STsdbCache
*
)
calloc
(
1
,
sizeof
(
STsdbCache
));
if
(
pCache
==
NULL
)
return
NULL
;
if
(
cacheBlockSize
<
0
)
cacheBlockSize
=
TSDB_DEFAULT_CACHE_BLOCK_SIZE
;
cacheBlockSize
*=
(
1024
*
1024
);
if
(
maxBytes
<
0
)
maxBytes
=
cacheBlockSize
*
TSDB_DEFAULT_TOTAL_BLOCKS
;
if
(
totalBlocks
<=
1
)
totalBlocks
=
TSDB_DEFAULT_TOTAL_BLOCKS
;
pCache
->
maxBytes
=
maxBytes
;
pCache
->
cacheBlockSize
=
cacheBlockSize
;
pCache
->
totalCacheBlocks
=
totalBlocks
;
pCache
->
pRepo
=
pRepo
;
int
nBlocks
=
maxBytes
/
cacheBlockSize
+
1
;
if
(
nBlocks
<=
1
)
nBlocks
=
2
;
pCache
->
totalCacheBlocks
=
nBlocks
;
STsdbCachePool
*
pPool
=
&
(
pCache
->
pool
);
pPool
->
index
=
0
;
pPool
->
memPool
=
tdListNew
(
sizeof
(
STsdbCacheBlock
*
));
if
(
pPool
->
memPool
==
NULL
)
goto
_err
;
for
(
int
i
=
0
;
i
<
n
Blocks
;
i
++
)
{
for
(
int
i
=
0
;
i
<
total
Blocks
;
i
++
)
{
STsdbCacheBlock
*
pBlock
=
(
STsdbCacheBlock
*
)
malloc
(
sizeof
(
STsdbCacheBlock
)
+
cacheBlockSize
);
if
(
pBlock
==
NULL
)
{
goto
_err
;
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
5bbe41eb
...
...
@@ -203,7 +203,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
return
NULL
;
}
pRepo
->
tsdbCache
=
tsdbInitCache
(
-
1
,
-
1
,
(
TsdbRepoT
*
)
pRepo
);
pRepo
->
tsdbCache
=
tsdbInitCache
(
pRepo
->
config
.
cacheBlockSize
,
pRepo
->
config
.
totalBlocks
,
(
TsdbRepoT
*
)
pRepo
);
if
(
pRepo
->
tsdbCache
==
NULL
)
{
tsdbFreeMeta
(
pRepo
->
tsdbMeta
);
free
(
pRepo
->
rootDir
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
5bbe41eb
...
...
@@ -96,14 +96,16 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) {
}
STsdbCfg
tsdbCfg
=
{
0
};
tsdbCfg
.
precision
=
pVnodeCfg
->
cfg
.
precision
;
tsdbCfg
.
compression
=
pVnodeCfg
->
cfg
.
compression
;;
tsdbCfg
.
tsdbId
=
pVnodeCfg
->
cfg
.
vgId
;
tsdbCfg
.
cacheBlockSize
=
pVnodeCfg
->
cfg
.
cacheBlockSize
;
tsdbCfg
.
totalBlocks
=
pVnodeCfg
->
cfg
.
totalBlocks
;
tsdbCfg
.
maxTables
=
pVnodeCfg
->
cfg
.
maxTables
;
tsdbCfg
.
daysPerFile
=
pVnodeCfg
->
cfg
.
daysPerFile
;
tsdbCfg
.
keep
=
pVnodeCfg
->
cfg
.
daysToKeep
;
tsdbCfg
.
minRowsPerFileBlock
=
pVnodeCfg
->
cfg
.
minRowsPerFileBlock
;
tsdbCfg
.
maxRowsPerFileBlock
=
pVnodeCfg
->
cfg
.
maxRowsPerFileBlock
;
tsdbCfg
.
keep
=
pVnodeCfg
->
cfg
.
daysToKeep
;
tsdbCfg
.
precision
=
pVnodeCfg
->
cfg
.
precision
;
tsdbCfg
.
compression
=
pVnodeCfg
->
cfg
.
compression
;;
char
tsdbDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
tsdbDir
,
"%s/vnode%d/tsdb"
,
tsVnodeDir
,
pVnodeCfg
->
cfg
.
vgId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录