Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
84effaab
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看板
提交
84effaab
编写于
11月 02, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename SRpcEpset to SEpSet
上级
72cb9c01
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
81 addition
and
79 deletion
+81
-79
include/common/taosmsg.h
include/common/taosmsg.h
+1
-10
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+6
-12
include/server/mnode/mnode.h
include/server/mnode/mnode.h
+1
-1
source/dnode/mgmt/inc/dnodeDnode.h
source/dnode/mgmt/inc/dnodeDnode.h
+3
-3
source/dnode/mgmt/inc/dnodeInt.h
source/dnode/mgmt/inc/dnodeInt.h
+1
-1
source/dnode/mgmt/inc/dnodeMnode.h
source/dnode/mgmt/inc/dnodeMnode.h
+2
-3
source/dnode/mgmt/inc/dnodeTransport.h
source/dnode/mgmt/inc/dnodeTransport.h
+1
-1
source/dnode/mgmt/inc/dnodeVnodes.h
source/dnode/mgmt/inc/dnodeVnodes.h
+1
-1
source/dnode/mgmt/src/dnodeDnode.c
source/dnode/mgmt/src/dnodeDnode.c
+7
-7
source/dnode/mgmt/src/dnodeMnode.c
source/dnode/mgmt/src/dnodeMnode.c
+23
-4
source/dnode/mgmt/src/dnodeTransport.c
source/dnode/mgmt/src/dnodeTransport.c
+7
-8
source/dnode/mgmt/src/dnodeVnodes.c
source/dnode/mgmt/src/dnodeVnodes.c
+1
-1
source/dnode/mnode/inc/mnodeInt.h
source/dnode/mnode/inc/mnodeInt.h
+1
-1
source/dnode/mnode/inc/mnodeMnode.h
source/dnode/mnode/inc/mnodeMnode.h
+2
-2
source/dnode/mnode/src/mnodeMnode.c
source/dnode/mnode/src/mnodeMnode.c
+2
-2
source/dnode/mnode/src/mnodeWorker.c
source/dnode/mnode/src/mnodeWorker.c
+6
-6
source/dnode/mnode/src/mondeInt.c
source/dnode/mnode/src/mondeInt.c
+1
-1
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+15
-15
未找到文件。
include/common/taosmsg.h
浏览文件 @
84effaab
...
...
@@ -901,16 +901,7 @@ typedef struct {
typedef
struct
{
char
queryId
[
TSDB_KILL_MSG_LEN
+
1
];
}
SKillQueryMsg
,
SKillStreamMsg
,
SKillConnMsg
;
typedef
struct
{
int32_t
vnode
;
int32_t
sid
;
uint64_t
uid
;
uint64_t
stime
;
// stream starting time
int32_t
status
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
}
SAlterStreamMsg
;
}
SKillQueryMsg
,
SKillConnMsg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
...
...
include/libs/transport/trpc.h
浏览文件 @
84effaab
...
...
@@ -22,22 +22,16 @@ extern "C" {
#include <stdbool.h>
#include <stdint.h>
#include "taosdef.h"
#include "taosmsg.h"
#define TAOS_CONN_SERVER 0
#define TAOS_CONN_CLIENT 1
extern
int
tsRpcHeadSize
;
typedef
struct
SRpcEpSet
{
int8_t
inUse
;
int8_t
numOfEps
;
uint16_t
port
[
TSDB_MAX_REPLICA
];
char
fqdn
[
TSDB_MAX_REPLICA
][
TSDB_FQDN_LEN
];
}
SRpcEpSet
;
typedef
struct
SRpcCorEpSet
{
int32_t
version
;
S
Rpc
EpSet
epSet
;
SEpSet
epSet
;
}
SRpcCorEpSet
;
typedef
struct
SRpcConnInfo
{
...
...
@@ -72,7 +66,7 @@ typedef struct SRpcInit {
char
*
ckey
;
// ciphering key
// call back to process incoming msg, code shall be ignored by server app
void
(
*
cfp
)(
SRpcMsg
*
,
S
Rpc
EpSet
*
);
void
(
*
cfp
)(
SRpcMsg
*
,
SEpSet
*
);
// call back to retrieve the client auth info, for server app only
int
(
*
afp
)(
char
*
tableId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
...
...
@@ -85,11 +79,11 @@ void rpcClose(void *);
void
*
rpcMallocCont
(
int
contLen
);
void
rpcFreeCont
(
void
*
pCont
);
void
*
rpcReallocCont
(
void
*
ptr
,
int
contLen
);
void
rpcSendRequest
(
void
*
thandle
,
const
S
Rpc
EpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
int64_t
*
rid
);
void
rpcSendRequest
(
void
*
thandle
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
int64_t
*
rid
);
void
rpcSendResponse
(
const
SRpcMsg
*
pMsg
);
void
rpcSendRedirectRsp
(
void
*
pConn
,
const
S
Rpc
EpSet
*
pEpSet
);
void
rpcSendRedirectRsp
(
void
*
pConn
,
const
SEpSet
*
pEpSet
);
int
rpcGetConnInfo
(
void
*
thandle
,
SRpcConnInfo
*
pInfo
);
void
rpcSendRecv
(
void
*
shandle
,
S
Rpc
EpSet
*
pEpSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
void
rpcSendRecv
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
int
rpcReportProgress
(
void
*
pConn
,
char
*
pCont
,
int
contLen
);
void
rpcCancelRequest
(
int64_t
rid
);
...
...
include/server/mnode/mnode.h
浏览文件 @
84effaab
...
...
@@ -29,7 +29,7 @@ typedef struct {
* @param epSet, the endpoint list of the dnodes.
* @param rpcMsg, message to be sent.
*/
void
(
*
SendMsgToDnode
)(
struct
S
Rpc
EpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
void
(
*
SendMsgToDnode
)(
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
/**
* Send messages to mnode, such as config message.
...
...
source/dnode/mgmt/inc/dnodeDnode.h
浏览文件 @
84effaab
...
...
@@ -23,13 +23,13 @@ extern "C" {
int32_t
dnodeInitDnode
();
void
dnodeCleanupDnode
();
void
dnodeProcessDnodeMsg
(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
);
void
dnodeProcessDnodeMsg
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
int32_t
dnodeGetDnodeId
();
int64_t
dnodeGetClusterId
();
void
dnodeGetDnodeEp
(
int32_t
dnodeId
,
char
*
epstr
,
char
*
fqdn
,
uint16_t
*
port
);
void
dnodeGetMnodeEpSetForPeer
(
S
Rpc
EpSet
*
epSet
);
void
dnodeGetMnodeEpSetForShell
(
S
Rpc
EpSet
*
epSet
);
void
dnodeGetMnodeEpSetForPeer
(
SEpSet
*
epSet
);
void
dnodeGetMnodeEpSetForShell
(
SEpSet
*
epSet
);
void
dnodeSendRedirectMsg
(
SRpcMsg
*
rpcMsg
,
bool
forShell
);
#ifdef __cplusplus
...
...
source/dnode/mgmt/inc/dnodeInt.h
浏览文件 @
84effaab
...
...
@@ -35,7 +35,7 @@ extern int32_t dDebugFlag;
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
typedef
enum
{
DN_RUN_STAT_INIT
,
DN_RUN_STAT_RUNNING
,
DN_RUN_STAT_STOPPED
}
EDnStat
;
typedef
void
(
*
MsgFp
)(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
);
typedef
void
(
*
MsgFp
)(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
int32_t
dnodeInit
();
void
dnodeCleanup
();
...
...
source/dnode/mgmt/inc/dnodeMnode.h
浏览文件 @
84effaab
...
...
@@ -23,9 +23,8 @@ extern "C" {
int32_t
dnodeInitMnode
();
void
dnodeCleanupMnode
();
void
dnodeProcessMnodeMsg
(
SRpcMsg
*
pMsg
,
SRpcEpSet
*
pEpSet
);
void
dnodeProcessCreateMnodeReq
(
SRpcMsg
*
pMsg
);
void
dnodeProcessMnodeMsg
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
int32_t
dnodeGetUserAuthFromMnode
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/dnodeTransport.h
浏览文件 @
84effaab
...
...
@@ -24,7 +24,7 @@ extern "C" {
int32_t
dnodeInitTrans
();
void
dnodeCleanupTrans
();
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToDnode
(
S
Rpc
EpSet
*
epSet
,
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToDnode
(
SEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/dnodeVnodes.h
浏览文件 @
84effaab
...
...
@@ -23,7 +23,7 @@ extern "C" {
int32_t
dnodeInitVnodes
();
void
dnodeCleanupVnodes
();
void
dnodeProcessVnodesMsg
(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
);
void
dnodeProcessVnodesMsg
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
dnodeGetVnodes
(
SVnodeLoads
*
pVloads
);
#ifdef __cplusplus
...
...
source/dnode/mgmt/src/dnodeDnode.c
浏览文件 @
84effaab
...
...
@@ -27,8 +27,8 @@ static struct {
int64_t
clusterId
;
SDnodeEps
*
dnodeEps
;
SHashObj
*
dnodeHash
;
S
RpcEpSet
mnodeEpSetForShell
;
S
RpcEpSet
mnodeEpSetForPeer
;
S
EpSet
mnodeEpSetForShell
;
S
EpSet
mnodeEpSetForPeer
;
char
file
[
PATH_MAX
+
20
];
uint32_t
rebootTime
;
int8_t
dropped
;
...
...
@@ -67,13 +67,13 @@ void dnodeGetDnodeEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port) {
pthread_mutex_unlock
(
&
tsDnode
.
mutex
);
}
void
dnodeGetMnodeEpSetForPeer
(
S
Rpc
EpSet
*
pEpSet
)
{
void
dnodeGetMnodeEpSetForPeer
(
SEpSet
*
pEpSet
)
{
pthread_mutex_lock
(
&
tsDnode
.
mutex
);
*
pEpSet
=
tsDnode
.
mnodeEpSetForPeer
;
pthread_mutex_unlock
(
&
tsDnode
.
mutex
);
}
void
dnodeGetMnodeEpSetForShell
(
S
Rpc
EpSet
*
pEpSet
)
{
void
dnodeGetMnodeEpSetForShell
(
SEpSet
*
pEpSet
)
{
pthread_mutex_lock
(
&
tsDnode
.
mutex
);
*
pEpSet
=
tsDnode
.
mnodeEpSetForShell
;
pthread_mutex_unlock
(
&
tsDnode
.
mutex
);
...
...
@@ -82,7 +82,7 @@ void dnodeGetMnodeEpSetForShell(SRpcEpSet *pEpSet) {
void
dnodeSendRedirectMsg
(
SRpcMsg
*
pMsg
,
bool
forShell
)
{
int32_t
msgType
=
pMsg
->
msgType
;
S
Rpc
EpSet
epSet
=
{
0
};
SEpSet
epSet
=
{
0
};
if
(
forShell
)
{
dnodeGetMnodeEpSetForShell
(
&
epSet
);
}
else
{
...
...
@@ -107,7 +107,7 @@ void dnodeSendRedirectMsg(SRpcMsg *pMsg, bool forShell) {
rpcSendRedirectRsp
(
pMsg
->
handle
,
&
epSet
);
}
static
void
dnodeUpdateMnodeEpSet
(
S
Rpc
EpSet
*
pEpSet
)
{
static
void
dnodeUpdateMnodeEpSet
(
SEpSet
*
pEpSet
)
{
if
(
pEpSet
==
NULL
||
pEpSet
->
numOfEps
<=
0
)
{
dError
(
"mnode is changed, but content is invalid, discard it"
);
return
;
...
...
@@ -528,7 +528,7 @@ void dnodeCleanupDnode() {
dInfo
(
"dnode-dnode is cleaned up"
);
}
void
dnodeProcessDnodeMsg
(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
)
{
void
dnodeProcessDnodeMsg
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
int32_t
msgType
=
pMsg
->
msgType
;
if
(
msgType
==
TSDB_MSG_TYPE_STATUS_RSP
&&
pEpSet
)
{
...
...
source/dnode/mgmt/src/dnodeMnode.c
浏览文件 @
84effaab
...
...
@@ -61,9 +61,28 @@ void dnodeProcessCreateMnodeReq(SRpcMsg *pMsg) {
rpcFreeCont
(
pMsg
->
pCont
);
}
void
dnodeProcessMnodeMsg
(
SRpcMsg
*
pMsg
,
SRpcEpSet
*
pEpSet
)
{
mnodeProcessMsg
(
pMsg
);
// tsDnode.msgFp[TSDB_MSG_TYPE_CREATE_MNODE_IN] = dnodeProcessCreateMnodeReq;
void
dnodeProcessDropMnodeReq
(
SRpcMsg
*
pMsg
)
{
int32_t
code
=
dnodeStartMnode
(
pMsg
);
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
code
};
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
}
void
dnodeProcessMnodeMsg
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
switch
(
pMsg
->
msgType
)
{
case
TSDB_MSG_TYPE_CREATE_MNODE_IN
:
dnodeProcessCreateMnodeReq
(
pMsg
);
break
;
case
TSDB_MSG_TYPE_DROP_MNODE_IN
:
dnodeProcessDropMnodeReq
(
pMsg
);
break
;
default:
mnodeProcessMsg
(
pMsg
);
}
}
// tsTrans.msgFp[TSDB_MSG_TYPE_DROP_MNODE_IN] = dnodeProcessDropMnodeReq;
int32_t
dnodeGetUserAuthFromMnode
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
return
mnodeRetriveAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
);
}
\ No newline at end of file
source/dnode/mgmt/src/dnodeTransport.c
浏览文件 @
84effaab
...
...
@@ -24,7 +24,6 @@
#include "dnodeDnode.h"
#include "dnodeMnode.h"
#include "dnodeVnodes.h"
#include "mnode.h"
static
struct
{
void
*
peerRpc
;
...
...
@@ -119,7 +118,7 @@ static void dnodeInitMsgFp() {
tsTrans
.
msgFp
[
TSDB_MSG_TYPE_STATUS_RSP
]
=
dnodeProcessDnodeMsg
;
}
static
void
dnodeProcessPeerReq
(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
)
{
static
void
dnodeProcessPeerReq
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
};
int32_t
msgType
=
pMsg
->
msgType
;
...
...
@@ -183,7 +182,7 @@ static void dnodeCleanupPeerServer() {
}
}
static
void
dnodeProcessPeerRsp
(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
)
{
static
void
dnodeProcessPeerRsp
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
int32_t
msgType
=
pMsg
->
msgType
;
if
(
dnodeGetRunStat
()
==
DN_RUN_STAT_STOPPED
)
{
...
...
@@ -237,7 +236,7 @@ static void dnodeCleanupClient() {
}
}
static
void
dnodeProcessShellReq
(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
)
{
static
void
dnodeProcessShellReq
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
};
int32_t
msgType
=
pMsg
->
msgType
;
...
...
@@ -274,13 +273,13 @@ static void dnodeProcessShellReq(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
}
static
void
dnodeSendMsgToMnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
S
Rpc
EpSet
epSet
=
{
0
};
SEpSet
epSet
=
{
0
};
dnodeGetMnodeEpSetForPeer
(
&
epSet
);
rpcSendRecv
(
tsTrans
.
clientRpc
,
&
epSet
,
rpcMsg
,
rpcRsp
);
}
static
int32_t
dnodeRetrieveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
int32_t
code
=
mnodeRetriveAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
);
int32_t
code
=
dnodeGetUserAuthFromMnode
(
user
,
spi
,
encrypt
,
secret
,
ckey
);
if
(
code
!=
TSDB_CODE_APP_NOT_READY
)
return
code
;
SAuthMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SAuthMsg
));
...
...
@@ -362,10 +361,10 @@ void dnodeCleanupTrans() {
dnodeCleanupClient
();
}
void
dnodeSendMsgToDnode
(
S
Rpc
EpSet
*
epSet
,
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsTrans
.
clientRpc
,
epSet
,
rpcMsg
,
NULL
);
}
void
dnodeSendMsgToDnode
(
SEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsTrans
.
clientRpc
,
epSet
,
rpcMsg
,
NULL
);
}
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
S
Rpc
EpSet
epSet
=
{
0
};
SEpSet
epSet
=
{
0
};
dnodeGetMnodeEpSetForPeer
(
&
epSet
);
dnodeSendMsgToDnode
(
&
epSet
,
rpcMsg
);
}
\ No newline at end of file
source/dnode/mgmt/src/dnodeVnodes.c
浏览文件 @
84effaab
...
...
@@ -21,6 +21,6 @@ int32_t dnodeInitVnodes() { return vnodeInit(); }
void
dnodeCleanupVnodes
()
{
vnodeCleanup
();
}
void
dnodeProcessVnodesMsg
(
SRpcMsg
*
pMsg
,
S
Rpc
EpSet
*
pEpSet
)
{
vnodeProcessMsg
(
NULL
,
NULL
);
}
void
dnodeProcessVnodesMsg
(
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
vnodeProcessMsg
(
NULL
,
NULL
);
}
void
dnodeGetVnodes
(
SVnodeLoads
*
pVloads
)
{}
\ No newline at end of file
source/dnode/mnode/inc/mnodeInt.h
浏览文件 @
84effaab
...
...
@@ -27,7 +27,7 @@ int32_t mnodeGetDnodeId();
int64_t
mnodeGetClusterId
();
EMnStatus
mnodeGetStatus
();
void
mnodeSendMsgToDnode
(
struct
S
Rpc
EpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
void
mnodeSendMsgToDnode
(
struct
SEpSet
*
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
);
...
...
source/dnode/mnode/inc/mnodeMnode.h
浏览文件 @
84effaab
...
...
@@ -24,8 +24,8 @@ extern "C" {
int32_t
mnodeInitMnode
();
void
mnodeCleanupMnode
();
void
mnodeGetMnodeEpSetForPeer
(
S
Rpc
EpSet
*
epSet
,
bool
redirect
);
void
mnodeGetMnodeEpSetForShell
(
S
Rpc
EpSet
*
epSet
,
bool
redirect
);
void
mnodeGetMnodeEpSetForPeer
(
SEpSet
*
epSet
,
bool
redirect
);
void
mnodeGetMnodeEpSetForShell
(
SEpSet
*
epSet
,
bool
redirect
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/src/mnodeMnode.c
浏览文件 @
84effaab
...
...
@@ -20,5 +20,5 @@
int32_t
mnodeInitMnode
()
{
return
0
;
}
void
mnodeCleanupMnode
()
{}
void
mnodeGetMnodeEpSetForPeer
(
SRpcEpSet
*
epSet
,
bool
redirect
)
{}
void
mnodeGetMnodeEpSetForShell
(
SRpcEpSet
*
epSet
,
bool
redirect
)
{}
\ No newline at end of file
void
mnodeGetMnodeEpSetForPeer
(
SEpSet
*
epSet
,
bool
redirect
)
{}
void
mnodeGetMnodeEpSetForShell
(
SEpSet
*
epSet
,
bool
redirect
)
{}
\ No newline at end of file
source/dnode/mnode/src/mnodeWorker.c
浏览文件 @
84effaab
...
...
@@ -297,10 +297,10 @@ static void mnodeProcessWriteReq(SMnMsg *pMsg, void *unused) {
if
(
!
mnodeIsMaster
())
{
SMnRsp
*
rpcRsp
=
&
pMsg
->
rpcRsp
;
S
RpcEpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
SRpc
EpSet
));
S
EpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
S
EpSet
));
mnodeGetMnodeEpSetForShell
(
epSet
,
true
);
rpcRsp
->
rsp
=
epSet
;
rpcRsp
->
len
=
sizeof
(
S
Rpc
EpSet
);
rpcRsp
->
len
=
sizeof
(
SEpSet
);
mDebug
(
"msg:%p, app:%p type:%s in write queue, is redirected, numOfEps:%d inUse:%d"
,
pMsg
,
ahandle
,
taosMsg
[
msgType
],
epSet
->
numOfEps
,
epSet
->
inUse
);
...
...
@@ -334,14 +334,14 @@ static void mnodeProcessReadReq(SMnMsg *pMsg, void *unused) {
if
(
!
mnodeIsMaster
())
{
SMnRsp
*
rpcRsp
=
&
pMsg
->
rpcRsp
;
S
RpcEpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
SRpc
EpSet
));
S
EpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
S
EpSet
));
if
(
!
epSet
)
{
code
=
TSDB_CODE_MND_OUT_OF_MEMORY
;
goto
PROCESS_READ_REQ_END
;
}
mnodeGetMnodeEpSetForShell
(
epSet
,
true
);
rpcRsp
->
rsp
=
epSet
;
rpcRsp
->
len
=
sizeof
(
S
Rpc
EpSet
);
rpcRsp
->
len
=
sizeof
(
SEpSet
);
mDebug
(
"msg:%p, app:%p type:%s in mread queue is redirected, numOfEps:%d inUse:%d"
,
pMsg
,
ahandle
,
taosMsg
[
msgType
],
epSet
->
numOfEps
,
epSet
->
inUse
);
...
...
@@ -375,10 +375,10 @@ static void mnodeProcessPeerReq(SMnMsg *pMsg, void *unused) {
if
(
!
mnodeIsMaster
())
{
SMnRsp
*
rpcRsp
=
&
pMsg
->
rpcRsp
;
S
RpcEpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
SRpc
EpSet
));
S
EpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
S
EpSet
));
mnodeGetMnodeEpSetForPeer
(
epSet
,
true
);
rpcRsp
->
rsp
=
epSet
;
rpcRsp
->
len
=
sizeof
(
S
Rpc
EpSet
);
rpcRsp
->
len
=
sizeof
(
SEpSet
);
mDebug
(
"msg:%p, ahandle:%p type:%s in mpeer queue is redirected, numOfEps:%d inUse:%d"
,
pMsg
,
ahandle
,
taosMsg
[
msgType
],
epSet
->
numOfEps
,
epSet
->
inUse
);
...
...
source/dnode/mnode/src/mondeInt.c
浏览文件 @
84effaab
...
...
@@ -54,7 +54,7 @@ int64_t mnodeGetClusterId() { return tsMint.clusterId; }
EMnStatus
mnodeGetStatus
()
{
return
tsMint
.
state
;
}
void
mnodeSendMsgToDnode
(
struct
S
Rpc
EpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
)
{
void
mnodeSendMsgToDnode
(
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
)
{
(
*
tsMint
.
fp
.
SendMsgToDnode
)(
epSet
,
rpcMsg
);
}
...
...
source/libs/transport/src/rpcMain.c
浏览文件 @
84effaab
...
...
@@ -54,7 +54,7 @@ typedef struct {
char
secret
[
TSDB_KEY_LEN
];
// secret for the link
char
ckey
[
TSDB_KEY_LEN
];
// ciphering key
void
(
*
cfp
)(
SRpcMsg
*
,
S
Rpc
EpSet
*
);
void
(
*
cfp
)(
SRpcMsg
*
,
SEpSet
*
);
int
(
*
afp
)(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
int32_t
refCount
;
...
...
@@ -70,7 +70,7 @@ typedef struct {
typedef
struct
{
SRpcInfo
*
pRpc
;
// associated SRpcInfo
S
RpcEpSet
epSet
;
// ip list provided by app
S
EpSet
epSet
;
// ip list provided by app
void
*
ahandle
;
// handle provided by app
struct
SRpcConn
*
pConn
;
// pConn allocated
char
msgType
;
// message type
...
...
@@ -84,7 +84,7 @@ typedef struct {
int64_t
rid
;
// refId returned by taosAddRef
SRpcMsg
*
pRsp
;
// for synchronous API
tsem_t
*
pSem
;
// for synchronous API
S
RpcEpSet
*
pSet
;
// for synchronous API
S
EpSet
*
pSet
;
// for synchronous API
char
msg
[
0
];
// RpcHead starts from here
}
SRpcReqContext
;
...
...
@@ -383,7 +383,7 @@ void *rpcReallocCont(void *ptr, int contLen) {
return
start
+
sizeof
(
SRpcReqContext
)
+
sizeof
(
SRpcHead
);
}
void
rpcSendRequest
(
void
*
shandle
,
const
S
Rpc
EpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
int64_t
*
pRid
)
{
void
rpcSendRequest
(
void
*
shandle
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
int64_t
*
pRid
)
{
SRpcInfo
*
pRpc
=
(
SRpcInfo
*
)
shandle
;
SRpcReqContext
*
pContext
;
...
...
@@ -486,15 +486,15 @@ void rpcSendResponse(const SRpcMsg *pRsp) {
return
;
}
void
rpcSendRedirectRsp
(
void
*
thandle
,
const
S
Rpc
EpSet
*
pEpSet
)
{
void
rpcSendRedirectRsp
(
void
*
thandle
,
const
SEpSet
*
pEpSet
)
{
SRpcMsg
rpcMsg
;
memset
(
&
rpcMsg
,
0
,
sizeof
(
rpcMsg
));
rpcMsg
.
contLen
=
sizeof
(
S
Rpc
EpSet
);
rpcMsg
.
contLen
=
sizeof
(
SEpSet
);
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
if
(
rpcMsg
.
pCont
==
NULL
)
return
;
memcpy
(
rpcMsg
.
pCont
,
pEpSet
,
sizeof
(
S
Rpc
EpSet
));
memcpy
(
rpcMsg
.
pCont
,
pEpSet
,
sizeof
(
SEpSet
));
rpcMsg
.
code
=
TSDB_CODE_RPC_REDIRECT
;
rpcMsg
.
handle
=
thandle
;
...
...
@@ -516,7 +516,7 @@ int rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo) {
return
0
;
}
void
rpcSendRecv
(
void
*
shandle
,
S
Rpc
EpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
void
rpcSendRecv
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
SRpcReqContext
*
pContext
;
pContext
=
(
SRpcReqContext
*
)
((
char
*
)
pMsg
->
pCont
-
sizeof
(
SRpcHead
)
-
sizeof
(
SRpcReqContext
));
...
...
@@ -794,9 +794,9 @@ static SRpcConn *rpcGetConnObj(SRpcInfo *pRpc, int sid, SRecvInfo *pRecv) {
}
static
SRpcConn
*
rpcSetupConnToServer
(
SRpcReqContext
*
pContext
)
{
SRpcConn
*
pConn
;
SRpcInfo
*
pRpc
=
pContext
->
pRpc
;
S
RpcEpSet
*
pEpSet
=
&
pContext
->
epSet
;
SRpcConn
*
pConn
;
SRpcInfo
*
pRpc
=
pContext
->
pRpc
;
S
EpSet
*
pEpSet
=
&
pContext
->
epSet
;
pConn
=
rpcGetConnFromCache
(
pRpc
->
pCache
,
pEpSet
->
fqdn
[
pEpSet
->
inUse
],
pEpSet
->
port
[
pEpSet
->
inUse
],
pContext
->
connType
);
if
(
pConn
==
NULL
||
pConn
->
user
[
0
]
==
0
)
{
...
...
@@ -926,7 +926,7 @@ static int rpcProcessRspHead(SRpcConn *pConn, SRpcHead *pHead) {
SRpcReqContext
*
pContext
=
pConn
->
pContext
;
if
(
pHead
->
code
==
TSDB_CODE_RPC_REDIRECT
)
{
if
(
rpcContLenFromMsg
(
pHead
->
msgLen
)
<
sizeof
(
S
Rpc
EpSet
))
{
if
(
rpcContLenFromMsg
(
pHead
->
msgLen
)
<
sizeof
(
SEpSet
))
{
// if EpSet is not included in the msg, treat it as NOT_READY
pHead
->
code
=
TSDB_CODE_RPC_NOT_READY
;
}
else
{
...
...
@@ -1126,12 +1126,12 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) {
pContext
->
pConn
=
NULL
;
if
(
pContext
->
pRsp
)
{
// for synchronous API
memcpy
(
pContext
->
pSet
,
&
pContext
->
epSet
,
sizeof
(
S
Rpc
EpSet
));
memcpy
(
pContext
->
pSet
,
&
pContext
->
epSet
,
sizeof
(
SEpSet
));
memcpy
(
pContext
->
pRsp
,
pMsg
,
sizeof
(
SRpcMsg
));
tsem_post
(
pContext
->
pSem
);
}
else
{
// for asynchronous API
S
Rpc
EpSet
*
pEpSet
=
NULL
;
SEpSet
*
pEpSet
=
NULL
;
if
(
pContext
->
epSet
.
inUse
!=
pContext
->
oldInUse
||
pContext
->
redirect
)
pEpSet
=
&
pContext
->
epSet
;
...
...
@@ -1175,7 +1175,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte
if
(
pHead
->
code
==
TSDB_CODE_RPC_REDIRECT
)
{
pContext
->
numOfTry
=
0
;
S
RpcEpSet
*
pEpSet
=
(
SRpc
EpSet
*
)
pHead
->
content
;
S
EpSet
*
pEpSet
=
(
S
EpSet
*
)
pHead
->
content
;
if
(
pEpSet
->
numOfEps
>
0
)
{
memcpy
(
&
pContext
->
epSet
,
pHead
->
content
,
sizeof
(
pContext
->
epSet
));
tDebug
(
"%s, redirect is received, numOfEps:%d inUse:%d"
,
pConn
->
info
,
pContext
->
epSet
.
numOfEps
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录