Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
65fa1e01
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看板
提交
65fa1e01
编写于
8月 12, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: deadlock of mnode if its state changed
上级
2c28cdcb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
17 deletion
+16
-17
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+9
-11
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+7
-6
未找到文件。
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
65fa1e01
...
...
@@ -66,7 +66,9 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
mError
(
"trans:%d, invalid commit msg"
,
transId
);
}
else
if
(
transId
==
pMgmt
->
transId
)
{
if
(
pMgmt
->
errCode
!=
0
)
{
mError
(
"trans:%d, failed to propose since %s"
,
transId
,
tstrerror
(
pMgmt
->
errCode
));
mError
(
"trans:%d, failed to propose since %s, post sem"
,
transId
,
tstrerror
(
pMgmt
->
errCode
));
}
else
{
mInfo
(
"trans:%d, is proposed and post sem"
,
transId
,
tstrerror
(
pMgmt
->
errCode
));
}
pMgmt
->
transId
=
0
;
taosWUnLockLatch
(
&
pMgmt
->
lock
);
...
...
@@ -122,7 +124,10 @@ void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta cbM
taosWLockLatch
(
&
pMgmt
->
lock
);
if
(
pMgmt
->
transId
==
-
1
)
{
if
(
pMgmt
->
errCode
!=
0
)
{
mError
(
"trans:-1, failed to propose sync reconfig since %s"
,
tstrerror
(
pMgmt
->
errCode
));
mError
(
"trans:-1, failed to propose sync reconfig since %s, post sem"
,
tstrerror
(
pMgmt
->
errCode
));
}
else
{
mInfo
(
"trans:-1, sync reconfig is proposed, saved:%d code:0x%x, index:%"
PRId64
" term:%"
PRId64
" post sem"
,
pMgmt
->
transId
,
cbMeta
.
code
,
cbMeta
.
index
,
cbMeta
.
term
);
}
pMgmt
->
transId
=
0
;
tsem_post
(
&
pMgmt
->
syncSem
);
...
...
@@ -174,7 +179,7 @@ void mndLeaderTransfer(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cb
static
void
mndBecomeFollower
(
struct
SSyncFSM
*
pFsm
)
{
SMnode
*
pMnode
=
pFsm
->
data
;
mDebug
(
"vgId:1, become follower"
);
mDebug
(
"vgId:1, become follower
and post sem
"
);
taosWLockLatch
(
&
pMnode
->
syncMgmt
.
lock
);
if
(
pMnode
->
syncMgmt
.
transId
!=
0
)
{
...
...
@@ -187,13 +192,6 @@ static void mndBecomeFollower(struct SSyncFSM *pFsm) {
static
void
mndBecomeLeader
(
struct
SSyncFSM
*
pFsm
)
{
mDebug
(
"vgId:1, become leader"
);
SMnode
*
pMnode
=
pFsm
->
data
;
taosWLockLatch
(
&
pMnode
->
syncMgmt
.
lock
);
if
(
pMnode
->
syncMgmt
.
transId
!=
0
)
{
pMnode
->
syncMgmt
.
transId
=
0
;
tsem_post
(
&
pMnode
->
syncMgmt
.
syncSem
);
}
taosWUnLockLatch
(
&
pMnode
->
syncMgmt
.
lock
);
}
SSyncFSM
*
mndSyncMakeFsm
(
SMnode
*
pMnode
)
{
...
...
@@ -276,7 +274,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
pMgmt
->
errCode
=
0
;
taosWLockLatch
(
&
pMgmt
->
lock
);
if
(
pMgmt
->
transId
!=
0
)
{
m
Info
(
"trans:%d, can't be proposed since trans:%s alrady waiting for confirm"
,
transId
,
pMgmt
->
transId
);
m
Error
(
"trans:%d, can't be proposed since trans:%s alrady waiting for confirm"
,
transId
,
pMgmt
->
transId
);
taosWUnLockLatch
(
&
pMgmt
->
lock
);
terrno
=
TSDB_CODE_APP_NOT_READY
;
return
-
1
;
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
65fa1e01
...
...
@@ -688,6 +688,7 @@ static void vnodeBecomeFollower(struct SSyncFSM *pFsm) {
taosThreadMutexLock
(
&
pVnode
->
lock
);
if
(
pVnode
->
blocked
)
{
pVnode
->
blocked
=
false
;
vDebug
(
"vgId:%d, become follower and post block"
,
pVnode
->
config
.
vgId
);
tsem_post
(
&
pVnode
->
syncSem
);
}
taosThreadMutexUnlock
(
&
pVnode
->
lock
);
...
...
@@ -697,12 +698,12 @@ static void vnodeBecomeLeader(struct SSyncFSM *pFsm) {
SVnode
*
pVnode
=
pFsm
->
data
;
vDebug
(
"vgId:%d, become leader"
,
pVnode
->
config
.
vgId
);
taosThreadMutexLock
(
&
pVnode
->
lock
);
if
(
pVnode
->
blocked
)
{
pVnode
->
blocked
=
false
;
tsem_post
(
&
pVnode
->
syncSem
);
}
taosThreadMutexUnlock
(
&
pVnode
->
lock
);
//
taosThreadMutexLock(&pVnode->lock);
//
if (pVnode->blocked) {
//
pVnode->blocked = false;
//
tsem_post(&pVnode->syncSem);
//
}
//
taosThreadMutexUnlock(&pVnode->lock);
}
static
SSyncFSM
*
vnodeSyncMakeFsm
(
SVnode
*
pVnode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录