Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4a27d2cc
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看板
提交
4a27d2cc
编写于
2月 18, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kill trans
上级
4ab720c7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
74 addition
and
1 deletion
+74
-1
include/common/tmsg.h
include/common/tmsg.h
+7
-0
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+25
-0
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+41
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
4a27d2cc
...
...
@@ -977,6 +977,13 @@ typedef struct {
int32_t
tSerializeSKillConnReq
(
void
*
buf
,
int32_t
bufLen
,
SKillConnReq
*
pReq
);
int32_t
tDeserializeSKillConnReq
(
void
*
buf
,
int32_t
bufLen
,
SKillConnReq
*
pReq
);
typedef
struct
{
int32_t
transId
;
}
SKillTransReq
;
int32_t
tSerializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
);
int32_t
tDeserializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
);
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
spi
;
...
...
include/common/tmsgdef.h
浏览文件 @
4a27d2cc
...
...
@@ -136,6 +136,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW_RETRIEVE
,
"mnode-retrieve"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_STATUS
,
"mnode-status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS
,
"mnode-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_TRANS
,
"mnode-kill-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"mnode-grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"mnode-auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"mnode-create-topic"
,
SMCreateTopicReq
,
SMCreateTopicRsp
)
...
...
source/common/src/tmsg.c
浏览文件 @
4a27d2cc
...
...
@@ -2239,6 +2239,31 @@ int32_t tDeserializeSKillConnReq(void *buf, int32_t bufLen, SKillConnReq *pReq)
return
0
;
}
int32_t
tSerializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
transId
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
transId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
4a27d2cc
...
...
@@ -54,7 +54,8 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans);
static
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
static
void
mndTransSendRpcRsp
(
STrans
*
pTrans
);
static
int32_t
mndProcessTransReq
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessTransReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessKillTransReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetTransMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveTrans
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
...
...
@@ -70,6 +71,7 @@ int32_t mndInitTrans(SMnode *pMnode) {
.
deleteFp
=
(
SdbDeleteFp
)
mndTransActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TRANS
,
mndProcessTransReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TRANS
,
mndProcessKillTransReq
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_TRANS
,
mndGetTransMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_TRANS
,
mndRetrieveTrans
);
...
...
@@ -1002,6 +1004,44 @@ static int32_t mndProcessTransReq(SMnodeMsg *pReq) {
return
0
;
}
static
int32_t
mndProcessKillTransReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SKillTransReq
killReq
=
{
0
};
if
(
tDeserializeSKillTransReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
killReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
mError
(
"trans:%d, failed to kill since %s"
,
killReq
.
transId
,
terrstr
());
return
-
1
;
}
mInfo
(
"trans:%d, start to kill"
,
killReq
.
transId
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
mError
(
"trans:%d, failed to kill since %s"
,
killReq
.
transId
,
terrstr
());
return
-
1
;
}
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
mError
(
"trans:%d, failed to kill since %s"
,
killReq
.
transId
,
terrstr
());
return
-
1
;
}
mndReleaseUser
(
pMnode
,
pUser
);
STrans
*
pTrans
=
mndAcquireTrans
(
pMnode
,
killReq
.
transId
);
if
(
pTrans
==
NULL
)
{
terrno
=
TSDB_CODE_MND_TRANS_NOT_EXIST
;
mError
(
"trans:%d, failed to kill since %s"
,
killReq
.
transId
,
terrstr
());
return
-
1
;
}
// mndTransDrop(pTrans);
mndReleaseTrans
(
pMnode
,
pTrans
);
return
0
;
}
void
mndTransPullup
(
SMnode
*
pMnode
)
{
STrans
*
pTrans
=
NULL
;
void
*
pIter
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录