Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a9d13928
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看板
提交
a9d13928
编写于
12月 23, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug in transaction
上级
34619844
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
42 addition
and
16 deletion
+42
-16
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+5
-1
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+2
-2
source/dnode/mgmt/impl/test/mnode/mnode.cpp
source/dnode/mgmt/impl/test/mnode/mnode.cpp
+22
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+0
-5
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+4
-4
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+4
-2
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+3
-2
source/util/src/tworker.c
source/util/src/tworker.c
+2
-0
未找到文件。
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
a9d13928
...
...
@@ -479,9 +479,11 @@ static int32_t dndDropMnode(SDnode *pDnode) {
return
-
1
;
}
dndReleaseMnode
(
pDnode
,
pMnode
);
dndStopMnodeWorker
(
pDnode
);
dndWriteMnodeFile
(
pDnode
);
mndClose
(
pMnode
);
pMgmt
->
pMnode
=
NULL
;
mndDestroy
(
pDnode
->
dir
.
mnode
);
return
0
;
...
...
@@ -661,6 +663,8 @@ void dndProcessMnodeMgmtMsg(SDnode *pDnode, SRpcMsg *pRpcMsg, SEpSet *pEpSet) {
rpcFreeCont
(
pRpcMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
dndReleaseMnode
(
pDnode
,
pMnode
);
}
void
dndProcessMnodeWriteMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
...
...
@@ -945,7 +949,7 @@ void dndCleanupMnode(SDnode *pDnode) {
SMnodeMgmt
*
pMgmt
=
&
pDnode
->
mmgmt
;
dInfo
(
"dnode-mnode start to clean up"
);
dndStopMnodeWorker
(
pDnode
);
if
(
pMgmt
->
pMnode
)
dndStopMnodeWorker
(
pDnode
);
dndCleanupMnodeMgmtWorker
(
pDnode
);
dndFreeMnodeMgmtQueue
(
pDnode
);
tfree
(
pMgmt
->
file
);
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
a9d13928
...
...
@@ -136,7 +136,7 @@ static void dndProcessResponse(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
DndMsgFp
fp
=
pMgmt
->
msgFp
[
msgType
];
if
(
fp
!=
NULL
)
{
(
*
fp
)(
pDnode
,
pMsg
,
pEpSet
);
dTrace
(
"RPC %p, rsp:%s is processed, code:0x%
0X
"
,
pMsg
->
handle
,
taosMsg
[
msgType
],
pMsg
->
code
&
0XFFFF
);
dTrace
(
"RPC %p, rsp:%s is processed, code:0x%
x
"
,
pMsg
->
handle
,
taosMsg
[
msgType
],
pMsg
->
code
&
0XFFFF
);
}
else
{
dError
(
"RPC %p, rsp:%s not processed"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
rpcFreeCont
(
pMsg
->
pCont
);
...
...
@@ -184,7 +184,7 @@ static void dndProcessRequest(void *param, SRpcMsg *pMsg, SEpSet *pEpSet) {
int32_t
msgType
=
pMsg
->
msgType
;
if
(
msgType
==
TSDB_MSG_TYPE_NETWORK_TEST
)
{
dTrace
(
"RPC %p, network test req, app:%p will be processed
"
,
pMsg
->
handle
,
pMsg
->
ahandl
e
);
dTrace
(
"RPC %p, network test req, app:%p will be processed
, code:0x%x"
,
pMsg
->
handle
,
pMsg
->
ahandle
,
pMsg
->
cod
e
);
dndProcessDnodeReq
(
pDnode
,
pMsg
,
pEpSet
);
return
;
}
...
...
source/dnode/mgmt/impl/test/mnode/mnode.cpp
浏览文件 @
a9d13928
...
...
@@ -140,6 +140,28 @@ TEST_F(DndTestMnode, 04_Create_Mnode) {
CheckTimestamp
();
CheckTimestamp
();
}
{
// drop mnode
int32_t
contLen
=
sizeof
(
SDropMnodeMsg
);
SDropMnodeMsg
*
pReq
=
(
SDropMnodeMsg
*
)
rpcMallocCont
(
contLen
);
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TSDB_MSG_TYPE_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
test
.
SendShowMetaMsg
(
TSDB_MGMT_TABLE_MNODE
,
""
);
test
.
SendShowRetrieveMsg
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckInt16
(
1
);
CheckBinary
(
"localhost:9061"
,
TSDB_EP_LEN
);
CheckBinary
(
"master"
,
12
);
CheckInt64
(
0
);
CheckTimestamp
();
}
}
// {
// int32_t contLen = sizeof(SDropDnodeMsg);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
a9d13928
...
...
@@ -290,11 +290,6 @@ typedef struct SMnodeMsg {
char
db
[
TSDB_FULL_DB_NAME_LEN
];
int32_t
acctId
;
SMnode
*
pMnode
;
int16_t
received
;
int16_t
successed
;
int16_t
expected
;
int16_t
retry
;
int32_t
code
;
int64_t
createdTime
;
SRpcMsg
rpcMsg
;
int32_t
contLen
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
a9d13928
...
...
@@ -828,9 +828,9 @@ static int32_t mndProcessUseDbMsg(SMnodeMsg *pMsg) {
static
int32_t
mndProcessSyncDbMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SSyncDbMsg
*
pSync
=
pMsg
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
p
Msg
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
p
Sync
->
db
);
if
(
pDb
==
NULL
)
{
mError
(
"db:%s, failed to process sync db msg since %s"
,
p
Msg
->
db
,
terrstr
());
mError
(
"db:%s, failed to process sync db msg since %s"
,
p
Sync
->
db
,
terrstr
());
return
-
1
;
}
...
...
@@ -841,9 +841,9 @@ static int32_t mndProcessSyncDbMsg(SMnodeMsg *pMsg) {
static
int32_t
mndProcessCompactDbMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCompactDbMsg
*
pCompact
=
pMsg
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
p
Msg
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
p
Compact
->
db
);
if
(
pDb
==
NULL
)
{
mError
(
"db:%s, failed to process compact db msg since %s"
,
p
Msg
->
db
,
terrstr
());
mError
(
"db:%s, failed to process compact db msg since %s"
,
p
Compact
->
db
,
terrstr
());
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
a9d13928
...
...
@@ -440,6 +440,8 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
sdbRelease
(
pSdb
,
pMObj
);
}
alterMsg
.
replica
=
numOfReplicas
;
while
(
1
)
{
SMnodeObj
*
pMObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_MNODE
,
pIter
,
(
void
**
)
&
pMObj
);
...
...
@@ -506,12 +508,12 @@ static int32_t mndDropMnode(SMnode *pMnode, SMnodeMsg *pMsg, SMnodeObj *pObj) {
mDebug
(
"trans:%d, used to drop mnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSet
Create
MnodeRedoLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
{
if
(
mndSet
Drop
MnodeRedoLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
{
mError
(
"trans:%d, failed to set redo log since %s"
,
pTrans
->
id
,
terrstr
());
goto
DROP_MNODE_OVER
;
}
if
(
mndSet
Create
MnodeCommitLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
{
if
(
mndSet
Drop
MnodeCommitLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
{
mError
(
"trans:%d, failed to set commit log since %s"
,
pTrans
->
id
,
terrstr
());
goto
DROP_MNODE_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
a9d13928
...
...
@@ -625,7 +625,7 @@ void mndTransHandleActionRsp(SMnodeMsg *pMsg) {
pAction
->
errCode
=
pMsg
->
rpcMsg
.
code
;
}
mDebug
(
"trans:%d, action:%d response is received, code:0x%x"
,
transId
,
action
,
pMsg
->
code
);
mDebug
(
"trans:%d, action:%d response is received, code:0x%x"
,
transId
,
action
,
pMsg
->
rpcMsg
.
code
);
mndTransExecute
(
pMnode
,
pTrans
);
HANDLE_ACTION_RSP_OVER:
...
...
@@ -696,7 +696,7 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
for
(
int32_t
action
=
0
;
action
<
numOfActions
;
++
action
)
{
STransAction
*
pAction
=
taosArrayGet
(
pArray
,
action
);
if
(
pAction
==
NULL
)
continue
;
if
(
pAction
->
msg
Sent
)
continue
;
if
(
pAction
->
msg
Received
&&
pAction
->
errCode
==
0
)
continue
;
int64_t
signature
=
pTrans
->
id
;
signature
=
(
signature
<<
32
);
...
...
@@ -736,6 +736,7 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
terrno
=
errorCode
;
return
errorCode
;
}
else
{
mDebug
(
"trans:%d, %d of %d actions executed, code:0x%x"
,
pTrans
->
id
,
numOfReceivedMsgs
,
numOfActions
,
errorCode
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
...
...
source/util/src/tworker.c
浏览文件 @
a9d13928
...
...
@@ -38,6 +38,7 @@ int32_t tWorkerInit(SWorkerPool *pool) {
void
tWorkerCleanup
(
SWorkerPool
*
pool
)
{
for
(
int
i
=
0
;
i
<
pool
->
max
;
++
i
)
{
SWorker
*
worker
=
pool
->
workers
+
i
;
if
(
worker
==
NULL
)
continue
;
if
(
taosCheckPthreadValid
(
worker
->
thread
))
{
taosQsetThreadResume
(
pool
->
qset
);
}
...
...
@@ -45,6 +46,7 @@ void tWorkerCleanup(SWorkerPool *pool) {
for
(
int
i
=
0
;
i
<
pool
->
max
;
++
i
)
{
SWorker
*
worker
=
pool
->
workers
+
i
;
if
(
worker
==
NULL
)
continue
;
if
(
taosCheckPthreadValid
(
worker
->
thread
))
{
pthread_join
(
worker
->
thread
,
NULL
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录