Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3b1add19
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看板
提交
3b1add19
编写于
10月 25, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10430] add dnode trans file
上级
7bcfb460
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
189 addition
and
172 deletion
+189
-172
include/server/mnode/mnode.h
include/server/mnode/mnode.h
+10
-0
include/util/tdef.h
include/util/tdef.h
+1
-0
source/server/dnode/inc/dnodeInt.h
source/server/dnode/inc/dnodeInt.h
+2
-0
source/server/dnode/inc/dnodeMain.h
source/server/dnode/inc/dnodeMain.h
+5
-5
source/server/dnode/inc/dnodeTrans.h
source/server/dnode/inc/dnodeTrans.h
+0
-1
source/server/dnode/src/dnodeInt.c
source/server/dnode/src/dnodeInt.c
+4
-3
source/server/dnode/src/dnodeMain.c
source/server/dnode/src/dnodeMain.c
+4
-4
source/server/dnode/src/dnodeTrans.c
source/server/dnode/src/dnodeTrans.c
+141
-155
source/server/mnode/inc/mnodeInt.h
source/server/mnode/inc/mnodeInt.h
+1
-0
source/server/mnode/src/mnodeAuth.c
source/server/mnode/src/mnodeAuth.c
+17
-2
source/server/mnode/src/mondeInt.c
source/server/mnode/src/mondeInt.c
+4
-2
未找到文件。
include/server/mnode/mnode.h
浏览文件 @
3b1add19
...
...
@@ -46,6 +46,16 @@ typedef struct {
*/
void
(
*
SendRedirectMsg
)(
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
);
/**
* Get the corresponding endpoint information from dnodeId.
*
* @param dnode, the instance of dDnode module.
* @param dnodeId, the id ot dnode.
* @param ep, the endpoint of dnode.
* @param fqdn, the fqdn of dnode.
* @param port, the port of dnode.
*/
void
(
*
GetDnodeEp
)(
int32_t
dnodeId
,
char
*
ep
,
char
*
fqdn
,
uint16_t
*
port
);
}
SMnodeFp
;
typedef
struct
{
...
...
include/util/tdef.h
浏览文件 @
3b1add19
...
...
@@ -68,6 +68,7 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_DATA_NULL_STR "NULL"
#define TSDB_DATA_NULL_STR_L "null"
#define TSDB_NETTEST_USER "nettestinternal"
#define TSDB_DEFAULT_USER "root"
#ifdef _TD_POWER_
#define TSDB_DEFAULT_PASS "powerdb"
...
...
source/server/dnode/inc/dnodeInt.h
浏览文件 @
3b1add19
...
...
@@ -19,7 +19,9 @@
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#include "taosmsg.h"
#include "tglobal.h"
#include "tlog.h"
#include "trpc.h"
#include "dnode.h"
...
...
source/server/dnode/inc/dnodeMain.h
浏览文件 @
3b1add19
...
...
@@ -22,10 +22,10 @@ extern "C" {
#include "dnodeInt.h"
typedef
enum
{
TD
_RUN_STAT_INIT
,
TD
_RUN_STAT_RUNNING
,
TD
_RUN_STAT_STOPPED
}
RunStat
;
DN
_RUN_STAT_INIT
,
DN
_RUN_STAT_RUNNING
,
DN
_RUN_STAT_STOPPED
}
EDn
RunStat
;
int32_t
dnodeInitMain
();
void
dnodeCleanupMain
();
...
...
@@ -36,7 +36,7 @@ void dnodeReportStartupFinished(char *name, char *desc);
void
dnodeProcessStartupReq
(
SRpcMsg
*
pMsg
);
void
dnodeProcessCreateMnodeReq
(
SRpcMsg
*
pMsg
);
void
dnodeProcessConfigDnodeReq
(
SRpcMsg
*
pMsg
);
RunStat
dnodeGetRunStat
();
EDn
RunStat
dnodeGetRunStat
();
void
dnodeSetRunStat
();
void
*
dnodeGetTimer
();
...
...
source/server/dnode/inc/dnodeTrans.h
浏览文件 @
3b1add19
...
...
@@ -25,7 +25,6 @@ int32_t dnodeInitTrans();
void
dnodeCleanupTrans
();
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToDnode
(
SRpcEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
,
SRpcEpSet
*
epSet
);
#ifdef __cplusplus
}
...
...
source/server/dnode/src/dnodeInt.c
浏览文件 @
3b1add19
...
...
@@ -46,6 +46,7 @@ static int32_t dnodeInitVnodeModule(void **unused) {
static
int32_t
dnodeInitMnodeModule
(
void
**
unused
)
{
SMnodePara
para
;
para
.
fp
.
GetDnodeEp
=
dnodeGetDnodeEp
;
para
.
fp
.
SendMsgToDnode
=
dnodeSendMsgToDnode
;
para
.
fp
.
SendMsgToMnode
=
dnodeSendMsgToMnode
;
para
.
fp
.
SendRedirectMsg
=
dnodeSendRedirectMsg
;
...
...
@@ -77,7 +78,7 @@ int32_t dnodeInit() {
taosStepExec
(
tsSteps
);
dnodeSetRunStat
(
TD
_RUN_STAT_RUNNING
);
dnodeSetRunStat
(
DN
_RUN_STAT_RUNNING
);
dnodeReportStartupFinished
(
"TDengine"
,
"initialized successfully"
);
dInfo
(
"TDengine is initialized successfully"
);
...
...
@@ -85,8 +86,8 @@ int32_t dnodeInit() {
}
void
dnodeCleanup
()
{
if
(
dnodeGetRunStat
()
!=
TD
_RUN_STAT_STOPPED
)
{
dnodeSetRunStat
(
TD
_RUN_STAT_STOPPED
);
if
(
dnodeGetRunStat
()
!=
DN
_RUN_STAT_STOPPED
)
{
dnodeSetRunStat
(
DN
_RUN_STAT_STOPPED
);
taosStepCleanup
(
tsSteps
);
tsSteps
=
NULL
;
}
...
...
source/server/dnode/src/dnodeMain.c
浏览文件 @
3b1add19
...
...
@@ -29,7 +29,7 @@
#include "mnode.h"
static
struct
{
RunStat
runStatus
;
EDn
RunStat
runStatus
;
void
*
dnodeTimer
;
SStartupStep
startup
;
}
tsDmain
;
...
...
@@ -55,7 +55,7 @@ static void dnodeCheckDataDirOpenned(char *dir) {
}
int32_t
dnodeInitMain
()
{
tsDmain
.
runStatus
=
TD
_RUN_STAT_STOPPED
;
tsDmain
.
runStatus
=
DN
_RUN_STAT_STOPPED
;
tsDmain
.
dnodeTimer
=
taosTmrInit
(
100
,
200
,
60000
,
"DND-TMR"
);
if
(
tsDmain
.
dnodeTimer
==
NULL
)
{
dError
(
"failed to init dnode timer"
);
...
...
@@ -260,8 +260,8 @@ void dnodeProcessConfigDnodeReq(SRpcMsg *pMsg) {
rpcFreeCont
(
pMsg
->
pCont
);
}
RunStat
dnodeGetRunStat
()
{
return
tsDmain
.
runStatus
;
}
EDn
RunStat
dnodeGetRunStat
()
{
return
tsDmain
.
runStatus
;
}
void
dnodeSetRunStat
(
RunStat
stat
)
{
tsDmain
.
runStatus
=
stat
;
}
void
dnodeSetRunStat
(
EDn
RunStat
stat
)
{
tsDmain
.
runStatus
=
stat
;
}
void
*
dnodeGetTimer
()
{
return
tsDmain
.
dnodeTimer
;
}
\ No newline at end of file
source/server/dnode/src/dnodeTrans.c
浏览文件 @
3b1add19
...
...
@@ -20,21 +20,19 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tglobal.h"
#include "dnodeTrans.h"
#include "dnodeMain.h"
#include "dnodeMnodeEps.h"
#include "dnodeStatus.h"
#include "dnodeTrans.h"
#include "vnode.h"
#include "mnode.h"
#include "vnode.h"
typedef
void
(
*
RpcMsgFp
)(
SRpcMsg
*
pMsg
);
typedef
void
(
*
RpcMsgFp
)(
SRpcMsg
*
pMsg
);
static
struct
{
void
*
serverRpc
;
void
*
clientRpc
;
void
*
shellRpc
;
void
*
serverRpc
;
void
*
clientRpc
;
void
*
shellRpc
;
int32_t
queryReqNum
;
int32_t
submitReqNum
;
RpcMsgFp
peerMsgFp
[
TSDB_MSG_TYPE_MAX
];
...
...
@@ -43,18 +41,18 @@ static struct {
static
void
dnodeProcessPeerReq
(
SRpcMsg
*
pMsg
,
SRpcEpSet
*
pEpSet
)
{
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
};
int32_t
msgType
=
pMsg
->
msgType
;
if
(
pMsg
->
pCont
==
NULL
)
return
;
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_NETWORK_TEST
)
{
if
(
msgType
==
TSDB_MSG_TYPE_NETWORK_TEST
)
{
dnodeProcessStartupReq
(
pMsg
);
return
;
}
if
(
dnodeGetRunStat
()
!=
TD
_RUN_STAT_RUNNING
)
{
if
(
dnodeGetRunStat
()
!=
DN
_RUN_STAT_RUNNING
)
{
rspMsg
.
code
=
TSDB_CODE_APP_NOT_READY
;
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
dTrace
(
"RPC %p,
msg:%s is ignored since dnode not running"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
dTrace
(
"RPC %p,
peer req:%s is ignored since dnode not running"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
return
;
}
...
...
@@ -64,18 +62,19 @@ static void dnodeProcessPeerReq(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
return
;
}
RpcMsgFp
fp
=
tsTrans
.
peerMsgFp
[
pMsg
->
msgType
];
RpcMsgFp
fp
=
tsTrans
.
peerMsgFp
[
msgType
];
if
(
fp
!=
NULL
)
{
dTrace
(
"RPC %p, peer req:%s will be processed"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
(
*
fp
)(
pMsg
);
}
else
{
d
Debug
(
"RPC %p, peer req:%s not processed"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
d
Error
(
"RPC %p, peer req:%s not processed"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
rspMsg
.
code
=
TSDB_CODE_DND_MSG_NOT_PROCESSED
;
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
}
}
int32_t
dnodeInitServer
()
{
static
int32_t
dnodeInitServer
()
{
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_TABLE
]
=
vnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_DROP_TABLE
]
=
vnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_TABLE
]
=
vnodeProcessMsg
;
...
...
@@ -86,6 +85,7 @@ int32_t dnodeInitServer() {
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_SYNC_VNODE
]
=
vnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_COMPACT_VNODE
]
=
vnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_DROP_VNODE
]
=
vnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_STREAM
]
=
vnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_CONFIG_DNODE
]
=
dnodeProcessConfigDnodeReq
;
...
...
@@ -117,7 +117,7 @@ int32_t dnodeInitServer() {
return
0
;
}
void
dnodeCleanupServer
()
{
static
void
dnodeCleanupServer
()
{
if
(
tsTrans
.
serverRpc
)
{
rpcClose
(
tsTrans
.
serverRpc
);
tsTrans
.
serverRpc
=
NULL
;
...
...
@@ -125,32 +125,32 @@ void dnodeCleanupServer() {
}
}
static
void
dnodeProcessRspFromPeer
(
SRpcMsg
*
pMsg
,
SRpcEpSet
*
pEpSet
)
{
if
(
dnodeGetRunStat
()
==
TD_RUN_STAT_STOPPED
)
{
static
void
dnodeProcessPeerRsp
(
SRpcMsg
*
pMsg
,
SRpcEpSet
*
pEpSet
)
{
int32_t
msgType
=
pMsg
->
msgType
;
if
(
dnodeGetRunStat
()
==
DN_RUN_STAT_STOPPED
)
{
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
return
;
dTrace
(
"
msg:%p is ignored since dnode is stopping"
,
pMsg
);
dTrace
(
"
RPC %p, peer rsp:%s is ignored since dnode is stopping"
,
pMsg
->
handle
,
taosMsg
[
msgType
]
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
}
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_DM_STATUS_RSP
&&
pEpSet
)
{
if
(
msgType
==
TSDB_MSG_TYPE_DM_STATUS_RSP
&&
pEpSet
)
{
dnodeUpdateMnodeFromPeer
(
pEpSet
);
}
RpcMsgFp
fp
=
tsTrans
.
peerMsgFp
[
pMsg
->
msgType
];
RpcMsgFp
fp
=
tsTrans
.
peerMsgFp
[
msgType
];
if
(
fp
!=
NULL
)
{
dTrace
(
"RPC %p, peer rsp:%s will be processed"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
(
*
fp
)(
pMsg
);
}
else
{
dDebug
(
"RPC %p, peer rsp:%s not processed"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
};
rspMsg
.
code
=
TSDB_CODE_DND_MSG_NOT_PROCESSED
;
rpcSendResponse
(
&
rspMsg
);
dDebug
(
"RPC %p, peer rsp:%s not processed"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
}
rpcFreeCont
(
pMsg
->
pCont
);
}
int32_t
dnodeInitClient
()
{
static
int32_t
dnodeInitClient
()
{
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_TABLE_RSP
]
=
mnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_DROP_TABLE_RSP
]
=
mnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_TABLE_RSP
]
=
mnodeProcessMsg
;
...
...
@@ -161,6 +161,7 @@ int32_t dnodeInitClient() {
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_SYNC_VNODE_RSP
]
=
mnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_COMPACT_VNODE_RSP
]
=
mnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_DROP_VNODE_RSP
]
=
mnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_STREAM_RSP
]
=
mnodeProcessMsg
;
tsTrans
.
peerMsgFp
[
TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP
]
=
mnodeProcessMsg
;
...
...
@@ -177,7 +178,7 @@ int32_t dnodeInitClient() {
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
label
=
"DND-C"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
dnodeProcessRspFromPeer
;
rpcInit
.
cfp
=
dnodeProcessPeerRsp
;
rpcInit
.
sessions
=
TSDB_MAX_VNODES
<<
4
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
...
...
@@ -195,7 +196,7 @@ int32_t dnodeInitClient() {
return
0
;
}
void
dnodeCleanupClient
()
{
static
void
dnodeCleanupClient
()
{
if
(
tsTrans
.
clientRpc
)
{
rpcClose
(
tsTrans
.
clientRpc
);
tsTrans
.
clientRpc
=
NULL
;
...
...
@@ -203,59 +204,50 @@ void dnodeCleanupClient() {
}
}
static
void
dnodeProcessMsgFromShell
(
SRpcMsg
*
pMsg
,
SRpcEpSet
*
pEpSet
)
{
SRpcMsg
rpcMsg
=
{.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
};
static
void
dnodeProcessShellReq
(
SRpcMsg
*
pMsg
,
SRpcEpSet
*
pEpSet
)
{
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
};
int32_t
msgType
=
pMsg
->
msgType
;
if
(
pMsg
->
pCont
==
NULL
)
return
;
if
(
dnodeGetRunStat
()
==
TD_RUN_STAT_STOPPED
)
{
dError
(
"RPC %p, shell msg:%s is ignored since dnode exiting"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
rpcMsg
.
code
=
TSDB_CODE_DND_EXITING
;
rpcSendResponse
(
&
rpcMsg
);
if
(
dnodeGetRunStat
()
==
DN_RUN_STAT_STOPPED
)
{
dError
(
"RPC %p, shell req:%s is ignored since dnode exiting"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
rspMsg
.
code
=
TSDB_CODE_DND_EXITING
;
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
}
else
if
(
dnodeGetRunStat
()
!=
TD
_RUN_STAT_RUNNING
)
{
dError
(
"RPC %p, shell
msg:%s is ignored since dnode not running"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
r
pc
Msg
.
code
=
TSDB_CODE_APP_NOT_READY
;
rpcSendResponse
(
&
r
pc
Msg
);
}
else
if
(
dnodeGetRunStat
()
!=
DN
_RUN_STAT_RUNNING
)
{
dError
(
"RPC %p, shell
req:%s is ignored since dnode not running"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
r
sp
Msg
.
code
=
TSDB_CODE_APP_NOT_READY
;
rpcSendResponse
(
&
r
sp
Msg
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
}
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_QUERY
)
{
if
(
pMsg
->
pCont
==
NULL
)
{
rspMsg
.
code
=
TSDB_CODE_DND_INVALID_MSG_LEN
;
rpcSendResponse
(
&
rspMsg
);
return
;
}
if
(
msgType
==
TSDB_MSG_TYPE_QUERY
)
{
atomic_fetch_add_32
(
&
tsTrans
.
queryReqNum
,
1
);
}
else
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_SUBMIT
)
{
}
else
if
(
msgType
==
TSDB_MSG_TYPE_SUBMIT
)
{
atomic_fetch_add_32
(
&
tsTrans
.
submitReqNum
,
1
);
}
else
{}
}
else
{
}
RpcMsgFp
fp
=
tsTrans
.
shellMsgFp
[
pMsg
->
msgType
];
RpcMsgFp
fp
=
tsTrans
.
shellMsgFp
[
msgType
];
if
(
fp
!=
NULL
)
{
dTrace
(
"RPC %p, shell req:%s will be processed"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
(
*
fp
)(
pMsg
);
}
else
{
dError
(
"RPC %p, shell req:%s is not processed"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
r
pc
Msg
.
code
=
TSDB_CODE_DND_MSG_NOT_PROCESSED
;
rpcSendResponse
(
&
r
pc
Msg
);
dError
(
"RPC %p, shell req:%s is not processed"
,
pMsg
->
handle
,
taosMsg
[
msgType
]);
r
sp
Msg
.
code
=
TSDB_CODE_DND_MSG_NOT_PROCESSED
;
rpcSendResponse
(
&
r
sp
Msg
);
rpcFreeCont
(
pMsg
->
pCont
);
}
}
static
int32_t
dnodeAuthNetTest
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
strcmp
(
user
,
"nettestinternal"
)
==
0
)
{
char
pass
[
32
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)
user
,
strlen
(
user
),
pass
);
*
spi
=
0
;
*
encrypt
=
0
;
*
ckey
=
0
;
memcpy
(
secret
,
pass
,
TSDB_KEY_LEN
);
dTrace
(
"nettest user is authorized"
);
return
0
;
}
return
-
1
;
}
void
dnodeSendMsgToDnode
(
SRpcEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsTrans
.
clientRpc
,
epSet
,
rpcMsg
,
NULL
);
}
void
dnodeSendMsgToDnode
(
SRpcEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsTrans
.
clientRpc
,
epSet
,
rpcMsg
,
NULL
);
}
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
SRpcEpSet
epSet
=
{
0
};
...
...
@@ -263,19 +255,13 @@ void dnodeSendMsgToMnode(SRpcMsg *rpcMsg) {
dnodeSendMsgToDnode
(
&
epSet
,
rpcMsg
);
}
void
dnodeSendMsgToMnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
static
void
dnodeSendMsgToMnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
SRpcEpSet
epSet
=
{
0
};
dnodeGetEpSetForPeer
(
&
epSet
);
rpcSendRecv
(
tsTrans
.
clientRpc
,
&
epSet
,
rpcMsg
,
rpcRsp
);
}
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
,
SRpcEpSet
*
epSet
)
{
rpcSendRecv
(
tsTrans
.
clientRpc
,
epSet
,
rpcMsg
,
rpcRsp
);
}
static
int32_t
dnodeRetrieveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
dnodeAuthNetTest
(
user
,
spi
,
encrypt
,
secret
,
ckey
)
==
0
)
return
0
;
int32_t
code
=
mnodeRetriveAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
);
if
(
code
!=
TSDB_CODE_APP_NOT_READY
)
return
code
;
...
...
@@ -306,7 +292,7 @@ static int32_t dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, c
return
rpcRsp
.
code
;
}
int32_t
dnodeInitShell
()
{
static
int32_t
dnodeInitShell
()
{
tsTrans
.
shellMsgFp
[
TSDB_MSG_TYPE_SUBMIT
]
=
vnodeProcessMsg
;
tsTrans
.
shellMsgFp
[
TSDB_MSG_TYPE_QUERY
]
=
vnodeProcessMsg
;
tsTrans
.
shellMsgFp
[
TSDB_MSG_TYPE_FETCH
]
=
vnodeProcessMsg
;
...
...
@@ -363,7 +349,7 @@ int32_t dnodeInitShell() {
rpcInit
.
localPort
=
tsDnodeShellPort
;
rpcInit
.
label
=
"SHELL"
;
rpcInit
.
numOfThreads
=
numOfThreads
;
rpcInit
.
cfp
=
dnodeProcessMsgFromShell
;
rpcInit
.
cfp
=
dnodeProcessShellReq
;
rpcInit
.
sessions
=
tsMaxShellConns
;
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
...
...
@@ -379,7 +365,7 @@ int32_t dnodeInitShell() {
return
0
;
}
void
dnodeCleanupShell
()
{
static
void
dnodeCleanupShell
()
{
if
(
tsTrans
.
shellRpc
)
{
rpcClose
(
tsTrans
.
shellRpc
);
tsTrans
.
shellRpc
=
NULL
;
...
...
source/server/mnode/inc/mnodeInt.h
浏览文件 @
3b1add19
...
...
@@ -30,6 +30,7 @@ EMnStatus mnodeGetStatus();
void
mnodeSendMsgToDnode
(
struct
SRpcEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
void
mnodeSendMsgToMnode
(
struct
SRpcMsg
*
rpcMsg
);
void
mnodeSendRedirectMsg
(
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
);
void
mnodeGetDnodeEp
(
int32_t
dnodeId
,
char
*
ep
,
char
*
fqdn
,
uint16_t
*
port
);
#ifdef __cplusplus
}
...
...
source/server/mnode/src/mnodeAuth.c
浏览文件 @
3b1add19
...
...
@@ -15,7 +15,22 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "mnode
Int
.h"
#include "mnode
Auth
.h"
int32_t
mnodeInitAuth
()
{
return
0
;
}
void
mnodeCleanupAuth
()
{}
int32_t
mnodeRetriveAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
strcmp
(
user
,
TSDB_NETTEST_USER
)
==
0
)
{
char
pass
[
32
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)
user
,
strlen
(
user
),
pass
);
*
spi
=
0
;
*
encrypt
=
0
;
*
ckey
=
0
;
memcpy
(
secret
,
pass
,
TSDB_KEY_LEN
);
mDebug
(
"nettest user is authorized"
);
return
0
;
}
return
0
;
}
\ No newline at end of file
source/server/mnode/src/mondeInt.c
浏览文件 @
3b1add19
...
...
@@ -61,6 +61,10 @@ void mnodeSendMsgToMnode(struct SRpcMsg *rpcMsg) { return (*tsMint.fp.SendMsgToM
void
mnodeSendRedirectMsg
(
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
)
{
(
*
tsMint
.
fp
.
SendRedirectMsg
)(
rpcMsg
,
forShell
);
}
void
mnodeGetDnodeEp
(
int32_t
dnodeId
,
char
*
ep
,
char
*
fqdn
,
uint16_t
*
port
)
{
(
*
tsMint
.
fp
.
GetDnodeEp
)(
dnodeId
,
ep
,
fqdn
,
port
);
}
int32_t
mnodeGetStatistics
(
SMnodeStat
*
stat
)
{
return
0
;
}
static
int32_t
mnodeSetPara
(
SMnodePara
para
)
{
...
...
@@ -242,5 +246,3 @@ void mnodeCleanup() {
mInfo
(
"mnode is cleaned up"
);
}
}
int32_t
mnodeRetriveAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录