Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9aae83df
T
TDengine
项目概览
慢慢CG
/
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看板
提交
9aae83df
编写于
5月 21, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-374
上级
a0703951
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
5 deletion
+26
-5
src/tsdb/src/tsdbCache.c
src/tsdb/src/tsdbCache.c
+1
-0
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+25
-5
未找到文件。
src/tsdb/src/tsdbCache.c
浏览文件 @
9aae83df
...
@@ -162,6 +162,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
...
@@ -162,6 +162,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
pCache
->
totalCacheBlocks
=
totalBlocks
;
pCache
->
totalCacheBlocks
=
totalBlocks
;
tsdbAdjustCacheBlocks
(
pCache
);
tsdbAdjustCacheBlocks
(
pCache
);
}
}
pRepo
->
config
.
totalBlocks
=
totalBlocks
;
tsdbUnLockRepo
((
TsdbRepoT
*
)
pRepo
);
tsdbUnLockRepo
((
TsdbRepoT
*
)
pRepo
);
tsdbTrace
(
"vgId:%d, tsdb total cache blocks changed from %d to %d"
,
pRepo
->
config
.
tsdbId
,
oldNumOfBlocks
,
totalBlocks
);
tsdbTrace
(
"vgId:%d, tsdb total cache blocks changed from %d to %d"
,
pRepo
->
config
.
tsdbId
,
oldNumOfBlocks
,
totalBlocks
);
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
9aae83df
...
@@ -37,7 +37,8 @@ static TSKEY tsdbNextIterKey(SSkipListIterator *pIter);
...
@@ -37,7 +37,8 @@ static TSKEY tsdbNextIterKey(SSkipListIterator *pIter);
static
int
tsdbHasDataToCommit
(
SSkipListIterator
**
iters
,
int
nIters
,
TSKEY
minKey
,
TSKEY
maxKey
);
static
int
tsdbHasDataToCommit
(
SSkipListIterator
**
iters
,
int
nIters
,
TSKEY
minKey
,
TSKEY
maxKey
);
static
void
tsdbAlterCompression
(
STsdbRepo
*
pRepo
,
int8_t
compression
);
static
void
tsdbAlterCompression
(
STsdbRepo
*
pRepo
,
int8_t
compression
);
static
void
tsdbAlterKeep
(
STsdbRepo
*
pRepo
,
int32_t
keep
);
static
void
tsdbAlterKeep
(
STsdbRepo
*
pRepo
,
int32_t
keep
);
static
void
tsdbAlterMaxTables
(
STsdbRepo
*
pRepo
,
int32_t
maxTables
);
static
void
tsdbAlterMaxTables
(
STsdbRepo
*
pRepo
,
int32_t
maxTables
);
static
int32_t
tsdbSaveConfig
(
STsdbRepo
*
pRepo
);
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
...
@@ -319,10 +320,25 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg) {
...
@@ -319,10 +320,25 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg) {
ASSERT
(
pRCfg
->
maxRowsPerFileBlock
==
pCfg
->
maxRowsPerFileBlock
);
ASSERT
(
pRCfg
->
maxRowsPerFileBlock
==
pCfg
->
maxRowsPerFileBlock
);
ASSERT
(
pRCfg
->
precision
==
pCfg
->
precision
);
ASSERT
(
pRCfg
->
precision
==
pCfg
->
precision
);
if
(
pRCfg
->
compression
!=
pCfg
->
compression
)
tsdbAlterCompression
(
pRepo
,
pCfg
->
compression
);
bool
configChanged
=
false
;
if
(
pRCfg
->
keep
!=
pCfg
->
keep
)
tsdbAlterKeep
(
pRepo
,
pCfg
->
keep
);
if
(
pRCfg
->
compression
!=
pCfg
->
compression
)
{
if
(
pRCfg
->
totalBlocks
!=
pCfg
->
totalBlocks
)
tsdbAlterCacheTotalBlocks
(
pRepo
,
pCfg
->
totalBlocks
);
configChanged
=
true
;
if
(
pRCfg
->
maxTables
!=
pCfg
->
maxTables
)
tsdbAlterMaxTables
(
pRepo
,
pCfg
->
maxTables
);
tsdbAlterCompression
(
pRepo
,
pCfg
->
compression
);
}
if
(
pRCfg
->
keep
!=
pCfg
->
keep
)
{
configChanged
=
true
;
tsdbAlterKeep
(
pRepo
,
pCfg
->
keep
);
}
if
(
pRCfg
->
totalBlocks
!=
pCfg
->
totalBlocks
)
{
configChanged
=
true
;
tsdbAlterCacheTotalBlocks
(
pRepo
,
pCfg
->
totalBlocks
);
}
if
(
pRCfg
->
maxTables
!=
pCfg
->
maxTables
)
{
configChanged
=
true
;
tsdbAlterMaxTables
(
pRepo
,
pCfg
->
maxTables
);
}
if
(
configChanged
)
tsdbSaveConfig
(
pRepo
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1134,8 +1150,10 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
...
@@ -1134,8 +1150,10 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
int
maxFiles
=
keep
/
pCfg
->
maxTables
+
3
;
int
maxFiles
=
keep
/
pCfg
->
maxTables
+
3
;
if
(
pRepo
->
config
.
keep
>
keep
)
{
if
(
pRepo
->
config
.
keep
>
keep
)
{
pRepo
->
config
.
keep
=
keep
;
pRepo
->
tsdbFileH
->
maxFGroups
=
maxFiles
;
pRepo
->
tsdbFileH
->
maxFGroups
=
maxFiles
;
}
else
{
}
else
{
pRepo
->
config
.
keep
=
keep
;
pRepo
->
tsdbFileH
->
fGroup
=
realloc
(
pRepo
->
tsdbFileH
->
fGroup
,
sizeof
(
SFileGroup
));
pRepo
->
tsdbFileH
->
fGroup
=
realloc
(
pRepo
->
tsdbFileH
->
fGroup
,
sizeof
(
SFileGroup
));
if
(
pRepo
->
tsdbFileH
->
fGroup
==
NULL
)
{
if
(
pRepo
->
tsdbFileH
->
fGroup
==
NULL
)
{
// TODO: deal with the error
// TODO: deal with the error
...
@@ -1155,6 +1173,8 @@ static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) {
...
@@ -1155,6 +1173,8 @@ static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) {
pMeta
->
maxTables
=
maxTables
;
pMeta
->
maxTables
=
maxTables
;
pMeta
->
tables
=
realloc
(
pMeta
->
tables
,
maxTables
*
sizeof
(
STable
*
));
pMeta
->
tables
=
realloc
(
pMeta
->
tables
,
maxTables
*
sizeof
(
STable
*
));
memset
(
&
pMeta
->
tables
[
oldMaxTables
],
0
,
sizeof
(
STable
*
)
*
(
maxTables
-
oldMaxTables
));
pRepo
->
config
.
maxTables
=
maxTables
;
tsdbTrace
(
"vgId:%d, tsdb maxTables is changed from %d to %d!"
,
pRepo
->
config
.
tsdbId
,
oldMaxTables
,
maxTables
);
tsdbTrace
(
"vgId:%d, tsdb maxTables is changed from %d to %d!"
,
pRepo
->
config
.
tsdbId
,
oldMaxTables
,
maxTables
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录