Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2c28cdcb
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2c28cdcb
编写于
8月 12, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: deadlock of mnode if its state changed
上级
646cb378
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
8 deletion
+24
-8
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+2
-0
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+15
-8
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+7
-0
未找到文件。
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
2c28cdcb
...
...
@@ -742,7 +742,9 @@ static int32_t mndProcessAlterMnodeReq(SRpcMsg *pReq) {
return
code
;
}
else
{
pMgmt
->
errCode
=
0
;
taosWLockLatch
(
&
pMgmt
->
lock
);
pMgmt
->
transId
=
-
1
;
taosWUnLockLatch
(
&
pMgmt
->
lock
);
tsem_wait
(
&
pMgmt
->
syncSem
);
mInfo
(
"alter mnode sync result:0x%x %s"
,
pMgmt
->
errCode
,
tstrerror
(
pMgmt
->
errCode
));
terrno
=
pMgmt
->
errCode
;
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
2c28cdcb
...
...
@@ -60,22 +60,22 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
sdbSetApplyInfo
(
pMnode
->
pSdb
,
cbMeta
.
index
,
cbMeta
.
term
,
cbMeta
.
lastConfigIndex
);
}
taos
R
LockLatch
(
&
pMgmt
->
lock
);
taos
W
LockLatch
(
&
pMgmt
->
lock
);
if
(
transId
<=
0
)
{
taos
R
UnLockLatch
(
&
pMgmt
->
lock
);
taos
W
UnLockLatch
(
&
pMgmt
->
lock
);
mError
(
"trans:%d, invalid commit msg"
,
transId
);
}
else
if
(
transId
==
pMgmt
->
transId
)
{
taosRUnLockLatch
(
&
pMgmt
->
lock
);
if
(
pMgmt
->
errCode
!=
0
)
{
mError
(
"trans:%d, failed to propose since %s"
,
transId
,
tstrerror
(
pMgmt
->
errCode
));
}
pMgmt
->
transId
=
0
;
taosWUnLockLatch
(
&
pMgmt
->
lock
);
tsem_post
(
&
pMgmt
->
syncSem
);
}
else
{
taos
R
UnLockLatch
(
&
pMgmt
->
lock
);
taos
W
UnLockLatch
(
&
pMgmt
->
lock
);
STrans
*
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
if
(
pTrans
!=
NULL
)
{
m
Debug
(
"trans:%d, execute in mnode which not leader"
,
transId
);
m
Info
(
"trans:%d, execute in mnode which not leader"
,
transId
);
mndTransExecute
(
pMnode
,
pTrans
);
mndReleaseTrans
(
pMnode
,
pTrans
);
// sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
...
...
@@ -275,9 +275,16 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
pMgmt
->
errCode
=
0
;
taosWLockLatch
(
&
pMgmt
->
lock
);
pMgmt
->
transId
=
transId
;
taosWUnLockLatch
(
&
pMgmt
->
lock
);
mTrace
(
"trans:%d, will be proposed"
,
pMgmt
->
transId
);
if
(
pMgmt
->
transId
!=
0
)
{
mInfo
(
"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
;
}
else
{
pMgmt
->
transId
=
transId
;
mDebug
(
"trans:%d, will be proposed"
,
pMgmt
->
transId
);
taosWUnLockLatch
(
&
pMgmt
->
lock
);
}
const
bool
isWeak
=
false
;
int32_t
code
=
syncPropose
(
pMgmt
->
sync
,
&
req
,
isWeak
);
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
2c28cdcb
...
...
@@ -696,6 +696,13 @@ static void vnodeBecomeFollower(struct SSyncFSM *pFsm) {
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
);
}
static
SSyncFSM
*
vnodeSyncMakeFsm
(
SVnode
*
pVnode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录