Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
292735a1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
未验证
提交
292735a1
编写于
5月 20, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
5月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12744 from taosdata/fix/mnode
fix: wrong ref count
上级
5d18e75b
a67e46ef
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
40 deletion
+34
-40
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+26
-34
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
+7
-5
source/util/src/tqueue.c
source/util/src/tqueue.c
+1
-1
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
292735a1
...
...
@@ -22,21 +22,19 @@
static
inline
void
vmSendRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{
.
code
=
code
,
.
info
=
pMsg
->
info
,
.
pCont
=
pMsg
->
info
.
rsp
,
.
contLen
=
pMsg
->
info
.
rspLen
,
.
info
=
pMsg
->
info
,
};
tmsgSendRsp
(
&
rsp
);
}
static
void
vmProcessMgmtMonitorQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SVnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
dTrace
(
"msg:%p, get from vnode queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
int32_t
code
=
-
1
;
tmsg_t
msgType
=
pMsg
->
msgType
;
dTrace
(
"msg:%p, get from vnode queue, type:%s"
,
pMsg
,
TMSG_INFO
(
msgType
));
switch
(
msgType
)
{
switch
(
pMsg
->
msgType
)
{
case
TDMT_MON_VM_INFO
:
code
=
vmProcessGetMonitorInfoReq
(
pMgmt
,
pMsg
);
break
;
...
...
@@ -54,7 +52,7 @@ static void vmProcessMgmtMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
dError
(
"msg:%p, not processed in vnode queue"
,
pMsg
);
}
if
(
msgType
&
1u
)
{
if
(
IsReq
(
pMsg
)
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
vmSendRsp
(
pMsg
,
code
);
}
...
...
@@ -96,7 +94,6 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
static
void
vmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
if
(
pArray
==
NULL
)
{
dError
(
"failed to process %d msgs in write-queue since %s"
,
numOfMsgs
,
terrstr
());
...
...
@@ -116,7 +113,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
i
++
)
{
SRpcMsg
*
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
,
.
pCont
=
NULL
,
.
contLen
=
0
};
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
};
int32_t
ret
=
syncPropose
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
),
pMsg
,
false
);
if
(
ret
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
...
...
@@ -130,7 +127,6 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
rsp
.
code
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
tmsgSendRsp
(
&
rsp
);
}
else
if
(
ret
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
// ok
// send response in applyQ
}
else
{
assert
(
0
);
...
...
@@ -149,16 +145,13 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
static
void
vmProcessApplyQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SRpcMsg
*
pMsg
=
NULL
;
SRpcMsg
rsp
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
// init response rpc msg
rsp
.
code
=
0
;
rsp
.
pCont
=
NULL
;
rsp
.
contLen
=
0
;
SRpcMsg
rsp
=
{
0
};
// get original rpc msg
assert
(
pMsg
->
msgType
==
TDMT_VND_SYNC_APPLY_MSG
);
...
...
@@ -177,7 +170,6 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
rpcFreeCont
(
originalRpcMsg
.
pCont
);
// if leader, send response
// if (pMsg->rpcMsg.handle != NULL && pMsg->rpcMsg.ahandle != NULL) {
if
(
pMsg
->
info
.
handle
!=
NULL
)
{
rsp
.
info
=
pMsg
->
info
;
tmsgSendRsp
(
&
rsp
);
...
...
@@ -190,21 +182,19 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
static
void
vmProcessSyncQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SRpcMsg
*
pMsg
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
// todo
SRpcMsg
*
pRsp
=
NULL
;
int32_t
ret
=
vnodeProcessSyncReq
(
pVnode
->
pImpl
,
pMsg
,
&
pRsp
);
if
(
ret
!=
0
)
{
// if leader, send response
int32_t
code
=
vnodeProcessSyncReq
(
pVnode
->
pImpl
,
pMsg
,
NULL
);
if
(
code
!=
0
)
{
if
(
pMsg
->
info
.
handle
!=
NULL
)
{
SRpcMsg
rsp
=
{
0
};
rsp
.
code
=
terrno
;
rsp
.
info
=
pMsg
->
info
;
dTrace
(
"msg:%p, process sync queue error since code:%s"
,
pMsg
,
terrstr
());
SRpcMsg
rsp
=
{
.
code
=
(
terrno
<
0
)
?
terrno
:
code
,
.
info
=
pMsg
->
info
,
};
dTrace
(
"msg:%p, failed to process sync queue since %s"
,
pMsg
,
terrstr
());
tmsgSendRsp
(
&
rsp
);
}
}
...
...
@@ -216,9 +206,9 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf
static
void
vmProcessMergeQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SRpcMsg
*
pMsg
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"msg:%p, get from vnode-merge queue"
,
pMsg
);
...
...
@@ -308,22 +298,24 @@ int32_t vmPutNodeMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t
vmPutNodeMsgToMonitorQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into vnode-monitor worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
static
int32_t
vmPutRpcMsgToQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
,
EQueueType
qtype
)
{
SMsgHead
*
pHead
=
pRpc
->
pCont
;
SMsgHead
*
pHead
=
pRpc
->
pCont
;
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
if
(
pVnode
==
NULL
)
return
-
1
;
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
int32_t
code
=
0
;
if
(
pMsg
!=
NULL
)
{
if
(
pMsg
==
NULL
)
{
rpcFreeCont
(
pRpc
->
pCont
);
pRpc
->
pCont
=
NULL
;
code
=
-
1
;
}
else
{
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
switch
(
qtype
)
{
case
WRITE_QUEUE
:
...
...
@@ -428,7 +420,7 @@ int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
return
-
1
;
}
dDebug
(
"vgId:%d,
vnode
queue is alloced"
,
pVnode
->
vgId
);
dDebug
(
"vgId:%d, queue is alloced"
,
pVnode
->
vgId
);
return
0
;
}
...
...
@@ -445,7 +437,7 @@ void vmFreeQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
pVnode
->
pQueryQ
=
NULL
;
pVnode
->
pFetchQ
=
NULL
;
pVnode
->
pMergeQ
=
NULL
;
dDebug
(
"vgId:%d,
vnode
queue is freed"
,
pVnode
->
vgId
);
dDebug
(
"vgId:%d, queue is freed"
,
pVnode
->
vgId
);
}
int32_t
vmStartWorker
(
SVnodeMgmt
*
pMgmt
)
{
...
...
@@ -496,7 +488,7 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start
mnode
vnode-monitor worker since %s"
,
terrstr
());
dError
(
"failed to start vnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
...
...
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
浏览文件 @
292735a1
...
...
@@ -161,10 +161,12 @@ void dmGetVnodeLoads(SMonVloadInfo *pInfo) {
void
dmGetMnodeLoads
(
SMonMloadInfo
*
pInfo
)
{
SDnode
*
pDnode
=
dmInstance
();
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
MNODE
];
if
(
tsMultiProcess
)
{
dmSendLocalRecv
(
pDnode
,
TDMT_MON_MM_LOAD
,
tDeserializeSMonMloadInfo
,
pInfo
);
}
else
if
(
pWrapper
->
pMgmt
!=
NULL
)
{
mmGetMnodeLoads
(
pWrapper
->
pMgmt
,
pInfo
);
if
(
dmMarkWrapper
(
pWrapper
)
==
0
)
{
if
(
tsMultiProcess
)
{
dmSendLocalRecv
(
pDnode
,
TDMT_MON_MM_LOAD
,
tDeserializeSMonMloadInfo
,
pInfo
);
}
else
if
(
pWrapper
->
pMgmt
!=
NULL
)
{
mmGetMnodeLoads
(
pWrapper
->
pMgmt
,
pInfo
);
}
dmReleaseWrapper
(
pWrapper
);
}
dmReleaseWrapper
(
pWrapper
);
}
source/util/src/tqueue.c
浏览文件 @
292735a1
...
...
@@ -162,7 +162,7 @@ void *taosAllocateQitem(int32_t size, EQItype itype) {
uTrace
(
"item:%p, node:%p is allocated"
,
pNode
->
item
,
pNode
);
}
return
(
void
*
)
pNode
->
item
;
return
pNode
->
item
;
}
void
taosFreeQitem
(
void
*
pItem
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录