Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2dcb2811
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
2dcb2811
编写于
2月 07, 2023
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: should not execute trans if not leader
上级
4d20469e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
11 deletion
+21
-11
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+1
-1
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+1
-1
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+19
-9
未找到文件。
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
2dcb2811
...
...
@@ -81,7 +81,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans);
int32_t
mndTransProcessRsp
(
SRpcMsg
*
pRsp
);
void
mndTransPullup
(
SMnode
*
pMnode
);
int32_t
mndKillTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
bool
isLeader
);
int32_t
mndSetRpcInfoForDbTrans
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
EOperType
oper
,
const
char
*
dbname
);
#ifdef __cplusplus
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
2dcb2811
...
...
@@ -116,7 +116,7 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta
if
(
pTrans
!=
NULL
)
{
mInfo
(
"trans:%d, execute in mnode which not leader or sync timeout, createTime:%"
PRId64
" saved trans:%d"
,
transId
,
pTrans
->
createdTime
,
pMgmt
->
transId
);
mndTransExecute
(
pMnode
,
pTrans
);
mndTransExecute
(
pMnode
,
pTrans
,
false
);
mndReleaseTrans
(
pMnode
,
pTrans
);
// sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
}
else
{
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
2dcb2811
...
...
@@ -905,7 +905,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
pTrans
->
rpcRsp
=
NULL
;
pTrans
->
rpcRspLen
=
0
;
mndTransExecute
(
pMnode
,
pNew
);
mndTransExecute
(
pMnode
,
pNew
,
true
);
mndReleaseTrans
(
pMnode
,
pNew
);
return
0
;
}
...
...
@@ -1068,7 +1068,7 @@ int32_t mndTransProcessRsp(SRpcMsg *pRsp) {
mInfo
(
"trans:%d, %s:%d response is received, code:0x%x, accept:0x%x retry:0x%x"
,
transId
,
mndTransStr
(
pAction
->
stage
),
action
,
pRsp
->
code
,
pAction
->
acceptableCode
,
pAction
->
retryCode
);
mndTransExecute
(
pMnode
,
pTrans
);
mndTransExecute
(
pMnode
,
pTrans
,
true
);
_OVER:
mndReleaseTrans
(
pMnode
,
pTrans
);
...
...
@@ -1502,12 +1502,12 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
return
continueExec
;
}
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
bool
isLeader
)
{
bool
continueExec
=
true
;
while
(
continueExec
)
{
mInfo
(
"trans:%d, continue to execute, stage:%s createTime:%"
PRId64
,
pTrans
->
id
,
mndTransStr
(
pTrans
->
stage
)
,
pTrans
->
createdTime
);
mInfo
(
"trans:%d, continue to execute, stage:%s createTime:%"
PRId64
" leader:%d"
,
pTrans
->
id
,
mndTransStr
(
pTrans
->
stage
),
pTrans
->
createdTime
,
isLeader
);
pTrans
->
lastExecTime
=
taosGetTimestampMs
();
switch
(
pTrans
->
stage
)
{
case
TRN_STAGE_PREPARE
:
...
...
@@ -1517,13 +1517,23 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
continueExec
=
mndTransPerformRedoActionStage
(
pMnode
,
pTrans
);
break
;
case
TRN_STAGE_COMMIT
:
continueExec
=
mndTransPerformCommitStage
(
pMnode
,
pTrans
);
if
(
isLeader
)
{
continueExec
=
mndTransPerformCommitStage
(
pMnode
,
pTrans
);
}
else
{
mInfo
(
"trans:%d, can not commit since not leader"
,
pTrans
->
id
);
continueExec
=
false
;
}
break
;
case
TRN_STAGE_COMMIT_ACTION
:
continueExec
=
mndTransPerformCommitActionStage
(
pMnode
,
pTrans
);
break
;
case
TRN_STAGE_ROLLBACK
:
continueExec
=
mndTransPerformRollbackStage
(
pMnode
,
pTrans
);
if
(
isLeader
)
{
continueExec
=
mndTransPerformRollbackStage
(
pMnode
,
pTrans
);
}
else
{
mInfo
(
"trans:%d, can not rollback since not leader"
,
pTrans
->
id
);
continueExec
=
false
;
}
break
;
case
TRN_STAGE_UNDO_ACTION
:
continueExec
=
mndTransPerformUndoActionStage
(
pMnode
,
pTrans
);
...
...
@@ -1566,7 +1576,7 @@ int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
pAction
->
errCode
=
0
;
}
mndTransExecute
(
pMnode
,
pTrans
);
mndTransExecute
(
pMnode
,
pTrans
,
true
);
return
0
;
}
...
...
@@ -1624,7 +1634,7 @@ void mndTransPullup(SMnode *pMnode) {
int32_t
*
pTransId
=
taosArrayGet
(
pArray
,
i
);
STrans
*
pTrans
=
mndAcquireTrans
(
pMnode
,
*
pTransId
);
if
(
pTrans
!=
NULL
)
{
mndTransExecute
(
pMnode
,
pTrans
);
mndTransExecute
(
pMnode
,
pTrans
,
true
);
}
mndReleaseTrans
(
pMnode
,
pTrans
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录