Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0b101e49
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b101e49
编写于
3月 22, 2023
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: support WAL_RETENTION_PERIOD and WAL_RETENTION_SIZE for alter database
上级
a4eef9ea
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
54 addition
and
20 deletion
+54
-20
include/common/tmsg.h
include/common/tmsg.h
+3
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+23
-11
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+2
-0
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+3
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+12
-3
source/libs/wal/src/walMgmt.c
source/libs/wal/src/walMgmt.c
+11
-5
未找到文件。
include/common/tmsg.h
浏览文件 @
0b101e49
...
...
@@ -1322,6 +1322,9 @@ typedef struct {
// 1st modification
int16_t
sttTrigger
;
int32_t
minRows
;
// 2nd modification
int32_t
walRetentionPeriod
;
int32_t
walRetentionSize
;
}
SAlterVnodeConfigReq
;
int32_t
tSerializeSAlterVnodeConfigReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeConfigReq
*
pReq
);
...
...
source/common/src/tmsg.c
浏览文件 @
0b101e49
...
...
@@ -2219,12 +2219,12 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
sstTrigger
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
walRetentionSize
)
<
0
)
return
-
1
;
// 1st modification
if
(
tEncodeI32
(
&
encoder
,
pReq
->
minRows
)
<
0
)
return
-
1
;
// 2nd modification
if
(
tEncodeI32
(
&
encoder
,
pReq
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
walRetentionSize
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -2252,13 +2252,6 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
sstTrigger
)
<
0
)
return
-
1
;
if
(
!
tDecodeIsEnd
(
&
decoder
))
{
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
walRetentionSize
)
<
0
)
return
-
1
;
}
else
{
pReq
->
walRetentionPeriod
=
-
1
;
pReq
->
walRetentionSize
=
-
1
;
}
// 1st modification
if
(
!
tDecodeIsEnd
(
&
decoder
))
{
...
...
@@ -2266,6 +2259,15 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
}
else
{
pReq
->
minRows
=
-
1
;
}
// 2nd modification
if
(
!
tDecodeIsEnd
(
&
decoder
))
{
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
walRetentionSize
)
<
0
)
return
-
1
;
}
else
{
pReq
->
walRetentionPeriod
=
-
1
;
pReq
->
walRetentionSize
=
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
@@ -4196,7 +4198,9 @@ int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeCon
// 1st modification
if
(
tEncodeI16
(
&
encoder
,
pReq
->
sttTrigger
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
minRows
)
<
0
)
return
-
1
;
// 2nd modification
if
(
tEncodeI32
(
&
encoder
,
pReq
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
walRetentionSize
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -4235,6 +4239,14 @@ int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeC
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
minRows
)
<
0
)
return
-
1
;
}
// 2n modification
if
(
tDecodeIsEnd
(
&
decoder
))
{
pReq
->
walRetentionPeriod
=
-
1
;
pReq
->
walRetentionSize
=
-
1
;
}
else
{
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
walRetentionSize
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
0b101e49
...
...
@@ -275,6 +275,8 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
pOld
->
cfg
.
daysToKeep2
=
pNew
->
cfg
.
daysToKeep2
;
pOld
->
cfg
.
walFsyncPeriod
=
pNew
->
cfg
.
walFsyncPeriod
;
pOld
->
cfg
.
walLevel
=
pNew
->
cfg
.
walLevel
;
pOld
->
cfg
.
walRetentionPeriod
=
pNew
->
cfg
.
walRetentionPeriod
;
pOld
->
cfg
.
walRetentionSize
=
pNew
->
cfg
.
walRetentionSize
;
pOld
->
cfg
.
strict
=
pNew
->
cfg
.
strict
;
pOld
->
cfg
.
cacheLast
=
pNew
->
cfg
.
cacheLast
;
pOld
->
cfg
.
replications
=
pNew
->
cfg
.
replications
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
0b101e49
...
...
@@ -321,6 +321,8 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
alterReq
.
cacheLast
=
pDb
->
cfg
.
cacheLast
;
alterReq
.
sttTrigger
=
pDb
->
cfg
.
sstTrigger
;
alterReq
.
minRows
=
pDb
->
cfg
.
minRows
;
alterReq
.
walRetentionPeriod
=
pDb
->
cfg
.
walRetentionPeriod
;
alterReq
.
walRetentionSize
=
pDb
->
cfg
.
walRetentionSize
;
mInfo
(
"vgId:%d, build alter vnode config req"
,
pVgroup
->
vgId
);
int32_t
contLen
=
tSerializeSAlterVnodeConfigReq
(
NULL
,
0
,
&
alterReq
);
...
...
@@ -2267,4 +2269,4 @@ int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
STimeWindow
tw
)
{
if
(
mndAddCompactVnodeAction
(
pMnode
,
pTrans
,
pDb
,
pVgroup
,
compactTs
,
tw
)
!=
0
)
return
-
1
;
return
0
;
}
\ No newline at end of file
}
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
0b101e49
...
...
@@ -1477,10 +1477,11 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void
}
vInfo
(
"vgId:%d, start to alter vnode config, page:%d pageSize:%d buffer:%d szPage:%d szBuf:%"
PRIu64
" cacheLast:%d cacheLastSize:%d days:%d keep0:%d keep1:%d keep2:%d fsync:%d level:%d"
,
" cacheLast:%d cacheLastSize:%d days:%d keep0:%d keep1:%d keep2:%d fsync:%d level:%d walRetentionPeriod:%d "
"walRetentionSize:%d"
,
TD_VID
(
pVnode
),
req
.
pages
,
req
.
pageSize
,
req
.
buffer
,
req
.
pageSize
*
1024
,
(
uint64_t
)
req
.
buffer
*
1024
*
1024
,
req
.
cacheLast
,
req
.
cacheLastSize
,
req
.
daysPerFile
,
req
.
daysToKeep0
,
req
.
daysToKeep1
,
req
.
daysToKeep2
,
req
.
walFsyncPeriod
,
req
.
walLevel
);
req
.
walFsyncPeriod
,
req
.
walLevel
,
req
.
walRetentionPeriod
,
req
.
walRetentionSize
);
if
(
pVnode
->
config
.
cacheLastSize
!=
req
.
cacheLastSize
)
{
pVnode
->
config
.
cacheLastSize
=
req
.
cacheLastSize
;
...
...
@@ -1510,13 +1511,21 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void
if
(
pVnode
->
config
.
walCfg
.
fsyncPeriod
!=
req
.
walFsyncPeriod
)
{
pVnode
->
config
.
walCfg
.
fsyncPeriod
=
req
.
walFsyncPeriod
;
walChanged
=
true
;
}
if
(
pVnode
->
config
.
walCfg
.
level
!=
req
.
walLevel
)
{
pVnode
->
config
.
walCfg
.
level
=
req
.
walLevel
;
walChanged
=
true
;
}
if
(
pVnode
->
config
.
walCfg
.
retentionPeriod
!=
req
.
walRetentionPeriod
)
{
pVnode
->
config
.
walCfg
.
retentionPeriod
=
req
.
walRetentionPeriod
;
walChanged
=
true
;
}
if
(
pVnode
->
config
.
walCfg
.
retentionSize
!=
req
.
walRetentionSize
)
{
pVnode
->
config
.
walCfg
.
retentionSize
=
req
.
walRetentionSize
;
walChanged
=
true
;
}
...
...
source/libs/wal/src/walMgmt.c
浏览文件 @
0b101e49
...
...
@@ -179,17 +179,23 @@ _err:
int32_t
walAlter
(
SWal
*
pWal
,
SWalCfg
*
pCfg
)
{
if
(
pWal
==
NULL
)
return
TSDB_CODE_APP_ERROR
;
if
(
pWal
->
cfg
.
level
==
pCfg
->
level
&&
pWal
->
cfg
.
fsyncPeriod
==
pCfg
->
fsyncPeriod
)
{
wDebug
(
"vgId:%d, old walLevel:%d fsync:%d, new walLevel:%d fsync:%d not change"
,
pWal
->
cfg
.
vgId
,
pWal
->
cfg
.
level
,
pWal
->
cfg
.
fsyncPeriod
,
pCfg
->
level
,
pCfg
->
fsyncPeriod
);
if
(
pWal
->
cfg
.
level
==
pCfg
->
level
&&
pWal
->
cfg
.
fsyncPeriod
==
pCfg
->
fsyncPeriod
&&
pWal
->
cfg
.
retentionPeriod
==
pCfg
->
retentionPeriod
&&
pWal
->
cfg
.
retentionSize
==
pCfg
->
retentionSize
)
{
wDebug
(
"vgId:%d, walLevel:%d fsync:%d walRetentionPeriod:%d walRetentionSize:%"
PRId64
" not change"
,
pWal
->
cfg
.
vgId
,
pWal
->
cfg
.
level
,
pWal
->
cfg
.
fsyncPeriod
,
pWal
->
cfg
.
retentionPeriod
,
pWal
->
cfg
.
retentionSize
);
return
0
;
}
wInfo
(
"vgId:%d, change old walLevel:%d fsync:%d, new walLevel:%d fsync:%d"
,
pWal
->
cfg
.
vgId
,
pWal
->
cfg
.
level
,
pWal
->
cfg
.
fsyncPeriod
,
pCfg
->
level
,
pCfg
->
fsyncPeriod
);
wInfo
(
"vgId:%d, change old walLevel:%d fsync:%d walRetentionPeriod:%d walRetentionSize:%"
PRId64
", new walLevel:%d fsync:%d walRetentionPeriod:%d walRetentionSize:%"
PRId64
,
pWal
->
cfg
.
vgId
,
pWal
->
cfg
.
level
,
pWal
->
cfg
.
fsyncPeriod
,
pWal
->
cfg
.
retentionPeriod
,
pWal
->
cfg
.
retentionSize
,
pCfg
->
level
,
pCfg
->
fsyncPeriod
,
pCfg
->
retentionPeriod
,
pCfg
->
retentionSize
);
pWal
->
cfg
.
level
=
pCfg
->
level
;
pWal
->
cfg
.
fsyncPeriod
=
pCfg
->
fsyncPeriod
;
pWal
->
cfg
.
retentionPeriod
=
pCfg
->
retentionPeriod
;
pWal
->
cfg
.
retentionSize
=
pCfg
->
retentionSize
;
pWal
->
fsyncSeq
=
pCfg
->
fsyncPeriod
/
1000
;
if
(
pWal
->
fsyncSeq
<=
0
)
pWal
->
fsyncSeq
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录