Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
118305fb
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
118305fb
编写于
9月 22, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: let transaction info shows the correct action
上级
c577897c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
42 deletion
+30
-42
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+30
-42
未找到文件。
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
118305fb
...
...
@@ -305,6 +305,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
if
(
pTrans
->
commitActions
==
NULL
)
goto
_OVER
;
for
(
int32_t
i
=
0
;
i
<
redoActionNum
;
++
i
)
{
memset
(
&
action
,
0
,
sizeof
(
action
));
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
id
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
errCode
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
acceptableCode
,
_OVER
)
...
...
@@ -340,6 +341,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
}
for
(
int32_t
i
=
0
;
i
<
undoActionNum
;
++
i
)
{
memset
(
&
action
,
0
,
sizeof
(
action
));
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
id
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
errCode
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
acceptableCode
,
_OVER
)
...
...
@@ -375,6 +377,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
}
for
(
int32_t
i
=
0
;
i
<
commitActionNum
;
++
i
)
{
memset
(
&
action
,
0
,
sizeof
(
action
));
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
id
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
errCode
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
action
.
acceptableCode
,
_OVER
)
...
...
@@ -455,6 +458,20 @@ static const char *mndTransStr(ETrnStage stage) {
}
}
static
void
mndSetTransLastAction
(
STrans
*
pTrans
,
STransAction
*
pAction
)
{
if
(
pAction
!=
NULL
)
{
pTrans
->
lastAction
=
pAction
->
id
;
pTrans
->
lastMsgType
=
pAction
->
msgType
;
pTrans
->
lastEpset
=
pAction
->
epSet
;
pTrans
->
lastErrorNo
=
pAction
->
errCode
;
}
else
{
pTrans
->
lastAction
=
0
;
pTrans
->
lastMsgType
=
0
;
memset
(
&
pTrans
->
lastEpset
,
0
,
sizeof
(
pTrans
->
lastEpset
));
pTrans
->
lastErrorNo
=
0
;
}
}
static
void
mndTransTestStartFunc
(
SMnode
*
pMnode
,
void
*
param
,
int32_t
paramLen
)
{
mInfo
(
"test trans start, param:%s, len:%d"
,
(
char
*
)
param
,
paramLen
);
}
...
...
@@ -1037,18 +1054,12 @@ static int32_t mndTransWriteSingleLog(SMnode *pMnode, STrans *pTrans, STransActi
mInfo
(
"trans:%d, %s:%d write to sdb, type:%s status:%s"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
pAction
->
id
,
sdbTableName
(
pAction
->
pRaw
->
type
),
sdbStatusName
(
pAction
->
pRaw
->
status
));
pTrans
->
lastAction
=
pAction
->
id
;
pTrans
->
lastMsgType
=
pAction
->
msgType
;
pTrans
->
lastEpset
=
pAction
->
epSet
;
pTrans
->
lastErrorNo
=
0
;
mndSetTransLastAction
(
pTrans
,
pAction
);
}
else
{
pAction
->
errCode
=
(
terrno
!=
0
)
?
terrno
:
code
;
mError
(
"trans:%d, %s:%d failed to write sdb since %s, type:%s status:%s"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
pAction
->
id
,
terrstr
(),
sdbTableName
(
pAction
->
pRaw
->
type
),
sdbStatusName
(
pAction
->
pRaw
->
status
));
pTrans
->
lastAction
=
pAction
->
id
;
pTrans
->
lastMsgType
=
pAction
->
msgType
;
pTrans
->
lastEpset
=
pAction
->
epSet
;
pTrans
->
lastErrorNo
=
pAction
->
errCode
;
mndSetTransLastAction
(
pTrans
,
pAction
);
}
return
code
;
...
...
@@ -1082,15 +1093,10 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
if
(
code
==
0
)
{
pAction
->
msgSent
=
1
;
pAction
->
msgReceived
=
0
;
pAction
->
errCode
=
0
;
pAction
->
errCode
=
TSDB_CODE_ACTION_IN_PROGRESS
;
mInfo
(
"trans:%d, %s:%d is sent, %s"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
pAction
->
id
,
detail
);
pTrans
->
lastAction
=
pAction
->
id
;
pTrans
->
lastMsgType
=
pAction
->
msgType
;
pTrans
->
lastEpset
=
pAction
->
epSet
;
if
(
pTrans
->
lastErrorNo
==
0
)
{
pTrans
->
lastErrorNo
=
TSDB_CODE_ACTION_IN_PROGRESS
;
}
mndSetTransLastAction
(
pTrans
,
pAction
);
}
else
{
pAction
->
msgSent
=
0
;
pAction
->
msgReceived
=
0
;
...
...
@@ -1098,10 +1104,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
mError
(
"trans:%d, %s:%d not send since %s, %s"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
pAction
->
id
,
terrstr
(),
detail
);
pTrans
->
lastAction
=
pAction
->
id
;
pTrans
->
lastMsgType
=
pAction
->
msgType
;
pTrans
->
lastEpset
=
pAction
->
epSet
;
pTrans
->
lastErrorNo
=
pAction
->
errCode
;
mndSetTransLastAction
(
pTrans
,
pAction
);
}
return
code
;
...
...
@@ -1112,10 +1115,7 @@ static int32_t mndTransExecNullMsg(SMnode *pMnode, STrans *pTrans, STransAction
pAction
->
errCode
=
0
;
mInfo
(
"trans:%d, %s:%d confirm action executed"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
pAction
->
id
);
pTrans
->
lastAction
=
pAction
->
id
;
pTrans
->
lastMsgType
=
pAction
->
msgType
;
pTrans
->
lastEpset
=
pAction
->
epSet
;
pTrans
->
lastErrorNo
=
0
;
mndSetTransLastAction
(
pTrans
,
pAction
);
return
0
;
}
...
...
@@ -1161,25 +1161,19 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
errCode
=
pAction
->
errCode
;
pErrAction
=
pAction
;
}
}
else
{
pErrAction
=
pAction
;
}
}
mndSetTransLastAction
(
pTrans
,
pErrAction
);
if
(
numOfExecuted
==
numOfActions
)
{
if
(
errCode
==
0
)
{
pTrans
->
lastAction
=
0
;
pTrans
->
lastMsgType
=
0
;
memset
(
&
pTrans
->
lastEpset
,
0
,
sizeof
(
pTrans
->
lastEpset
));
pTrans
->
lastErrorNo
=
0
;
mInfo
(
"trans:%d, all %d actions execute successfully"
,
pTrans
->
id
,
numOfActions
);
return
0
;
}
else
{
mError
(
"trans:%d, all %d actions executed, code:0x%x"
,
pTrans
->
id
,
numOfActions
,
errCode
&
0XFFFF
);
if
(
pErrAction
!=
NULL
)
{
pTrans
->
lastAction
=
pErrAction
->
id
;
pTrans
->
lastMsgType
=
pErrAction
->
msgType
;
pTrans
->
lastEpset
=
pErrAction
->
epSet
;
pTrans
->
lastErrorNo
=
pErrAction
->
errCode
;
}
mndTransResetActions
(
pMnode
,
pTrans
,
pArray
);
terrno
=
errCode
;
return
errCode
;
...
...
@@ -1220,6 +1214,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
if
(
numOfActions
==
0
)
return
code
;
if
(
pTrans
->
redoActionPos
>=
numOfActions
)
return
code
;
mInfo
(
"trans:%d, execute %d actions serial"
,
pTrans
->
id
,
numOfActions
);
for
(
int32_t
action
=
pTrans
->
redoActionPos
;
action
<
numOfActions
;
++
action
)
{
STransAction
*
pAction
=
taosArrayGet
(
pTrans
->
redoActions
,
pTrans
->
redoActionPos
);
...
...
@@ -1248,16 +1244,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
if
(
code
==
0
)
{
pTrans
->
failedTimes
=
0
;
pTrans
->
lastAction
=
action
;
pTrans
->
lastMsgType
=
0
;
pTrans
->
lastErrorNo
=
0
;
memset
(
&
pTrans
->
lastEpset
,
0
,
sizeof
(
pTrans
->
lastEpset
));
}
else
{
pTrans
->
lastAction
=
action
;
pTrans
->
lastMsgType
=
pAction
->
msgType
;
pTrans
->
lastErrorNo
=
code
;
pTrans
->
lastEpset
=
pAction
->
epSet
;
}
mndSetTransLastAction
(
pTrans
,
pAction
);
if
(
mndCannotExecuteTransAction
(
pMnode
))
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录