Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
006e13e6
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
006e13e6
编写于
11月 23, 2022
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: validate alignment of WAL and tsdb commit during syncLogBufferInit
上级
95f8e96e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
9 deletion
+26
-9
source/libs/sync/src/syncPipeline.c
source/libs/sync/src/syncPipeline.c
+22
-6
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+4
-3
未找到文件。
source/libs/sync/src/syncPipeline.c
浏览文件 @
006e13e6
...
@@ -119,6 +119,26 @@ SSyncRaftEntry* syncEntryBuildDummy(SyncTerm term, SyncIndex index, int32_t vgId
...
@@ -119,6 +119,26 @@ SSyncRaftEntry* syncEntryBuildDummy(SyncTerm term, SyncIndex index, int32_t vgId
return
syncEntryBuildNoop
(
term
,
index
,
vgId
);
return
syncEntryBuildNoop
(
term
,
index
,
vgId
);
}
}
int32_t
syncLogValidateAlignmentOfCommit
(
SSyncNode
*
pNode
,
SyncIndex
commitIndex
)
{
SyncIndex
firstVer
=
pNode
->
pLogStore
->
syncLogBeginIndex
(
pNode
->
pLogStore
);
if
(
firstVer
>
commitIndex
+
1
)
{
sError
(
"vgId:%d, firstVer of WAL log greater than tsdb commit version + 1. firstVer: %"
PRId64
", tsdb commit version: %"
PRId64
""
,
pNode
->
vgId
,
firstVer
,
commitIndex
);
return
-
1
;
}
SyncIndex
lastVer
=
pNode
->
pLogStore
->
syncLogLastIndex
(
pNode
->
pLogStore
);
if
(
lastVer
<
commitIndex
)
{
sError
(
"vgId:%d, lastVer of WAL log less than tsdb commit version. lastVer: %"
PRId64
", tsdb commit version: %"
PRId64
""
,
pNode
->
vgId
,
lastVer
,
commitIndex
);
return
-
1
;
}
return
0
;
}
int32_t
syncLogBufferInit
(
SSyncLogBuffer
*
pBuf
,
SSyncNode
*
pNode
)
{
int32_t
syncLogBufferInit
(
SSyncLogBuffer
*
pBuf
,
SSyncNode
*
pNode
)
{
taosThreadMutexLock
(
&
pBuf
->
mutex
);
taosThreadMutexLock
(
&
pBuf
->
mutex
);
ASSERT
(
pNode
->
pLogStore
!=
NULL
&&
"log store not created"
);
ASSERT
(
pNode
->
pLogStore
!=
NULL
&&
"log store not created"
);
...
@@ -132,16 +152,12 @@ int32_t syncLogBufferInit(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
...
@@ -132,16 +152,12 @@ int32_t syncLogBufferInit(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
}
}
SyncIndex
commitIndex
=
snapshot
.
lastApplyIndex
;
SyncIndex
commitIndex
=
snapshot
.
lastApplyIndex
;
SyncTerm
commitTerm
=
snapshot
.
lastApplyTerm
;
SyncTerm
commitTerm
=
snapshot
.
lastApplyTerm
;
if
(
syncLogValidateAlignmentOfCommit
(
pNode
,
commitIndex
))
{
SyncIndex
lastVer
=
pNode
->
pLogStore
->
syncLogLastIndex
(
pNode
->
pLogStore
);
if
(
lastVer
<
commitIndex
)
{
sError
(
"vgId:%d, lastVer of WAL log less than tsdb commit version. lastVer: %"
PRId64
", tsdb commit version: %"
PRId64
""
,
pNode
->
vgId
,
lastVer
,
commitIndex
);
terrno
=
TSDB_CODE_WAL_LOG_INCOMPLETE
;
terrno
=
TSDB_CODE_WAL_LOG_INCOMPLETE
;
goto
_err
;
goto
_err
;
}
}
SyncIndex
lastVer
=
pNode
->
pLogStore
->
syncLogLastIndex
(
pNode
->
pLogStore
);
ASSERT
(
lastVer
>=
commitIndex
);
ASSERT
(
lastVer
>=
commitIndex
);
SyncIndex
toIndex
=
lastVer
;
SyncIndex
toIndex
=
lastVer
;
// update match index
// update match index
...
...
source/libs/sync/src/syncUtil.c
浏览文件 @
006e13e6
...
@@ -238,9 +238,10 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
...
@@ -238,9 +238,10 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
taosPrintLog
(
flags
,
level
,
dflag
,
taosPrintLog
(
flags
,
level
,
dflag
,
"vgId:%d, sync %s "
"vgId:%d, sync %s "
"%s"
"%s"
", tm:%"
PRIu64
", cmt:%"
PRId64
", fst:%"
PRId64
", lst:%"
PRId64
", min:%"
PRId64
", snap:%"
PRId64
", term:%"
PRIu64
", commitIdx:%"
PRId64
", firstVer:%"
PRId64
", lastVer:%"
PRId64
", min:%"
PRId64
", snap-tm:%"
PRIu64
", sby:%d, aq:%d, bch:%d, r-num:%d, lcfg:%"
PRId64
", snap.lastApply:%"
PRId64
", snap.term:%"
PRIu64
", chging:%d, rsto:%d, dquorum:%d, elt:%"
PRId64
", hb:%"
PRId64
", %s, %s"
,
", standby:%d, aqItems:%d, batchSz:%d, replicaNum:%d, lastCfgIdx:%"
PRId64
", changing:%d, restore:%d, quorum:%d, electTimer:%"
PRId64
", hb:%"
PRId64
", %s, %s"
,
pNode
->
vgId
,
syncStr
(
pNode
->
state
),
eventLog
,
currentTerm
,
pNode
->
commitIndex
,
logBeginIndex
,
pNode
->
vgId
,
syncStr
(
pNode
->
state
),
eventLog
,
currentTerm
,
pNode
->
commitIndex
,
logBeginIndex
,
logLastIndex
,
pNode
->
minMatchIndex
,
snapshot
.
lastApplyIndex
,
snapshot
.
lastApplyTerm
,
logLastIndex
,
pNode
->
minMatchIndex
,
snapshot
.
lastApplyIndex
,
snapshot
.
lastApplyTerm
,
pNode
->
pRaftCfg
->
isStandBy
,
aqItems
,
pNode
->
pRaftCfg
->
batchSize
,
pNode
->
replicaNum
,
pNode
->
pRaftCfg
->
isStandBy
,
aqItems
,
pNode
->
pRaftCfg
->
batchSize
,
pNode
->
replicaNum
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录