Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
58b64fcf
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
58b64fcf
编写于
3月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
bf2226f0
变更
33
隐藏空白更改
内联
并排
Showing
33 changed file
with
133 addition
and
147 deletion
+133
-147
include/dnode/bnode/bnode.h
include/dnode/bnode/bnode.h
+1
-1
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+1
-1
include/dnode/qnode/qnode.h
include/dnode/qnode/qnode.h
+1
-1
include/dnode/snode/snode.h
include/dnode/snode/snode.h
+1
-1
include/libs/qworker/qworker.h
include/libs/qworker/qworker.h
+2
-2
include/libs/tfs/tfs.h
include/libs/tfs/tfs.h
+1
-1
source/dnode/mgmt/bnode/src/bmMgmt.c
source/dnode/mgmt/bnode/src/bmMgmt.c
+1
-1
source/dnode/mgmt/container/src/dndMonitor.c
source/dnode/mgmt/container/src/dndMonitor.c
+4
-2
source/dnode/mgmt/dnode/src/dmMsg.c
source/dnode/mgmt/dnode/src/dmMsg.c
+1
-1
source/dnode/mgmt/dnode/src/dmWorker.c
source/dnode/mgmt/dnode/src/dmWorker.c
+0
-15
source/dnode/mgmt/mnode/inc/mmMsg.h
source/dnode/mgmt/mnode/inc/mmMsg.h
+2
-1
source/dnode/mgmt/mnode/src/mmInt.c
source/dnode/mgmt/mnode/src/mmInt.c
+1
-1
source/dnode/mgmt/qnode/src/qmMgmt.c
source/dnode/mgmt/qnode/src/qmMgmt.c
+1
-1
source/dnode/mgmt/snode/src/smMgmt.c
source/dnode/mgmt/snode/src/smMgmt.c
+1
-1
source/dnode/mgmt/vnode/inc/vmFile.h
source/dnode/mgmt/vnode/inc/vmFile.h
+3
-2
source/dnode/mgmt/vnode/inc/vmInt.h
source/dnode/mgmt/vnode/inc/vmInt.h
+3
-12
source/dnode/mgmt/vnode/inc/vmMsg.h
source/dnode/mgmt/vnode/inc/vmMsg.h
+2
-2
source/dnode/mgmt/vnode/inc/vmWorker.h
source/dnode/mgmt/vnode/inc/vmWorker.h
+4
-6
source/dnode/mgmt/vnode/src/vmFile.c
source/dnode/mgmt/vnode/src/vmFile.c
+1
-1
source/dnode/mgmt/vnode/src/vmInt.c
source/dnode/mgmt/vnode/src/vmInt.c
+21
-19
source/dnode/mgmt/vnode/src/vmMsg.c
source/dnode/mgmt/vnode/src/vmMsg.c
+8
-1
source/dnode/mgmt/vnode/src/vmWorker.c
source/dnode/mgmt/vnode/src/vmWorker.c
+45
-44
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+1
-1
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+5
-5
source/dnode/qnode/src/qnode.c
source/dnode/qnode/src/qnode.c
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+6
-7
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+3
-4
source/dnode/vnode/src/vnd/vnodeMain.c
source/dnode/vnode/src/vnd/vnodeMain.c
+2
-2
source/dnode/vnode/src/vnd/vnodeMgr.c
source/dnode/vnode/src/vnd/vnodeMgr.c
+5
-5
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+1
-1
source/libs/qworker/inc/qworkerInt.h
source/libs/qworker/inc/qworkerInt.h
+1
-1
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+1
-1
source/libs/tfs/src/tfs.c
source/libs/tfs/src/tfs.c
+2
-2
未找到文件。
include/dnode/bnode/bnode.h
浏览文件 @
58b64fcf
...
@@ -36,7 +36,7 @@ typedef struct {
...
@@ -36,7 +36,7 @@ typedef struct {
int32_t
dnodeId
;
int32_t
dnodeId
;
int64_t
clusterId
;
int64_t
clusterId
;
SDnode
*
pDnode
;
SDnode
*
pDnode
;
SendReqToDnodeFp
sendReq
ToDnode
Fp
;
SendReqToDnodeFp
sendReqFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendRedirectRspFp
sendRedirectRspFp
;
SendRedirectRspFp
sendRedirectRspFp
;
}
SBnodeOpt
;
}
SBnodeOpt
;
...
...
include/dnode/mnode/mnode.h
浏览文件 @
58b64fcf
...
@@ -40,7 +40,7 @@ typedef struct {
...
@@ -40,7 +40,7 @@ typedef struct {
SDnode
*
pDnode
;
SDnode
*
pDnode
;
PutReqToMWriteQFp
putReqToMWriteQFp
;
PutReqToMWriteQFp
putReqToMWriteQFp
;
PutReqToMReadQFp
putReqToMReadQFp
;
PutReqToMReadQFp
putReqToMReadQFp
;
SendReqToDnodeFp
sendReq
ToDnode
Fp
;
SendReqToDnodeFp
sendReqFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendRedirectRspFp
sendRedirectRspFp
;
SendRedirectRspFp
sendRedirectRspFp
;
}
SMnodeOpt
;
}
SMnodeOpt
;
...
...
include/dnode/qnode/qnode.h
浏览文件 @
58b64fcf
...
@@ -43,7 +43,7 @@ typedef struct {
...
@@ -43,7 +43,7 @@ typedef struct {
int32_t
dnodeId
;
int32_t
dnodeId
;
int64_t
clusterId
;
int64_t
clusterId
;
SDnode
*
pDnode
;
SDnode
*
pDnode
;
SendReqToDnodeFp
sendReq
ToDnode
Fp
;
SendReqToDnodeFp
sendReqFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendRedirectRspFp
sendRedirectRspFp
;
SendRedirectRspFp
sendRedirectRspFp
;
}
SQnodeOpt
;
}
SQnodeOpt
;
...
...
include/dnode/snode/snode.h
浏览文件 @
58b64fcf
...
@@ -39,7 +39,7 @@ typedef struct {
...
@@ -39,7 +39,7 @@ typedef struct {
int32_t
dnodeId
;
int32_t
dnodeId
;
int64_t
clusterId
;
int64_t
clusterId
;
SDnode
*
pDnode
;
SDnode
*
pDnode
;
SendReqToDnodeFp
sendReq
ToDnode
Fp
;
SendReqToDnodeFp
sendReqFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendRedirectRspFp
sendRedirectRspFp
;
SendRedirectRspFp
sendRedirectRspFp
;
}
SSnodeOpt
;
}
SSnodeOpt
;
...
...
include/libs/qworker/qworker.h
浏览文件 @
58b64fcf
...
@@ -49,10 +49,10 @@ typedef struct {
...
@@ -49,10 +49,10 @@ typedef struct {
}
SQWorkerStat
;
}
SQWorkerStat
;
typedef
int32_t
(
*
putReqToQueryQFp
)(
void
*
,
struct
SRpcMsg
*
);
typedef
int32_t
(
*
putReqToQueryQFp
)(
void
*
,
struct
SRpcMsg
*
);
typedef
int32_t
(
*
sendReq
ToDnode
Fp
)(
void
*
,
struct
SEpSet
*
,
struct
SRpcMsg
*
);
typedef
int32_t
(
*
sendReqFp
)(
void
*
,
struct
SEpSet
*
,
struct
SRpcMsg
*
);
int32_t
qWorkerInit
(
int8_t
nodeType
,
int32_t
nodeId
,
SQWorkerCfg
*
cfg
,
void
**
qWorkerMgmt
,
void
*
nodeObj
,
int32_t
qWorkerInit
(
int8_t
nodeType
,
int32_t
nodeId
,
SQWorkerCfg
*
cfg
,
void
**
qWorkerMgmt
,
void
*
nodeObj
,
putReqToQueryQFp
fp1
,
sendReq
ToDnode
Fp
fp2
);
putReqToQueryQFp
fp1
,
sendReqFp
fp2
);
int32_t
qWorkerProcessQueryMsg
(
void
*
node
,
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
);
int32_t
qWorkerProcessQueryMsg
(
void
*
node
,
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
);
...
...
include/libs/tfs/tfs.h
浏览文件 @
58b64fcf
...
@@ -244,7 +244,7 @@ void tfsClosedir(STfsDir *pDir);
...
@@ -244,7 +244,7 @@ void tfsClosedir(STfsDir *pDir);
* @param pTfs The fs object.
* @param pTfs The fs object.
* @param pInfo The info object.
* @param pInfo The info object.
*/
*/
int32_t
tfsGetMonitorInfo
(
STfs
*
pTfs
,
SMonDiskInfo
*
pInfo
);
void
tfsGetMonitorInfo
(
STfs
*
pTfs
,
SMonDiskInfo
*
pInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/bnode/src/bmMgmt.c
浏览文件 @
58b64fcf
...
@@ -177,7 +177,7 @@ static void dndStopBnodeWorker(SDnode *pDnode) {
...
@@ -177,7 +177,7 @@ static void dndStopBnodeWorker(SDnode *pDnode) {
static void dndBuildBnodeOption(SDnode *pDnode, SBnodeOpt *pOption) {
static void dndBuildBnodeOption(SDnode *pDnode, SBnodeOpt *pOption) {
pOption->pDnode = pDnode;
pOption->pDnode = pDnode;
pOption->sendReq
ToDnode
Fp = dndSendReqToDnode;
pOption->sendReqFp = dndSendReqToDnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendRedirectRspFp = dmSendRedirectRsp;
pOption->sendRedirectRspFp = dmSendRedirectRsp;
pOption->dnodeId = dmGetDnodeId(pDnode);
pOption->dnodeId = dmGetDnodeId(pDnode);
...
...
source/dnode/mgmt/container/src/dndMonitor.c
浏览文件 @
58b64fcf
...
@@ -25,7 +25,9 @@ static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
...
@@ -25,7 +25,9 @@ static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
return
vmGetTfsMonitorInfo
(
dndGetWrapper
(
pDnode
,
VNODES
),
pInfo
);
vmGetTfsMonitorInfo
(
dndGetWrapper
(
pDnode
,
VNODES
),
pInfo
);
return
0
;
}
}
static
void
dndGetMonitorBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
static
void
dndGetMonitorBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
...
@@ -48,7 +50,7 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
...
@@ -48,7 +50,7 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
taosGetCardInfo
(
&
pInfo
->
net_in
,
&
pInfo
->
net_out
);
taosGetCardInfo
(
&
pInfo
->
net_in
,
&
pInfo
->
net_out
);
taosGetProcIO
(
&
pInfo
->
io_read
,
&
pInfo
->
io_write
,
&
pInfo
->
io_read_disk
,
&
pInfo
->
io_write_disk
);
taosGetProcIO
(
&
pInfo
->
io_read
,
&
pInfo
->
io_write
,
&
pInfo
->
io_read_disk
,
&
pInfo
->
io_write_disk
);
vmGetVn
dMonitorInfo
(
dndGetWrapper
(
pDnode
,
VNODES
),
pInfo
);
vmGetVn
odeReqs
(
dndGetWrapper
(
pDnode
,
VNODES
),
pInfo
);
pInfo
->
has_mnode
=
(
dndGetWrapper
(
pDnode
,
MNODE
)
->
required
);
pInfo
->
has_mnode
=
(
dndGetWrapper
(
pDnode
,
MNODE
)
->
required
);
}
}
...
...
source/dnode/mgmt/dnode/src/dmMsg.c
浏览文件 @
58b64fcf
...
@@ -44,7 +44,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
...
@@ -44,7 +44,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
taosRUnLockLatch
(
&
pMgmt
->
latch
);
taosRUnLockLatch
(
&
pMgmt
->
latch
);
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
vmGetVnodeLoads
(
pDnode
,
req
.
pVloads
);
vmGetVnodeLoads
(
dndGetWrapper
(
pDnode
,
VNODES
)
,
req
.
pVloads
);
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
...
...
source/dnode/mgmt/dnode/src/dmWorker.c
浏览文件 @
58b64fcf
...
@@ -99,21 +99,6 @@ static void dmProcessQueue(SDnode *pDnode, SNodeMsg *pNodeMsg) {
...
@@ -99,21 +99,6 @@ static void dmProcessQueue(SDnode *pDnode, SNodeMsg *pNodeMsg) {
case
TDMT_MND_GRANT_RSP
:
case
TDMT_MND_GRANT_RSP
:
dmProcessGrantRsp
(
pDnode
,
pMsg
);
dmProcessGrantRsp
(
pDnode
,
pMsg
);
break
;
break
;
case
TDMT_DND_CREATE_VNODE
:
code
=
vmProcessCreateVnodeReq
(
pDnode
,
pMsg
);
break
;
case
TDMT_DND_ALTER_VNODE
:
code
=
vmProcessAlterVnodeReq
(
pDnode
,
pMsg
);
break
;
case
TDMT_DND_DROP_VNODE
:
code
=
vmProcessDropVnodeReq
(
pDnode
,
pMsg
);
break
;
case
TDMT_DND_SYNC_VNODE
:
code
=
vmProcessSyncVnodeReq
(
pDnode
,
pMsg
);
break
;
case
TDMT_DND_COMPACT_VNODE
:
code
=
vmProcessCompactVnodeReq
(
pDnode
,
pMsg
);
break
;
default:
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
code
=
-
1
;
code
=
-
1
;
...
...
source/dnode/mgmt/mnode/inc/mmMsg.h
浏览文件 @
58b64fcf
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
void
mmInitMsgHandles
(
SMgmtWrapper
*
pWrapper
);
void
mmInitMsgHandles
(
SMgmtWrapper
*
pWrapper
);
int32_t
mmProcessCreateReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
mmProcessCreateReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
mmProcessAlterReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
mmProcessAlterReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
mmProcessDropReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
mmProcessDropReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
...
...
source/dnode/mgmt/mnode/src/mmInt.c
浏览文件 @
58b64fcf
...
@@ -140,7 +140,7 @@ static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) {
...
@@ -140,7 +140,7 @@ static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) {
SDnode
*
pDnode
=
pMgmt
->
pDnode
;
SDnode
*
pDnode
=
pMgmt
->
pDnode
;
pOption
->
pDnode
=
pDnode
;
pOption
->
pDnode
=
pDnode
;
pOption
->
sendReq
ToDnode
Fp
=
dndSendReqToDnode
;
pOption
->
sendReqFp
=
dndSendReqToDnode
;
pOption
->
sendReqToMnodeFp
=
dndSendReqToMnode
;
pOption
->
sendReqToMnodeFp
=
dndSendReqToMnode
;
pOption
->
sendRedirectRspFp
=
dmSendRedirectRsp
;
pOption
->
sendRedirectRspFp
=
dmSendRedirectRsp
;
pOption
->
putReqToMWriteQFp
=
mmPutMsgToWriteQueue
;
pOption
->
putReqToMWriteQFp
=
mmPutMsgToWriteQueue
;
...
...
source/dnode/mgmt/qnode/src/qmMgmt.c
浏览文件 @
58b64fcf
...
@@ -183,7 +183,7 @@ static void dndStopQnodeWorker(SDnode *pDnode) {
...
@@ -183,7 +183,7 @@ static void dndStopQnodeWorker(SDnode *pDnode) {
static void dndBuildQnodeOption(SDnode *pDnode, SQnodeOpt *pOption) {
static void dndBuildQnodeOption(SDnode *pDnode, SQnodeOpt *pOption) {
pOption->pDnode = pDnode;
pOption->pDnode = pDnode;
pOption->sendReq
ToDnode
Fp = dndSendReqToDnode;
pOption->sendReqFp = dndSendReqToDnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendRedirectRspFp = dmSendRedirectRsp;
pOption->sendRedirectRspFp = dmSendRedirectRsp;
pOption->dnodeId = dmGetDnodeId(pDnode);
pOption->dnodeId = dmGetDnodeId(pDnode);
...
...
source/dnode/mgmt/snode/src/smMgmt.c
浏览文件 @
58b64fcf
...
@@ -208,7 +208,7 @@ static void dndStopSnodeWorker(SDnode *pDnode) {
...
@@ -208,7 +208,7 @@ static void dndStopSnodeWorker(SDnode *pDnode) {
static void dndBuildSnodeOption(SDnode *pDnode, SSnodeOpt *pOption) {
static void dndBuildSnodeOption(SDnode *pDnode, SSnodeOpt *pOption) {
pOption->pDnode = pDnode;
pOption->pDnode = pDnode;
pOption->sendReq
ToDnode
Fp = dndSendReqToDnode;
pOption->sendReqFp = dndSendReqToDnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendRedirectRspFp = dmSendRedirectRsp;
pOption->sendRedirectRspFp = dmSendRedirectRsp;
pOption->dnodeId = dmGetDnodeId(pDnode);
pOption->dnodeId = dmGetDnodeId(pDnode);
...
...
source/dnode/mgmt/vnode/inc/vmFile.h
浏览文件 @
58b64fcf
...
@@ -22,8 +22,9 @@
...
@@ -22,8 +22,9 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
int32_t
vmGetVnodesFromFile
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
);
int32_t
vmGetVnodesFromFile
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
);
int32_t
vmWriteVnodesToFile
(
SVnodesMgmt
*
pMgmt
);
int32_t
vmWriteVnodesToFile
(
SVnodesMgmt
*
pMgmt
);
SVnodeObj
**
vmGetVnodesFromHash
(
SVnodesMgmt
*
pMgmt
,
int32_t
*
numOfVnodes
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/vnode/inc/vmInt.h
浏览文件 @
58b64fcf
...
@@ -86,6 +86,9 @@ typedef struct {
...
@@ -86,6 +86,9 @@ typedef struct {
// interface
// interface
void
vmGetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vmGetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SArray
*
pLoads
);
void
vmGetTfsMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
);
void
vmGetVnodeReqs
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
);
// vmInt.h
// vmInt.h
SVnodeObj
*
vmAcquireVnode
(
SVnodesMgmt
*
pMgmt
,
int32_t
vgId
);
SVnodeObj
*
vmAcquireVnode
(
SVnodesMgmt
*
pMgmt
,
int32_t
vgId
);
...
@@ -93,23 +96,11 @@ void vmReleaseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode);
...
@@ -93,23 +96,11 @@ void vmReleaseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode);
int32_t
vmOpenVnode
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
);
int32_t
vmOpenVnode
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
);
void
vmCloseVnode
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
void
vmCloseVnode
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
int32_t
dndInitVnodes
(
SDnode
*
pDnode
);
void
dndCleanupVnodes
(
SDnode
*
pDnode
);
void
vmGetVnodeLoads
(
SDnode
*
pDnode
,
SArray
*
pLoads
);
void
dndProcessVnodeWriteMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dndProcessVnodeWriteMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dndProcessVnodeSyncMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dndProcessVnodeSyncMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dndProcessVnodeQueryMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dndProcessVnodeQueryMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dndProcessVnodeFetchMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dndProcessVnodeFetchMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
int32_t
vmProcessCreateVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
vmProcessAlterVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
vmProcessDropVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
dndProcessAuthVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
vmProcessSyncVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
vmProcessCompactVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
vmGetTfsMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
);
void
vmGetVndMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/vnode/inc/vmMsg.h
浏览文件 @
58b64fcf
...
@@ -22,11 +22,11 @@
...
@@ -22,11 +22,11 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
void
vmInitMsgHandles
(
SMgmtWrapper
*
pWrapper
);
void
vmInitMsgHandles
(
SMgmtWrapper
*
pWrapper
);
int32_t
vmProcessCreateVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessCreateVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessAlterVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessAlterVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
dndProcessAuthVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessSyncVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessSyncVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessCompactVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
int32_t
vmProcessCompactVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pReq
);
...
...
source/dnode/mgmt/vnode/inc/vmWorker.h
浏览文件 @
58b64fcf
...
@@ -24,13 +24,11 @@ extern "C" {
...
@@ -24,13 +24,11 @@ extern "C" {
int32_t
vmStartWorker
(
SVnodesMgmt
*
pMgmt
);
int32_t
vmStartWorker
(
SVnodesMgmt
*
pMgmt
);
void
vmStopWorker
(
SVnodesMgmt
*
pMgmt
);
void
vmStopWorker
(
SVnodesMgmt
*
pMgmt
);
int32_t
vmAllocQueue
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
void
vmFreeQueue
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
void
vmInitMsgFp
(
SMnodeMgmt
*
pMgmt
);
int32_t
vmPutMsgToQueryQueue
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
void
vmProcessRpcMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
int32_t
vmPutMsgToApplyQueue
(
SVnodesMgmt
*
pMgmt
,
int32_t
vgId
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToWriteQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
vmPutMsgToReadQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
void
vmConsumeChildQueue
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
);
void
vmConsumeParentQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
);
int32_t
vmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
...
...
source/dnode/mgmt/vnode/src/vmFile.c
浏览文件 @
58b64fcf
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "vmFile.h"
#include "vmFile.h"
static
SVnodeObj
**
vmGetVnodesFromHash
(
SVnodesMgmt
*
pMgmt
,
int32_t
*
numOfVnodes
)
{
SVnodeObj
**
vmGetVnodesFromHash
(
SVnodesMgmt
*
pMgmt
,
int32_t
*
numOfVnodes
)
{
taosRLockLatch
(
&
pMgmt
->
latch
);
taosRLockLatch
(
&
pMgmt
->
latch
);
int32_t
num
=
0
;
int32_t
num
=
0
;
...
...
source/dnode/mgmt/vnode/src/vmInt.c
浏览文件 @
58b64fcf
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "vmFile.h"
#include "vmFile.h"
#include "vmMsg.h"
#include "vmMsg.h"
#include "vmWorker.h"
#include "vmWorker.h"
#include "sync.h"
SVnodeObj
*
vmAcquireVnode
(
SVnodesMgmt
*
pMgmt
,
int32_t
vgId
)
{
SVnodeObj
*
vmAcquireVnode
(
SVnodesMgmt
*
pMgmt
,
int32_t
vgId
)
{
SVnodeObj
*
pVnode
=
NULL
;
SVnodeObj
*
pVnode
=
NULL
;
...
@@ -41,7 +42,6 @@ SVnodeObj *vmAcquireVnode(SVnodesMgmt *pMgmt, int32_t vgId) {
...
@@ -41,7 +42,6 @@ SVnodeObj *vmAcquireVnode(SVnodesMgmt *pMgmt, int32_t vgId) {
void
vmReleaseVnode
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
)
{
void
vmReleaseVnode
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
)
{
if
(
pVnode
==
NULL
)
return
;
if
(
pVnode
==
NULL
)
return
;
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
taosRLockLatch
(
&
pMgmt
->
latch
);
taosRLockLatch
(
&
pMgmt
->
latch
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
taosRUnLockLatch
(
&
pMgmt
->
latch
);
taosRUnLockLatch
(
&
pMgmt
->
latch
);
...
@@ -70,7 +70,7 @@ int32_t vmOpenVnode(SVnodesMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
...
@@ -70,7 +70,7 @@ int32_t vmOpenVnode(SVnodesMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
return
-
1
;
return
-
1
;
}
}
if
(
dndAllocVnodeQueue
(
pDnode
,
pVnode
)
!=
0
)
{
if
(
vmAllocQueue
(
pMgmt
,
pVnode
)
!=
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
...
@@ -86,7 +86,6 @@ int32_t vmOpenVnode(SVnodesMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
...
@@ -86,7 +86,6 @@ int32_t vmOpenVnode(SVnodesMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
}
}
void
vmCloseVnode
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
)
{
void
vmCloseVnode
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
)
{
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
taosWLockLatch
(
&
pMgmt
->
latch
);
taosWLockLatch
(
&
pMgmt
->
latch
);
taosHashRemove
(
pMgmt
->
hash
,
&
pVnode
->
vgId
,
sizeof
(
int32_t
));
taosHashRemove
(
pMgmt
->
hash
,
&
pVnode
->
vgId
,
sizeof
(
int32_t
));
taosWUnLockLatch
(
&
pMgmt
->
latch
);
taosWUnLockLatch
(
&
pMgmt
->
latch
);
...
@@ -99,7 +98,7 @@ void vmCloseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode) {
...
@@ -99,7 +98,7 @@ void vmCloseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode) {
while
(
!
taosQueueEmpty
(
pVnode
->
pQueryQ
))
taosMsleep
(
10
);
while
(
!
taosQueueEmpty
(
pVnode
->
pQueryQ
))
taosMsleep
(
10
);
while
(
!
taosQueueEmpty
(
pVnode
->
pFetchQ
))
taosMsleep
(
10
);
while
(
!
taosQueueEmpty
(
pVnode
->
pFetchQ
))
taosMsleep
(
10
);
dndFreeVnodeQueue
(
pDnode
,
pVnode
);
vmFreeQueue
(
pMgmt
,
pVnode
);
vnodeClose
(
pVnode
->
pImpl
);
vnodeClose
(
pVnode
->
pImpl
);
pVnode
->
pImpl
=
NULL
;
pVnode
->
pImpl
=
NULL
;
...
@@ -131,13 +130,13 @@ static void *vmOpenVnodeFunc(void *param) {
...
@@ -131,13 +130,13 @@ static void *vmOpenVnodeFunc(void *param) {
pMgmt
->
state
.
openVnodes
,
pMgmt
->
state
.
totalVnodes
);
pMgmt
->
state
.
openVnodes
,
pMgmt
->
state
.
totalVnodes
);
dndReportStartup
(
pDnode
,
"open-vnodes"
,
stepDesc
);
dndReportStartup
(
pDnode
,
"open-vnodes"
,
stepDesc
);
SVnodeCfg
cfg
=
{.
p
Dnode
=
pDnode
,
.
pTfs
=
pMgmt
->
pTfs
,
.
vgId
=
pCfg
->
vgId
,
.
dbId
=
pCfg
->
dbUid
};
SVnodeCfg
cfg
=
{.
p
Mgmt
=
pMgmt
,
.
pTfs
=
pMgmt
->
pTfs
,
.
vgId
=
pCfg
->
vgId
,
.
dbId
=
pCfg
->
dbUid
};
SVnode
*
pImpl
=
vnodeOpen
(
pCfg
->
path
,
&
cfg
);
SVnode
*
pImpl
=
vnodeOpen
(
pCfg
->
path
,
&
cfg
);
if
(
pImpl
==
NULL
)
{
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to open vnode by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
dError
(
"vgId:%d, failed to open vnode by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
pThread
->
failed
++
;
pThread
->
failed
++
;
}
else
{
}
else
{
vmOpenVnode
(
p
Dnode
,
pCfg
,
pImpl
);
vmOpenVnode
(
p
Mgmt
,
pCfg
,
pImpl
);
dDebug
(
"vgId:%d, is opened by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
dDebug
(
"vgId:%d, is opened by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
pThread
->
opened
++
;
pThread
->
opened
++
;
}
}
...
@@ -163,7 +162,7 @@ static int32_t vmOpenVnodes(SVnodesMgmt *pMgmt) {
...
@@ -163,7 +162,7 @@ static int32_t vmOpenVnodes(SVnodesMgmt *pMgmt) {
SWrapperCfg
*
pCfgs
=
NULL
;
SWrapperCfg
*
pCfgs
=
NULL
;
int32_t
numOfVnodes
=
0
;
int32_t
numOfVnodes
=
0
;
if
(
vmGetVnodesFromFile
(
p
Dnode
,
&
pCfgs
,
&
numOfVnodes
)
!=
0
)
{
if
(
vmGetVnodesFromFile
(
p
Mgmt
,
&
pCfgs
,
&
numOfVnodes
)
!=
0
)
{
dInfo
(
"failed to get vnode list from disk since %s"
,
terrstr
());
dInfo
(
"failed to get vnode list from disk since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
...
@@ -229,10 +228,10 @@ static void vmCloseVnodes(SVnodesMgmt *pMgmt) {
...
@@ -229,10 +228,10 @@ static void vmCloseVnodes(SVnodesMgmt *pMgmt) {
dInfo
(
"start to close all vnodes"
);
dInfo
(
"start to close all vnodes"
);
int32_t
numOfVnodes
=
0
;
int32_t
numOfVnodes
=
0
;
SVnodeObj
**
pVnodes
=
dndGetVnodesFromHash
(
pDnode
,
&
numOfVnodes
);
SVnodeObj
**
pVnodes
=
vmGetVnodesFromHash
(
pMgmt
,
&
numOfVnodes
);
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
vmCloseVnode
(
p
Dnode
,
pVnodes
[
i
]);
vmCloseVnode
(
p
Mgmt
,
pVnodes
[
i
]);
}
}
if
(
pVnodes
!=
NULL
)
{
if
(
pVnodes
!=
NULL
)
{
...
@@ -261,6 +260,10 @@ static void vmCleanup(SMgmtWrapper *pWrapper) {
...
@@ -261,6 +260,10 @@ static void vmCleanup(SMgmtWrapper *pWrapper) {
dInfo
(
"vnodes-mgmt is cleaned up"
);
dInfo
(
"vnodes-mgmt is cleaned up"
);
}
}
static
int32_t
vmSendReqToDnode
(
SVnodesMgmt
*
pMgmt
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
)
{
return
dndSendReqToDnode
(
pMgmt
->
pDnode
,
epSet
,
rpcMsg
);
}
static
int32_t
vmInit
(
SMgmtWrapper
*
pWrapper
)
{
static
int32_t
vmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SVnodesMgmt
*
pMgmt
=
calloc
(
1
,
sizeof
(
SVnodesMgmt
));
SVnodesMgmt
*
pMgmt
=
calloc
(
1
,
sizeof
(
SVnodesMgmt
));
...
@@ -298,8 +301,8 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
...
@@ -298,8 +301,8 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
}
}
vnodeOpt
.
nthreads
=
tsNumOfCommitThreads
;
vnodeOpt
.
nthreads
=
tsNumOfCommitThreads
;
vnodeOpt
.
put
ReqToVQueryQFp
=
dndPutReqToVQueryQ
;
vnodeOpt
.
put
ToQueryQFp
=
(
VndPutToQueryQFp
)
vmPutMsgToQueryQueue
;
vnodeOpt
.
sendReq
ToDnodeFp
=
dnd
SendReqToDnode
;
vnodeOpt
.
sendReq
Fp
=
(
VndSendReqFp
)
vm
SendReqToDnode
;
if
(
vnodeInit
(
&
vnodeOpt
)
!=
0
)
{
if
(
vnodeInit
(
&
vnodeOpt
)
!=
0
)
{
dError
(
"failed to init vnode since %s"
,
terrstr
());
dError
(
"failed to init vnode since %s"
,
terrstr
());
goto
_OVER
;
goto
_OVER
;
...
@@ -339,15 +342,14 @@ void vmGetMgmtFp(SMgmtWrapper *pWrapper) {
...
@@ -339,15 +342,14 @@ void vmGetMgmtFp(SMgmtWrapper *pWrapper) {
pWrapper
->
fp
=
mgmtFp
;
pWrapper
->
fp
=
mgmtFp
;
}
}
int32_t
vmGetTfsMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
)
{
void
vmGetTfsMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
-
1
;
if
(
pMgmt
==
NULL
)
return
;
return
tfsGetMonitorInfo
(
pMgmt
->
pTfs
,
pInfo
);
tfsGetMonitorInfo
(
pMgmt
->
pTfs
,
pInfo
);
;
}
}
void
vmGetVn
dMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
)
{
void
vmGetVn
odeReqs
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
;
if
(
pMgmt
==
NULL
)
return
;
...
@@ -362,9 +364,9 @@ void vmGetVndMonitorInfo(SMgmtWrapper *pWrapper, SMonDnodeInfo *pInfo) {
...
@@ -362,9 +364,9 @@ void vmGetVndMonitorInfo(SMgmtWrapper *pWrapper, SMonDnodeInfo *pInfo) {
pInfo
->
masters
=
pStat
->
masterNum
;
pInfo
->
masters
=
pStat
->
masterNum
;
}
}
void
vmGetVnodeLoads
(
S
Dnode
*
pDnode
,
SArray
*
pLoads
)
{
void
vmGetVnodeLoads
(
S
MgmtWrapper
*
pWrapper
,
SArray
*
pLoads
)
{
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vm
gmt
;
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pM
gmt
;
SVnodesStat
*
pStat
=
&
pMgmt
->
stat
;
SVnodesStat
*
pStat
=
&
pMgmt
->
stat
e
;
int32_t
totalVnodes
=
0
;
int32_t
totalVnodes
=
0
;
int32_t
masterNum
=
0
;
int32_t
masterNum
=
0
;
int64_t
numOfSelectReqs
=
0
;
int64_t
numOfSelectReqs
=
0
;
...
...
source/dnode/mgmt/vnode/src/vmMsg.c
浏览文件 @
58b64fcf
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "vmMsg.h"
#include "vmMsg.h"
#include "vmFile.h"
#include "vmFile.h"
#include "vmWorker.h"
#include "vmWorker.h"
#include "dmInt.h"
static
void
vmGenerateVnodeCfg
(
SCreateVnodeReq
*
pCreate
,
SVnodeCfg
*
pCfg
)
{
static
void
vmGenerateVnodeCfg
(
SCreateVnodeReq
*
pCreate
,
SVnodeCfg
*
pCfg
)
{
pCfg
->
vgId
=
pCreate
->
vgId
;
pCfg
->
vgId
=
pCreate
->
vgId
;
...
@@ -83,7 +84,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SRpcMsg *pReq) {
...
@@ -83,7 +84,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SRpcMsg *pReq) {
return
-
1
;
return
-
1
;
}
}
vnodeCfg
.
p
Dnode
=
pMgmt
->
pDnode
;
vnodeCfg
.
p
Mgmt
=
pMgmt
;
vnodeCfg
.
pTfs
=
pMgmt
->
pTfs
;
vnodeCfg
.
pTfs
=
pMgmt
->
pTfs
;
vnodeCfg
.
dbId
=
wrapperCfg
.
dbUid
;
vnodeCfg
.
dbId
=
wrapperCfg
.
dbUid
;
SVnode
*
pImpl
=
vnodeOpen
(
wrapperCfg
.
path
,
&
vnodeCfg
);
SVnode
*
pImpl
=
vnodeOpen
(
wrapperCfg
.
path
,
&
vnodeCfg
);
...
@@ -262,4 +263,10 @@ void vmInitMsgHandles(SMgmtWrapper *pWrapper) {
...
@@ -262,4 +263,10 @@ void vmInitMsgHandles(SMgmtWrapper *pWrapper) {
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
vmProcessFetchMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
vmProcessFetchMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_CONSUME
,
vmProcessFetchMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_CONSUME
,
vmProcessFetchMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
vmProcessFetchMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
vmProcessFetchMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_VNODE
,
vmProcessCreateVnodeReq
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_VNODE
,
vmProcessAlterVnodeReq
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_VNODE
,
vmProcessDropVnodeReq
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_SYNC_VNODE
,
vmProcessSyncVnodeReq
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_COMPACT_VNODE
,
vmProcessCompactVnodeReq
);
}
}
source/dnode/mgmt/vnode/src/vmWorker.c
浏览文件 @
58b64fcf
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "vmWorker.h"
#include "vmWorker.h"
static
void
dndProcessVnode
QueryQueue
(
SVnodeObj
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vnodeProcessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
}
static
void
vmProcess
QueryQueue
(
SVnodeObj
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vnodeProcessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
}
static
void
dndProcessVnode
FetchQueue
(
SVnodeObj
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
);
}
static
void
vmProcess
FetchQueue
(
SVnodeObj
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
);
}
static
void
dndProcessVnode
WriteQueue
(
SVnodeObj
*
pVnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcess
WriteQueue
(
SVnodeObj
*
pVnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
...
@@ -56,7 +56,7 @@ static void dndProcessVnodeWriteQueue(SVnodeObj *pVnode, STaosQall *qall, int32_
...
@@ -56,7 +56,7 @@ static void dndProcessVnodeWriteQueue(SVnodeObj *pVnode, STaosQall *qall, int32_
taosArrayDestroy
(
pArray
);
taosArrayDestroy
(
pArray
);
}
}
static
void
dndProcessVnode
ApplyQueue
(
SVnodeObj
*
pVnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcess
ApplyQueue
(
SVnodeObj
*
pVnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SRpcMsg
*
pMsg
=
NULL
;
SRpcMsg
*
pMsg
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
...
@@ -68,7 +68,7 @@ static void dndProcessVnodeApplyQueue(SVnodeObj *pVnode, STaosQall *qall, int32_
...
@@ -68,7 +68,7 @@ static void dndProcessVnodeApplyQueue(SVnodeObj *pVnode, STaosQall *qall, int32_
}
}
}
}
static
void
dndProcessVnode
SyncQueue
(
SVnodeObj
*
pVnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcess
SyncQueue
(
SVnodeObj
*
pVnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SRpcMsg
*
pMsg
=
NULL
;
SRpcMsg
*
pMsg
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
...
@@ -80,7 +80,7 @@ static void dndProcessVnodeSyncQueue(SVnodeObj *pVnode, STaosQall *qall, int32_t
...
@@ -80,7 +80,7 @@ static void dndProcessVnodeSyncQueue(SVnodeObj *pVnode, STaosQall *qall, int32_t
}
}
}
}
static
int32_t
dndWriteRpcMsgToVnode
Queue
(
STaosQueue
*
pQueue
,
SRpcMsg
*
pRpcMsg
,
bool
sendRsp
)
{
static
int32_t
vmWriteMsgTo
Queue
(
STaosQueue
*
pQueue
,
SRpcMsg
*
pRpcMsg
,
bool
sendRsp
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
pQueue
==
NULL
)
{
if
(
pQueue
==
NULL
)
{
...
@@ -108,7 +108,7 @@ static int32_t dndWriteRpcMsgToVnodeQueue(STaosQueue *pQueue, SRpcMsg *pRpcMsg,
...
@@ -108,7 +108,7 @@ static int32_t dndWriteRpcMsgToVnodeQueue(STaosQueue *pQueue, SRpcMsg *pRpcMsg,
return
code
;
return
code
;
}
}
static
SVnodeObj
*
dndAcquireVnodeFromMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
static
SVnodeObj
*
vmAcquireFromMsg
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SMsgHead
*
pHead
=
pMsg
->
pCont
;
SMsgHead
*
pHead
=
pMsg
->
pCont
;
pHead
->
contLen
=
htonl
(
pHead
->
contLen
);
pHead
->
contLen
=
htonl
(
pHead
->
contLen
);
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
...
@@ -126,51 +126,55 @@ static SVnodeObj *dndAcquireVnodeFromMsg(SDnode *pDnode, SRpcMsg *pMsg) {
...
@@ -126,51 +126,55 @@ static SVnodeObj *dndAcquireVnodeFromMsg(SDnode *pDnode, SRpcMsg *pMsg) {
return
pVnode
;
return
pVnode
;
}
}
void
dndProcessVnodeWriteMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
int32_t
vmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
// SVnodeObj *pVnode = vmAcquireFromMsg(pDnode, pMsg);
if
(
pVnode
!=
NULL
)
{
// if (pVnode != NULL) {
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pWriteQ
,
pMsg
,
true
);
// (void)vmWriteMsgToQueue(pVnode->pWriteQ, pMsg, true);
vmReleaseVnode
(
pMgmt
,
pVnode
);
// vmReleaseVnode(pMgmt, pVnode);
}
// }
return
0
;
}
}
void
dndProcessVnodeSyncMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
int32_t
vmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
// SVnodeObj *pVnode = vmAcquireFromMsg(pDnode, pMsg);
if
(
pVnode
!=
NULL
)
{
// if (pVnode != NULL) {
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pSyncQ
,
pMsg
,
true
);
// (void)vmWriteMsgToQueue(pVnode->pSyncQ, pMsg, true);
vmReleaseVnode
(
pMgmt
,
pVnode
);
// vmReleaseVnode(pMgmt, pVnode);
}
// }
return
0
;
}
}
void
dndProcessVnodeQueryMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
int32_t
vmProcessQueryMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
// SVnodeObj *pVnode = vmAcquireFromMsg(pDnode, pMsg);
if
(
pVnode
!=
NULL
)
{
// if (pVnode != NULL) {
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pQueryQ
,
pMsg
,
true
);
// (void)vmWriteMsgToQueue(pVnode->pQueryQ, pMsg, true);
vmReleaseVnode
(
pMgmt
,
pVnode
);
// vmReleaseVnode(pMgmt, pVnode);
}
// }
return
0
;
}
}
void
dndProcessVnodeFetchMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
int32_t
vmProcessFetchMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
// SVnodeObj *pVnode = vmAcquireFromMsg(pDnode, pMsg);
if
(
pVnode
!=
NULL
)
{
// if (pVnode != NULL) {
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pFetchQ
,
pMsg
,
true
);
// (void)vmWriteMsgToQueue(pVnode->pFetchQ, pMsg, true);
vmReleaseVnode
(
pMgmt
,
pVnode
);
// vmReleaseVnode(pMgmt, pVnode);
}
// }
return
0
;
}
}
int32_t
dndPutReqToVQueryQ
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToQueryQueue
(
SVnodesMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SMsgHead
*
pHead
=
pMsg
->
pCont
;
SMsgHead
*
pHead
=
pMsg
->
pCont
;
// pHead->vgId = htonl(pHead->vgId);
// pHead->vgId = htonl(pHead->vgId);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
if
(
pVnode
==
NULL
)
return
-
1
;
if
(
pVnode
==
NULL
)
return
-
1
;
int32_t
code
=
dndWriteRpcMsgToVnode
Queue
(
pVnode
->
pQueryQ
,
pMsg
,
false
);
int32_t
code
=
vmWriteMsgTo
Queue
(
pVnode
->
pQueryQ
,
pMsg
,
false
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
code
;
return
code
;
}
}
static
int32_t
dndPutMsgIntoVnodeApplyQueue
(
SDnode
*
pDnode
,
int32_t
vgId
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToApplyQueue
(
SVnodesMgmt
*
pMgmt
,
int32_t
vgId
,
SRpcMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
if
(
pVnode
==
NULL
)
return
-
1
;
if
(
pVnode
==
NULL
)
return
-
1
;
...
@@ -179,14 +183,12 @@ static int32_t dndPutMsgIntoVnodeApplyQueue(SDnode *pDnode, int32_t vgId, SRpcMs
...
@@ -179,14 +183,12 @@ static int32_t dndPutMsgIntoVnodeApplyQueue(SDnode *pDnode, int32_t vgId, SRpcMs
return
code
;
return
code
;
}
}
static
int32_t
dndAllocVnodeQueue
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
)
{
int32_t
vmAllocQueue
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
)
{
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
pVnode
->
pWriteQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
writePool
,
pVnode
,
(
FItems
)
vmProcessWriteQueue
);
pVnode
->
pApplyQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
writePool
,
pVnode
,
(
FItems
)
vmProcessApplyQueue
);
pVnode
->
pWriteQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
writePool
,
pVnode
,
(
FItems
)
dndProcessVnodeWriteQueue
);
pVnode
->
pSyncQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
syncPool
,
pVnode
,
(
FItems
)
vmProcessSyncQueue
);
pVnode
->
pApplyQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
writePool
,
pVnode
,
(
FItems
)
dndProcessVnodeApplyQueue
);
pVnode
->
pFetchQ
=
tFWorkerAllocQueue
(
&
pMgmt
->
fetchPool
,
pVnode
,
(
FItem
)
vmProcessFetchQueue
);
pVnode
->
pSyncQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
syncPool
,
pVnode
,
(
FItems
)
dndProcessVnodeSyncQueue
);
pVnode
->
pQueryQ
=
tQWorkerAllocQueue
(
&
pMgmt
->
queryPool
,
pVnode
,
(
FItem
)
vmProcessQueryQueue
);
pVnode
->
pFetchQ
=
tFWorkerAllocQueue
(
&
pMgmt
->
fetchPool
,
pVnode
,
(
FItem
)
dndProcessVnodeFetchQueue
);
pVnode
->
pQueryQ
=
tQWorkerAllocQueue
(
&
pMgmt
->
queryPool
,
pVnode
,
(
FItem
)
dndProcessVnodeQueryQueue
);
if
(
pVnode
->
pApplyQ
==
NULL
||
pVnode
->
pWriteQ
==
NULL
||
pVnode
->
pSyncQ
==
NULL
||
pVnode
->
pFetchQ
==
NULL
||
if
(
pVnode
->
pApplyQ
==
NULL
||
pVnode
->
pWriteQ
==
NULL
||
pVnode
->
pSyncQ
==
NULL
||
pVnode
->
pFetchQ
==
NULL
||
pVnode
->
pQueryQ
==
NULL
)
{
pVnode
->
pQueryQ
==
NULL
)
{
...
@@ -197,8 +199,7 @@ static int32_t dndAllocVnodeQueue(SDnode *pDnode, SVnodeObj *pVnode) {
...
@@ -197,8 +199,7 @@ static int32_t dndAllocVnodeQueue(SDnode *pDnode, SVnodeObj *pVnode) {
return
0
;
return
0
;
}
}
static
void
dndFreeVnodeQueue
(
SDnode
*
pDnode
,
SVnodeObj
*
pVnode
)
{
void
vmFreeQueue
(
SVnodesMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
)
{
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
tQWorkerFreeQueue
(
&
pMgmt
->
queryPool
,
pVnode
->
pQueryQ
);
tQWorkerFreeQueue
(
&
pMgmt
->
queryPool
,
pVnode
->
pQueryQ
);
tFWorkerFreeQueue
(
&
pMgmt
->
fetchPool
,
pVnode
->
pFetchQ
);
tFWorkerFreeQueue
(
&
pMgmt
->
fetchPool
,
pVnode
->
pFetchQ
);
tWWorkerFreeQueue
(
&
pMgmt
->
writePool
,
pVnode
->
pWriteQ
);
tWWorkerFreeQueue
(
&
pMgmt
->
writePool
,
pVnode
->
pWriteQ
);
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
58b64fcf
...
@@ -119,7 +119,7 @@ typedef struct SMnode {
...
@@ -119,7 +119,7 @@ typedef struct SMnode {
SHashObj
*
infosMeta
;
SHashObj
*
infosMeta
;
SGrantInfo
grant
;
SGrantInfo
grant
;
MndMsgFp
msgFp
[
TDMT_MAX
];
MndMsgFp
msgFp
[
TDMT_MAX
];
SendReqToDnodeFp
sendReq
ToDnode
Fp
;
SendReqToDnodeFp
sendReqFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendRedirectRspFp
sendRedirectRspFp
;
SendRedirectRspFp
sendRedirectRspFp
;
PutReqToMWriteQFp
putReqToMWriteQFp
;
PutReqToMWriteQFp
putReqToMWriteQFp
;
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
58b64fcf
...
@@ -44,16 +44,16 @@
...
@@ -44,16 +44,16 @@
#define TELEM_TIMER_MS 86400000
#define TELEM_TIMER_MS 86400000
int32_t
mndSendReqToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
int32_t
mndSendReqToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
==
NULL
||
pMnode
->
sendReq
ToDnode
Fp
==
NULL
)
{
if
(
pMnode
==
NULL
||
pMnode
->
sendReqFp
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NOT_READY
;
terrno
=
TSDB_CODE_MND_NOT_READY
;
return
-
1
;
return
-
1
;
}
}
return
(
*
pMnode
->
sendReq
ToDnode
Fp
)(
pMnode
->
pDnode
,
pEpSet
,
pMsg
);
return
(
*
pMnode
->
sendReqFp
)(
pMnode
->
pDnode
,
pEpSet
,
pMsg
);
}
}
int32_t
mndSendReqToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
int32_t
mndSendReqToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
==
NULL
||
pMnode
->
sendReq
ToDnode
Fp
==
NULL
)
{
if
(
pMnode
==
NULL
||
pMnode
->
sendReqFp
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NOT_READY
;
terrno
=
TSDB_CODE_MND_NOT_READY
;
return
-
1
;
return
-
1
;
}
}
...
@@ -289,11 +289,11 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
...
@@ -289,11 +289,11 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
pMnode
->
pDnode
=
pOption
->
pDnode
;
pMnode
->
pDnode
=
pOption
->
pDnode
;
pMnode
->
putReqToMWriteQFp
=
pOption
->
putReqToMWriteQFp
;
pMnode
->
putReqToMWriteQFp
=
pOption
->
putReqToMWriteQFp
;
pMnode
->
putReqToMReadQFp
=
pOption
->
putReqToMReadQFp
;
pMnode
->
putReqToMReadQFp
=
pOption
->
putReqToMReadQFp
;
pMnode
->
sendReq
ToDnodeFp
=
pOption
->
sendReqToDnode
Fp
;
pMnode
->
sendReq
Fp
=
pOption
->
sendReq
Fp
;
pMnode
->
sendReqToMnodeFp
=
pOption
->
sendReqToMnodeFp
;
pMnode
->
sendReqToMnodeFp
=
pOption
->
sendReqToMnodeFp
;
pMnode
->
sendRedirectRspFp
=
pOption
->
sendRedirectRspFp
;
pMnode
->
sendRedirectRspFp
=
pOption
->
sendRedirectRspFp
;
if
(
pMnode
->
sendReq
ToDnode
Fp
==
NULL
||
pMnode
->
sendReqToMnodeFp
==
NULL
||
pMnode
->
sendRedirectRspFp
==
NULL
||
if
(
pMnode
->
sendReqFp
==
NULL
||
pMnode
->
sendReqToMnodeFp
==
NULL
||
pMnode
->
sendRedirectRspFp
==
NULL
||
pMnode
->
putReqToMWriteQFp
==
NULL
||
pMnode
->
dnodeId
<
0
||
pMnode
->
clusterId
<
0
)
{
pMnode
->
putReqToMWriteQFp
==
NULL
||
pMnode
->
dnodeId
<
0
||
pMnode
->
clusterId
<
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_OPTIONS
;
terrno
=
TSDB_CODE_MND_INVALID_OPTIONS
;
return
-
1
;
return
-
1
;
...
...
source/dnode/qnode/src/qnode.c
浏览文件 @
58b64fcf
...
@@ -30,7 +30,7 @@ SQnode *qndOpen(const SQnodeOpt *pOption) {
...
@@ -30,7 +30,7 @@ SQnode *qndOpen(const SQnodeOpt *pOption) {
}
}
if
(
qWorkerInit
(
NODE_TYPE_QNODE
,
pQnode
->
qndId
,
NULL
,
(
void
**
)
&
pQnode
->
pQuery
,
pQnode
,
if
(
qWorkerInit
(
NODE_TYPE_QNODE
,
pQnode
->
qndId
,
NULL
,
(
void
**
)
&
pQnode
->
pQuery
,
pQnode
,
(
putReqToQueryQFp
)
qnodePutReqToVQueryQ
,
(
sendReq
ToDnode
Fp
)
qnodeSendReqToDnode
))
{
(
putReqToQueryQFp
)
qnodePutReqToVQueryQ
,
(
sendReqFp
)
qnodeSendReqToDnode
))
{
tfree
(
pQnode
);
tfree
(
pQnode
);
return
NULL
;
return
NULL
;
}
}
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
58b64fcf
...
@@ -31,9 +31,8 @@ extern "C" {
...
@@ -31,9 +31,8 @@ extern "C" {
/* ------------------------ TYPES EXPOSED ------------------------ */
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SVnode
SVnode
;
typedef
struct
SVnode
SVnode
;
typedef
struct
SDnode
SDnode
;
typedef
int32_t
(
*
VndPutToQueryQFp
)(
void
*
pMgmt
,
struct
SRpcMsg
*
pReq
);
typedef
int32_t
(
*
PutReqToVQueryQFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
pReq
);
typedef
int32_t
(
*
VndSendReqFp
)(
void
*
pMgmt
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReqToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
struct
{
typedef
struct
{
// TODO
// TODO
...
@@ -43,7 +42,7 @@ typedef struct {
...
@@ -43,7 +42,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
uint64_t
dbId
;
uint64_t
dbId
;
SDnode
*
pDnode
;
void
*
pMgmt
;
STfs
*
pTfs
;
STfs
*
pTfs
;
uint64_t
wsize
;
uint64_t
wsize
;
uint64_t
ssize
;
uint64_t
ssize
;
...
@@ -63,9 +62,9 @@ typedef struct {
...
@@ -63,9 +62,9 @@ typedef struct {
}
SVnodeCfg
;
}
SVnodeCfg
;
typedef
struct
{
typedef
struct
{
uint16_t
nthreads
;
// number of commit threads. 0 for no threads and a schedule queue should be given (TODO)
uint16_t
nthreads
;
// number of commit threads. 0 for no threads and a schedule queue should be given (TODO)
PutReqToVQueryQFp
putReqToV
QueryQFp
;
VndPutToQueryQFp
putTo
QueryQFp
;
SendReqToDnodeFp
sendReqToDnode
Fp
;
VndSendReqFp
sendReq
Fp
;
}
SVnodeOpt
;
}
SVnodeOpt
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
58b64fcf
...
@@ -53,9 +53,8 @@ typedef struct SVnodeMgr {
...
@@ -53,9 +53,8 @@ typedef struct SVnodeMgr {
pthread_cond_t
hasTask
;
pthread_cond_t
hasTask
;
TD_DLIST
(
SVnodeTask
)
queue
;
TD_DLIST
(
SVnodeTask
)
queue
;
// For vnode Mgmt
// For vnode Mgmt
SDnode
*
pDnode
;
VndPutToQueryQFp
putToQueryQFp
;
PutReqToVQueryQFp
putReqToVQueryQFp
;
VndSendReqFp
sendReqFp
;
SendReqToDnodeFp
sendReqToDnodeFp
;
}
SVnodeMgr
;
}
SVnodeMgr
;
extern
SVnodeMgr
vnodeMgr
;
extern
SVnodeMgr
vnodeMgr
;
...
@@ -79,7 +78,7 @@ struct SVnode {
...
@@ -79,7 +78,7 @@ struct SVnode {
SWal
*
pWal
;
SWal
*
pWal
;
tsem_t
canCommit
;
tsem_t
canCommit
;
SQHandle
*
pQuery
;
SQHandle
*
pQuery
;
SDnode
*
pDnode
;
void
*
pMgmt
;
STfs
*
pTfs
;
STfs
*
pTfs
;
};
};
...
...
source/dnode/vnode/src/vnd/vnodeMain.c
浏览文件 @
58b64fcf
...
@@ -27,7 +27,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) {
...
@@ -27,7 +27,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) {
SVnodeCfg
cfg
=
defaultVnodeOptions
;
SVnodeCfg
cfg
=
defaultVnodeOptions
;
if
(
pVnodeCfg
!=
NULL
)
{
if
(
pVnodeCfg
!=
NULL
)
{
cfg
.
vgId
=
pVnodeCfg
->
vgId
;
cfg
.
vgId
=
pVnodeCfg
->
vgId
;
cfg
.
p
Dnode
=
pVnodeCfg
->
pDnode
;
cfg
.
p
Mgmt
=
pVnodeCfg
->
pMgmt
;
cfg
.
pTfs
=
pVnodeCfg
->
pTfs
;
cfg
.
pTfs
=
pVnodeCfg
->
pTfs
;
cfg
.
dbId
=
pVnodeCfg
->
dbId
;
cfg
.
dbId
=
pVnodeCfg
->
dbId
;
cfg
.
hashBegin
=
pVnodeCfg
->
hashBegin
;
cfg
.
hashBegin
=
pVnodeCfg
->
hashBegin
;
...
@@ -79,7 +79,7 @@ static SVnode *vnodeNew(const char *path, const SVnodeCfg *pVnodeCfg) {
...
@@ -79,7 +79,7 @@ static SVnode *vnodeNew(const char *path, const SVnodeCfg *pVnodeCfg) {
}
}
pVnode
->
vgId
=
pVnodeCfg
->
vgId
;
pVnode
->
vgId
=
pVnodeCfg
->
vgId
;
pVnode
->
p
Dnode
=
pVnodeCfg
->
pDnode
;
pVnode
->
p
Mgmt
=
pVnodeCfg
->
pMgmt
;
pVnode
->
pTfs
=
pVnodeCfg
->
pTfs
;
pVnode
->
pTfs
=
pVnodeCfg
->
pTfs
;
pVnode
->
path
=
strdup
(
path
);
pVnode
->
path
=
strdup
(
path
);
vnodeOptionsCopy
(
&
(
pVnode
->
config
),
pVnodeCfg
);
vnodeOptionsCopy
(
&
(
pVnode
->
config
),
pVnodeCfg
);
...
...
source/dnode/vnode/src/vnd/vnodeMgr.c
浏览文件 @
58b64fcf
...
@@ -25,8 +25,8 @@ int vnodeInit(const SVnodeOpt *pOption) {
...
@@ -25,8 +25,8 @@ int vnodeInit(const SVnodeOpt *pOption) {
}
}
vnodeMgr
.
stop
=
false
;
vnodeMgr
.
stop
=
false
;
vnodeMgr
.
put
ReqToVQueryQFp
=
pOption
->
putReqToV
QueryQFp
;
vnodeMgr
.
put
ToQueryQFp
=
pOption
->
putTo
QueryQFp
;
vnodeMgr
.
sendReq
ToDnodeFp
=
pOption
->
sendReqToDnode
Fp
;
vnodeMgr
.
sendReq
Fp
=
pOption
->
sendReq
Fp
;
// Start commit handers
// Start commit handers
if
(
pOption
->
nthreads
>
0
)
{
if
(
pOption
->
nthreads
>
0
)
{
...
@@ -90,15 +90,15 @@ int vnodeScheduleTask(SVnodeTask* pTask) {
...
@@ -90,15 +90,15 @@ int vnodeScheduleTask(SVnodeTask* pTask) {
}
}
int32_t
vnodePutReqToVQueryQ
(
SVnode
*
pVnode
,
struct
SRpcMsg
*
pReq
)
{
int32_t
vnodePutReqToVQueryQ
(
SVnode
*
pVnode
,
struct
SRpcMsg
*
pReq
)
{
if
(
pVnode
==
NULL
||
pVnode
->
p
Dnode
==
NULL
||
vnodeMgr
.
putReqToV
QueryQFp
==
NULL
)
{
if
(
pVnode
==
NULL
||
pVnode
->
p
Meta
==
NULL
||
vnodeMgr
.
putTo
QueryQFp
==
NULL
)
{
terrno
=
TSDB_CODE_VND_APP_ERROR
;
terrno
=
TSDB_CODE_VND_APP_ERROR
;
return
-
1
;
return
-
1
;
}
}
return
(
*
vnodeMgr
.
put
ReqToVQueryQFp
)(
pVnode
->
pDnode
,
pReq
);
return
(
*
vnodeMgr
.
put
ToQueryQFp
)(
pVnode
->
pMgmt
,
pReq
);
}
}
void
vnodeSendReqToDnode
(
SVnode
*
pVnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
pReq
)
{
void
vnodeSendReqToDnode
(
SVnode
*
pVnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
pReq
)
{
(
*
vnodeMgr
.
sendReq
ToDnodeFp
)(
pVnode
->
pDnode
,
epSet
,
pReq
);
(
*
vnodeMgr
.
sendReq
Fp
)(
pVnode
->
pMgmt
,
epSet
,
pReq
);
}
}
/* ------------------------ STATIC METHODS ------------------------ */
/* ------------------------ STATIC METHODS ------------------------ */
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
58b64fcf
...
@@ -21,7 +21,7 @@ static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg);
...
@@ -21,7 +21,7 @@ static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg);
int
vnodeQueryOpen
(
SVnode
*
pVnode
)
{
int
vnodeQueryOpen
(
SVnode
*
pVnode
)
{
return
qWorkerInit
(
NODE_TYPE_VNODE
,
pVnode
->
vgId
,
NULL
,
(
void
**
)
&
pVnode
->
pQuery
,
pVnode
,
return
qWorkerInit
(
NODE_TYPE_VNODE
,
pVnode
->
vgId
,
NULL
,
(
void
**
)
&
pVnode
->
pQuery
,
pVnode
,
(
putReqToQueryQFp
)
vnodePutReqToVQueryQ
,
(
sendReq
ToDnode
Fp
)
vnodeSendReqToDnode
);
(
putReqToQueryQFp
)
vnodePutReqToVQueryQ
,
(
sendReqFp
)
vnodeSendReqToDnode
);
}
}
void
vnodeQueryClose
(
SVnode
*
pVnode
)
{
void
vnodeQueryClose
(
SVnode
*
pVnode
)
{
...
...
source/libs/qworker/inc/qworkerInt.h
浏览文件 @
58b64fcf
...
@@ -150,7 +150,7 @@ typedef struct SQWorkerMgmt {
...
@@ -150,7 +150,7 @@ typedef struct SQWorkerMgmt {
SHashObj
*
ctxHash
;
//key: queryId+taskId, value: SQWTaskCtx
SHashObj
*
ctxHash
;
//key: queryId+taskId, value: SQWTaskCtx
void
*
nodeObj
;
void
*
nodeObj
;
putReqToQueryQFp
putToQueueFp
;
putReqToQueryQFp
putToQueueFp
;
sendReq
ToDnode
Fp
sendReqFp
;
sendReqFp
sendReqFp
;
}
SQWorkerMgmt
;
}
SQWorkerMgmt
;
#define QW_FPARAMS_DEF SQWorkerMgmt *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId
#define QW_FPARAMS_DEF SQWorkerMgmt *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
58b64fcf
...
@@ -1443,7 +1443,7 @@ _return:
...
@@ -1443,7 +1443,7 @@ _return:
}
}
int32_t
qWorkerInit
(
int8_t
nodeType
,
int32_t
nodeId
,
SQWorkerCfg
*
cfg
,
void
**
qWorkerMgmt
,
void
*
nodeObj
,
int32_t
qWorkerInit
(
int8_t
nodeType
,
int32_t
nodeId
,
SQWorkerCfg
*
cfg
,
void
**
qWorkerMgmt
,
void
*
nodeObj
,
putReqToQueryQFp
fp1
,
sendReq
ToDnode
Fp
fp2
)
{
putReqToQueryQFp
fp1
,
sendReqFp
fp2
)
{
if
(
NULL
==
qWorkerMgmt
||
NULL
==
nodeObj
||
NULL
==
fp1
||
NULL
==
fp2
)
{
if
(
NULL
==
qWorkerMgmt
||
NULL
==
nodeObj
||
NULL
==
fp1
||
NULL
==
fp2
)
{
qError
(
"invalid param to init qworker"
);
qError
(
"invalid param to init qworker"
);
QW_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
QW_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
...
...
source/libs/tfs/src/tfs.c
浏览文件 @
58b64fcf
...
@@ -539,9 +539,9 @@ static STfsDisk *tfsNextDisk(STfs *pTfs, SDiskIter *pIter) {
...
@@ -539,9 +539,9 @@ static STfsDisk *tfsNextDisk(STfs *pTfs, SDiskIter *pIter) {
return
pDisk
;
return
pDisk
;
}
}
int32_t
tfsGetMonitorInfo
(
STfs
*
pTfs
,
SMonDiskInfo
*
pInfo
)
{
void
tfsGetMonitorInfo
(
STfs
*
pTfs
,
SMonDiskInfo
*
pInfo
)
{
pInfo
->
datadirs
=
taosArrayInit
(
32
,
sizeof
(
SMonDiskDesc
));
pInfo
->
datadirs
=
taosArrayInit
(
32
,
sizeof
(
SMonDiskDesc
));
if
(
pInfo
->
datadirs
==
NULL
)
return
-
1
;
if
(
pInfo
->
datadirs
==
NULL
)
return
;
tfsUpdateSize
(
pTfs
);
tfsUpdateSize
(
pTfs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录