Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2a344855
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,发现更多精彩内容 >>
提交
2a344855
编写于
10月 26, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(wal): rollback multiple file
上级
4b5807c7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
4 deletion
+36
-4
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+0
-1
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+3
-3
source/libs/wal/test/walMetaTest.cpp
source/libs/wal/test/walMetaTest.cpp
+33
-0
未找到文件。
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
2a344855
...
...
@@ -77,7 +77,6 @@ int32_t mndInitSubscribe(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_VND_MQ_VG_CHANGE_RSP
,
mndTransProcessRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_MQ_VG_DELETE_RSP
,
mndTransProcessRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_DO_REBALANCE
,
mndProcessRebalanceReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_DO_REBALANCE
,
mndProcessRebalanceReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_DROP_CGROUP
,
mndProcessDropCgroupReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_DROP_CGROUP_RSP
,
mndTransProcessRsp
);
...
...
source/libs/wal/src/walMeta.c
浏览文件 @
2a344855
...
...
@@ -27,7 +27,7 @@ bool FORCE_INLINE walIsEmpty(SWal* pWal) { return pWal->vers.firstVer == -1; }
int64_t
FORCE_INLINE
walGetFirstVer
(
SWal
*
pWal
)
{
return
pWal
->
vers
.
firstVer
;
}
int64_t
FORCE_INLINE
walGetSnap
hos
tVer
(
SWal
*
pWal
)
{
return
pWal
->
vers
.
snapshotVer
;
}
int64_t
FORCE_INLINE
walGetSnap
sho
tVer
(
SWal
*
pWal
)
{
return
pWal
->
vers
.
snapshotVer
;
}
int64_t
FORCE_INLINE
walGetLastVer
(
SWal
*
pWal
)
{
return
pWal
->
vers
.
lastVer
;
}
...
...
@@ -124,7 +124,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) {
SWalCkHead
*
logContent
=
(
SWalCkHead
*
)
candidate
;
if
(
walValidHeadCksum
(
logContent
)
!=
0
)
{
wWarn
(
"vgId:%d, failed to validate checksum of wal entry header. offset:%"
PRId64
", file:%s"
,
pWal
->
cfg
.
vgId
,
offset
+
((
char
*
)(
logContent
)
-
buf
),
fnameStr
);
offset
+
((
char
*
)(
logContent
)
-
buf
),
fnameStr
);
haystack
=
candidate
+
1
;
if
(
firstTrial
)
{
break
;
...
...
@@ -163,7 +163,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) {
if
(
walValidBodyCksum
(
logContent
)
!=
0
)
{
terrno
=
TSDB_CODE_WAL_CHKSUM_MISMATCH
;
wWarn
(
"vgId:%d, failed to validate checksum of wal entry body. offset:%"
PRId64
", file:%s"
,
pWal
->
cfg
.
vgId
,
offset
+
((
char
*
)(
logContent
)
-
buf
),
fnameStr
);
offset
+
((
char
*
)(
logContent
)
-
buf
),
fnameStr
);
haystack
=
candidate
+
1
;
if
(
firstTrial
)
{
break
;
...
...
source/libs/wal/test/walMetaTest.cpp
浏览文件 @
2a344855
...
...
@@ -257,6 +257,39 @@ TEST_F(WalCleanEnv, rollback) {
ASSERT_EQ
(
code
,
0
);
}
TEST_F
(
WalCleanEnv
,
rollbackMultiFile
)
{
int
code
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
code
=
walWrite
(
pWal
,
i
,
i
+
1
,
(
void
*
)
ranStr
,
ranStrLen
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
i
);
if
(
i
==
5
)
{
walBeginSnapshot
(
pWal
,
i
);
walEndSnapshot
(
pWal
);
}
}
code
=
walRollback
(
pWal
,
12
);
ASSERT_NE
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
9
);
code
=
walRollback
(
pWal
,
9
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
8
);
code
=
walRollback
(
pWal
,
5
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
4
);
code
=
walRollback
(
pWal
,
3
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
2
);
code
=
walWrite
(
pWal
,
3
,
3
,
(
void
*
)
ranStr
,
ranStrLen
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
3
);
code
=
walSaveMeta
(
pWal
);
ASSERT_EQ
(
code
,
0
);
}
TEST_F
(
WalCleanDeleteEnv
,
roll
)
{
int
code
;
int
i
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录