Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
07ca8eb8
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看板
提交
07ca8eb8
编写于
3月 16, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add trace to transaction
上级
3ac11ce8
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
26 addition
and
13 deletion
+26
-13
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+2
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+3
-3
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+3
-2
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+3
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+2
-1
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+1
-0
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+11
-7
未找到文件。
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
07ca8eb8
...
...
@@ -176,6 +176,7 @@ typedef struct {
char
opername
[
TSDB_TRANS_OPER_LEN
];
SArray
*
pRpcArray
;
SRWLatch
lockRpcArray
;
int64_t
mTraceId
;
}
STrans
;
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
07ca8eb8
...
...
@@ -52,6 +52,8 @@ typedef struct {
int32_t
contLen
;
void
*
pCont
;
SSdbRaw
*
pRaw
;
int64_t
mTraceId
;
}
STransAction
;
typedef
void
(
*
TransCbFp
)(
SMnode
*
pMnode
,
void
*
param
,
int32_t
paramLen
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
07ca8eb8
...
...
@@ -1417,7 +1417,7 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
return
0
;
}
static
int32_t
mndTrimDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
)
{
static
int32_t
mndTrimDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SRpcMsg
*
pReq
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
void
*
pIter
=
NULL
;
...
...
@@ -1439,7 +1439,7 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
pHead
->
vgId
=
htonl
(
pVgroup
->
vgId
);
tSerializeSVTrimDbReq
((
char
*
)
pHead
+
sizeof
(
SMsgHead
),
contLen
,
&
trimReq
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_VND_TRIM
,
.
pCont
=
pHead
,
.
contLen
=
contLen
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_VND_TRIM
,
.
pCont
=
pHead
,
.
contLen
=
contLen
,
.
info
=
pReq
->
info
};
SEpSet
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
int32_t
code
=
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
if
(
code
!=
0
)
{
...
...
@@ -1475,7 +1475,7 @@ static int32_t mndProcessTrimDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
code
=
mndTrimDb
(
pMnode
,
pDb
);
code
=
mndTrimDb
(
pMnode
,
pDb
,
pReq
);
_OVER:
if
(
code
!=
0
)
{
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
07ca8eb8
...
...
@@ -440,7 +440,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
if
(
roleChanged
)
{
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pVgroup
->
dbName
);
if
(
pDb
!=
NULL
&&
pDb
->
stateTs
!=
curMs
)
{
mInfo
(
"db:%s, stateTs changed by status msg, old stateTs:%"
PRId64
" new stateTs:%"
PRId64
,
pDb
->
name
,
pDb
->
stateTs
,
curMs
);
mInfo
(
"db:%s, stateTs changed by status msg, old stateTs:%"
PRId64
" new stateTs:%"
PRId64
,
pDb
->
name
,
pDb
->
stateTs
,
curMs
);
pDb
->
stateTs
=
curMs
;
}
mndReleaseDb
(
pMnode
,
pDb
);
...
...
@@ -954,7 +955,7 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
tSerializeSDCfgDnodeReq
(
pBuf
,
bufLen
,
&
dcfgReq
);
mInfo
(
"dnode:%d, send config req to dnode, app:%p config:%s value:%s"
,
cfgReq
.
dnodeId
,
pReq
->
info
.
ahandle
,
dcfgReq
.
config
,
dcfgReq
.
value
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
,
.
info
=
pReq
->
info
};
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
code
=
0
;
}
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
07ca8eb8
...
...
@@ -470,6 +470,7 @@ static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans,
return
-
1
;
}
action
.
mTraceId
=
pTrans
->
mTraceId
;
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_CREATE_VNODE
;
...
...
@@ -693,6 +694,8 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
SDbObj
*
pDb
=
NULL
;
SMCreateSmaReq
createReq
=
{
0
};
int64_t
mTraceId
=
TRACE_GET_ROOTID
(
&
pReq
->
info
.
traceId
);
if
(
tDeserializeSMCreateSmaReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
07ca8eb8
...
...
@@ -668,6 +668,7 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
}
STransAction
action
=
{
0
};
action
.
mTraceId
=
pTrans
->
mTraceId
;
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
...
...
@@ -877,7 +878,7 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) {
pHead
->
vgId
=
htonl
(
pVgroup
->
vgId
);
tSerializeSVDropTtlTableReq
((
char
*
)
pHead
+
sizeof
(
SMsgHead
),
contLen
,
&
ttlReq
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_VND_DROP_TTL_TABLE
,
.
pCont
=
pHead
,
.
contLen
=
contLen
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_VND_DROP_TTL_TABLE
,
.
pCont
=
pHead
,
.
contLen
=
contLen
,
.
info
=
pReq
->
info
};
SEpSet
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
int32_t
code
=
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
if
(
code
!=
0
)
{
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
07ca8eb8
...
...
@@ -434,6 +434,7 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, const SStreamTask *pTask) {
tEncoderClear
(
&
encoder
);
STransAction
action
=
{
0
};
action
.
mTraceId
=
pTrans
->
mTraceId
;
memcpy
(
&
action
.
epSet
,
&
pTask
->
epSet
,
sizeof
(
SEpSet
));
action
.
pCont
=
buf
;
action
.
contLen
=
tlen
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
07ca8eb8
...
...
@@ -505,8 +505,8 @@ static TransCbFp mndTransGetCbFp(ETrnFunc ftype) {
}
static
int32_t
mndTransActionInsert
(
SSdb
*
pSdb
,
STrans
*
pTrans
)
{
mInfo
(
"trans:%d, perform insert action, row:%p stage:%s, callfunc:1, startFunc:%d"
,
pTrans
->
id
,
pTrans
,
mndTransStr
(
pTrans
->
stage
),
pTrans
->
startFunc
);
mInfo
(
"trans:%d, perform insert action, row:%p stage:%s, callfunc:1, startFunc:%d"
,
pTrans
->
id
,
pTrans
,
mndTransStr
(
pTrans
->
stage
),
pTrans
->
startFunc
);
if
(
pTrans
->
startFunc
>
0
)
{
TransCbFp
fp
=
mndTransGetCbFp
(
pTrans
->
startFunc
);
...
...
@@ -577,8 +577,7 @@ static void mndTransUpdateActions(SArray *pOldArray, SArray *pNewArray) {
static
int32_t
mndTransActionUpdate
(
SSdb
*
pSdb
,
STrans
*
pOld
,
STrans
*
pNew
)
{
mInfo
(
"trans:%d, perform update action, old row:%p stage:%s create:%"
PRId64
", new row:%p stage:%s create:%"
PRId64
,
pOld
->
id
,
pOld
,
mndTransStr
(
pOld
->
stage
),
pOld
->
createdTime
,
pNew
,
mndTransStr
(
pNew
->
stage
),
pNew
->
createdTime
);
pOld
->
id
,
pOld
,
mndTransStr
(
pOld
->
stage
),
pOld
->
createdTime
,
pNew
,
mndTransStr
(
pNew
->
stage
),
pNew
->
createdTime
);
if
(
pOld
->
createdTime
!=
pNew
->
createdTime
)
{
mError
(
"trans:%d, failed to perform update action since createTime not match, old row:%p stage:%s create:%"
PRId64
...
...
@@ -650,6 +649,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
pTrans
->
undoActions
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
STransAction
));
pTrans
->
commitActions
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
STransAction
));
pTrans
->
pRpcArray
=
taosArrayInit
(
1
,
sizeof
(
SRpcHandleInfo
));
pTrans
->
mTraceId
=
pReq
?
TRACE_GET_ROOTID
(
&
pReq
->
info
.
traceId
)
:
0
;
taosInitRWLatch
(
&
pTrans
->
lockRpcArray
);
if
(
pTrans
->
redoActions
==
NULL
||
pTrans
->
undoActions
==
NULL
||
pTrans
->
commitActions
==
NULL
||
...
...
@@ -706,7 +706,8 @@ static int32_t mndTransAppendAction(SArray *pArray, STransAction *pAction) {
}
int32_t
mndTransAppendRedolog
(
STrans
*
pTrans
,
SSdbRaw
*
pRaw
)
{
STransAction
action
=
{.
stage
=
TRN_STAGE_REDO_ACTION
,
.
actionType
=
TRANS_ACTION_RAW
,
.
pRaw
=
pRaw
};
STransAction
action
=
{
.
stage
=
TRN_STAGE_REDO_ACTION
,
.
actionType
=
TRANS_ACTION_RAW
,
.
pRaw
=
pRaw
,
.
mTraceId
=
pTrans
->
mTraceId
};
return
mndTransAppendAction
(
pTrans
->
redoActions
,
&
action
);
}
...
...
@@ -728,6 +729,7 @@ int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw) {
int32_t
mndTransAppendRedoAction
(
STrans
*
pTrans
,
STransAction
*
pAction
)
{
pAction
->
stage
=
TRN_STAGE_REDO_ACTION
;
pAction
->
actionType
=
TRANS_ACTION_MSG
;
pAction
->
mTraceId
=
pTrans
->
mTraceId
;
return
mndTransAppendAction
(
pTrans
->
redoActions
,
pAction
);
}
...
...
@@ -875,7 +877,6 @@ int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) {
}
}
if
(
mndCheckTransConflict
(
pMnode
,
pTrans
))
{
terrno
=
TSDB_CODE_MND_TRANS_CONFLICT
;
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
@@ -912,6 +913,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
pNew
->
pRpcArray
=
pTrans
->
pRpcArray
;
pNew
->
rpcRsp
=
pTrans
->
rpcRsp
;
pNew
->
rpcRspLen
=
pTrans
->
rpcRspLen
;
pNew
->
mTraceId
=
pTrans
->
mTraceId
;
pTrans
->
pRpcArray
=
NULL
;
pTrans
->
rpcRsp
=
NULL
;
pTrans
->
rpcRspLen
=
0
;
...
...
@@ -1167,6 +1169,8 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
rpcMsg
.
info
.
traceId
.
rootId
=
pTrans
->
mTraceId
;
memcpy
(
rpcMsg
.
pCont
,
pAction
->
pCont
,
pAction
->
contLen
);
char
detail
[
1024
]
=
{
0
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录