Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
b0b119
TDengine
提交
273cc322
TDengine
项目概览
b0b119
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
273cc322
编写于
4月 21, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-148] change ip sets
上级
db21aead
变更
17
显示空白变更内容
内联
并排
Showing
17 changed file
with
96 addition
and
48 deletion
+96
-48
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+19
-19
src/client/src/tscSql.c
src/client/src/tscSql.c
+9
-9
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+6
-6
src/dnode/src/dnodeMClient.c
src/dnode/src/dnodeMClient.c
+6
-0
src/mnode/inc/mgmtMnode.h
src/mnode/inc/mgmtMnode.h
+1
-1
src/mnode/src/mgmtDServer.c
src/mnode/src/mgmtDServer.c
+14
-0
src/mnode/src/mgmtMnode.c
src/mnode/src/mgmtMnode.c
+1
-1
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+4
-3
tests/script/test.sh
tests/script/test.sh
+12
-4
tests/script/unique/mnode/mgmt22.sim
tests/script/unique/mnode/mgmt22.sim
+4
-0
tests/script/unique/mnode/mgmt24.sim
tests/script/unique/mnode/mgmt24.sim
+5
-1
tests/script/unique/mnode/mgmt25.sim
tests/script/unique/mnode/mgmt25.sim
+4
-0
tests/script/unique/mnode/mgmt26.sim
tests/script/unique/mnode/mgmt26.sim
+3
-0
tests/script/unique/mnode/mgmtr2.sim
tests/script/unique/mnode/mgmtr2.sim
+4
-0
tests/script/unique/mnode/secondIp.sim
tests/script/unique/mnode/secondIp.sim
+3
-2
tests/script/unique/mnode/testSuite.sim
tests/script/unique/mnode/testSuite.sim
+0
-1
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
273cc322
...
...
@@ -465,7 +465,7 @@ extern void * tscQhandle;
extern
int
tscKeepConn
[];
extern
int
tsInsertHeadSize
;
extern
int
tscNumOfThreads
;
extern
SRpcIpSet
tscMgmtIp
Lis
t
;
extern
SRpcIpSet
tscMgmtIp
Se
t
;
typedef
void
(
*
__async_cb_func_t
)(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
...
...
src/client/src/tscServer.c
浏览文件 @
273cc322
...
...
@@ -30,7 +30,7 @@
#define TSC_MGMT_VNODE 999
SRpcIpSet
tscMgmtIp
Lis
t
;
SRpcIpSet
tscMgmtIp
Se
t
;
SRpcIpSet
tscDnodeIpSet
;
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
=
{
0
};
...
...
@@ -58,30 +58,30 @@ static void tscSetDnodeIpList(SSqlObj* pSql, STableMeta* pTableMeta) {
}
void
tscPrintMgmtIp
()
{
if
(
tscMgmtIp
Lis
t
.
numOfIps
<=
0
)
{
tscError
(
"invalid mgmt IP list:%d"
,
tscMgmtIp
Lis
t
.
numOfIps
);
if
(
tscMgmtIp
Se
t
.
numOfIps
<=
0
)
{
tscError
(
"invalid mgmt IP list:%d"
,
tscMgmtIp
Se
t
.
numOfIps
);
}
else
{
for
(
int
i
=
0
;
i
<
tscMgmtIp
Lis
t
.
numOfIps
;
++
i
)
{
tscTrace
(
"mgmt index:%d ip:%d"
,
i
,
tscMgmtIp
Lis
t
.
ip
[
i
]);
for
(
int
i
=
0
;
i
<
tscMgmtIp
Se
t
.
numOfIps
;
++
i
)
{
tscTrace
(
"mgmt index:%d ip:%d"
,
i
,
tscMgmtIp
Se
t
.
ip
[
i
]);
}
}
}
void
tscSetMgmtIpListFromCluster
(
SRpcIpSet
*
pIpList
)
{
tscMgmtIp
Lis
t
.
numOfIps
=
pIpList
->
numOfIps
;
tscMgmtIp
Lis
t
.
inUse
=
pIpList
->
inUse
;
tscMgmtIp
Lis
t
.
port
=
htons
(
pIpList
->
port
);
for
(
int32_t
i
=
0
;
i
<
tscMgmtIp
Lis
t
.
numOfIps
;
++
i
)
{
tscMgmtIp
Lis
t
.
ip
[
i
]
=
htonl
(
pIpList
->
ip
[
i
]);
tscMgmtIp
Se
t
.
numOfIps
=
pIpList
->
numOfIps
;
tscMgmtIp
Se
t
.
inUse
=
pIpList
->
inUse
;
tscMgmtIp
Se
t
.
port
=
htons
(
pIpList
->
port
);
for
(
int32_t
i
=
0
;
i
<
tscMgmtIp
Se
t
.
numOfIps
;
++
i
)
{
tscMgmtIp
Se
t
.
ip
[
i
]
=
htonl
(
pIpList
->
ip
[
i
]);
}
}
void
tscSetMgmtIpListFromEdge
()
{
if
(
tscMgmtIp
Lis
t
.
numOfIps
!=
1
)
{
tscMgmtIp
Lis
t
.
numOfIps
=
1
;
tscMgmtIp
Lis
t
.
inUse
=
0
;
tscMgmtIp
Lis
t
.
port
=
tsMnodeShellPort
;
tscMgmtIp
Lis
t
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
if
(
tscMgmtIp
Se
t
.
numOfIps
!=
1
)
{
tscMgmtIp
Se
t
.
numOfIps
=
1
;
tscMgmtIp
Se
t
.
inUse
=
0
;
tscMgmtIp
Se
t
.
port
=
tsMnodeShellPort
;
tscMgmtIp
Se
t
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
tscTrace
(
"edge mgmt IP list:"
);
tscPrintMgmtIp
();
}
...
...
@@ -89,7 +89,7 @@ void tscSetMgmtIpListFromEdge() {
void
tscUpdateIpSet
(
void
*
ahandle
,
SRpcIpSet
*
pIpSet
)
{
tscTrace
(
"mgmt IP list is changed for ufp is called"
);
tsc
SetMgmtIpListFromCluster
(
pIpSet
)
;
tsc
MgmtIpSet
=
*
pIpSet
;
}
void
tscSetMgmtIpList
(
SRpcIpSet
*
pIpList
)
{
...
...
@@ -114,7 +114,7 @@ void tscSetMgmtIpList(SRpcIpSet *pIpList) {
UNUSED_FUNC
static
int32_t
tscGetMgmtConnMaxRetryTimes
()
{
int32_t
factor
=
2
;
return
tscMgmtIp
Lis
t
.
numOfIps
*
factor
;
return
tscMgmtIp
Se
t
.
numOfIps
*
factor
;
}
void
tscProcessHeartBeatRsp
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
...
...
@@ -209,7 +209,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
};
rpcSendRequest
(
pVnodeConn
,
&
pSql
->
ipList
,
&
rpcMsg
);
}
else
{
pSql
->
ipList
=
tscMgmtIp
Lis
t
;
pSql
->
ipList
=
tscMgmtIp
Se
t
;
pSql
->
ipList
.
port
=
tsMnodeShellPort
;
tscTrace
(
"%p msg:%s is sent to server %d"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
],
pSql
->
ipList
.
port
);
...
...
@@ -430,7 +430,7 @@ int tscProcessSql(SSqlObj *pSql) {
return
pSql
->
res
.
code
;
}
}
else
if
(
pSql
->
cmd
.
command
<
TSDB_SQL_LOCAL
)
{
pSql
->
ipList
=
tscMgmtIp
Lis
t
;
pSql
->
ipList
=
tscMgmtIp
Se
t
;
}
else
{
// local handler
return
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
}
...
...
src/client/src/tscSql.c
浏览文件 @
273cc322
...
...
@@ -72,23 +72,23 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
}
if
(
ip
&&
ip
[
0
])
{
tscMgmtIp
Lis
t
.
inUse
=
0
;
tscMgmtIp
Lis
t
.
port
=
tsMnodeShellPort
;
tscMgmtIp
Lis
t
.
numOfIps
=
1
;
tscMgmtIp
Lis
t
.
ip
[
0
]
=
inet_addr
(
ip
);
tscMgmtIp
Se
t
.
inUse
=
0
;
tscMgmtIp
Se
t
.
port
=
tsMnodeShellPort
;
tscMgmtIp
Se
t
.
numOfIps
=
1
;
tscMgmtIp
Se
t
.
ip
[
0
]
=
inet_addr
(
ip
);
if
(
tsMasterIp
[
0
]
&&
strcmp
(
ip
,
tsMasterIp
)
!=
0
)
{
tscMgmtIp
Lis
t
.
numOfIps
=
2
;
tscMgmtIp
Lis
t
.
ip
[
1
]
=
inet_addr
(
tsMasterIp
);
tscMgmtIp
Se
t
.
numOfIps
=
2
;
tscMgmtIp
Se
t
.
ip
[
1
]
=
inet_addr
(
tsMasterIp
);
}
if
(
tsSecondIp
[
0
]
&&
strcmp
(
tsSecondIp
,
tsMasterIp
)
!=
0
)
{
tscMgmtIp
Lis
t
.
numOfIps
=
3
;
tscMgmtIp
Lis
t
.
ip
[
2
]
=
inet_addr
(
tsSecondIp
);
tscMgmtIp
Se
t
.
numOfIps
=
3
;
tscMgmtIp
Se
t
.
ip
[
2
]
=
inet_addr
(
tsSecondIp
);
}
}
tscMgmtIp
Lis
t
.
port
=
port
?
port
:
tsMnodeShellPort
;
tscMgmtIp
Se
t
.
port
=
port
?
port
:
tsMnodeShellPort
;
STscObj
*
pObj
=
(
STscObj
*
)
calloc
(
1
,
sizeof
(
STscObj
));
if
(
NULL
==
pObj
)
{
...
...
src/client/src/tscSystem.c
浏览文件 @
273cc322
...
...
@@ -147,14 +147,14 @@ void taos_init_imp() {
taosInitNote
(
tsNumOfLogLines
/
10
,
1
,
(
char
*
)
"tsc_note"
);
}
tscMgmtIp
Lis
t
.
inUse
=
0
;
tscMgmtIp
Lis
t
.
port
=
tsMnodeShellPort
;
tscMgmtIp
Lis
t
.
numOfIps
=
1
;
tscMgmtIp
Lis
t
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
tscMgmtIp
Se
t
.
inUse
=
0
;
tscMgmtIp
Se
t
.
port
=
tsMnodeShellPort
;
tscMgmtIp
Se
t
.
numOfIps
=
1
;
tscMgmtIp
Se
t
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
if
(
tsSecondIp
[
0
]
&&
strcmp
(
tsSecondIp
,
tsMasterIp
)
!=
0
)
{
tscMgmtIp
Lis
t
.
numOfIps
=
2
;
tscMgmtIp
Lis
t
.
ip
[
1
]
=
inet_addr
(
tsSecondIp
);
tscMgmtIp
Se
t
.
numOfIps
=
2
;
tscMgmtIp
Se
t
.
ip
[
1
]
=
inet_addr
(
tsSecondIp
);
}
tscInitMsgsFp
();
...
...
src/dnode/src/dnodeMClient.c
浏览文件 @
273cc322
...
...
@@ -54,6 +54,11 @@ static SRpcIpSet tsMnodeIpSet = {0};
static
SDMMnodeInfos
tsMnodeInfos
=
{
0
};
static
SDMDnodeCfg
tsDnodeCfg
=
{
0
};
void
dnodeUpdateIpSet
(
void
*
ahandle
,
SRpcIpSet
*
pIpSet
)
{
dTrace
(
"mgmt IP list is changed for ufp is called"
);
tsMnodeIpSet
=
*
pIpSet
;
}
int32_t
dnodeInitMClient
()
{
dnodeReadDnodeCfg
();
tsRebootTime
=
taosGetTimestampSec
();
...
...
@@ -90,6 +95,7 @@ int32_t dnodeInitMClient() {
rpcInit
.
label
=
"DND-MC"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
dnodeProcessRspFromMnode
;
rpcInit
.
ufp
=
dnodeUpdateIpSet
;
rpcInit
.
sessions
=
100
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
2000
;
...
...
src/mnode/inc/mgmtMnode.h
浏览文件 @
273cc322
...
...
@@ -40,7 +40,7 @@ void * mgmtGetNextMnode(void *pNode, struct SMnodeObj **pMnode);
void
mgmtReleaseMnode
(
struct
SMnodeObj
*
pMnode
);
char
*
mgmtGetMnodeRoleStr
();
void
mgmtGetMnodeIp
Lis
t
(
SRpcIpSet
*
ipSet
,
bool
usePublicIp
);
void
mgmtGetMnodeIp
Se
t
(
SRpcIpSet
*
ipSet
,
bool
usePublicIp
);
void
mgmtGetMnodeInfos
(
void
*
mnodes
);
#ifdef __cplusplus
...
...
src/mnode/src/mgmtDServer.c
浏览文件 @
273cc322
...
...
@@ -28,8 +28,10 @@
#include "mgmtLog.h"
#include "mgmtDb.h"
#include "mgmtDServer.h"
#include "mgmtMnode.h"
#include "mgmtProfile.h"
#include "mgmtShell.h"
#include "mgmtSdb.h"
#include "mgmtTable.h"
#include "mgmtVgroup.h"
...
...
@@ -100,6 +102,18 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) {
return
;
}
if
(
!
sdbIsMaster
())
{
SRpcConnInfo
connInfo
;
rpcGetConnInfo
(
rpcMsg
->
handle
,
&
connInfo
);
bool
usePublicIp
=
false
;
SRpcIpSet
ipSet
=
{
0
};
mgmtGetMnodeIpSet
(
&
ipSet
,
usePublicIp
);
mTrace
(
"conn from dnode ip:%s redirect msg"
,
taosIpStr
(
connInfo
.
clientIp
));
rpcSendRedirectRsp
(
rpcMsg
->
handle
,
&
ipSet
);
return
;
}
if
(
mgmtProcessDnodeMsgFp
[
rpcMsg
->
msgType
])
{
SRpcMsg
*
pMsg
=
malloc
(
sizeof
(
SRpcMsg
));
memcpy
(
pMsg
,
rpcMsg
,
sizeof
(
SRpcMsg
));
...
...
src/mnode/src/mgmtMnode.c
浏览文件 @
273cc322
...
...
@@ -171,7 +171,7 @@ char *mgmtGetMnodeRoleStr(int32_t role) {
}
}
void
mgmtGetMnodeIp
Lis
t
(
SRpcIpSet
*
ipSet
,
bool
usePublicIp
)
{
void
mgmtGetMnodeIp
Se
t
(
SRpcIpSet
*
ipSet
,
bool
usePublicIp
)
{
void
*
pNode
=
NULL
;
while
(
1
)
{
SMnodeObj
*
pMnode
=
NULL
;
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
273cc322
...
...
@@ -141,6 +141,7 @@ void mgmtDealyedAddToShellQueue(SQueuedMsg *queuedMsg) {
static
void
mgmtProcessMsgFromShell
(
SRpcMsg
*
rpcMsg
)
{
if
(
rpcMsg
==
NULL
||
rpcMsg
->
pCont
==
NULL
)
{
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_INVALID_MSG_LEN
);
return
;
}
...
...
@@ -150,7 +151,7 @@ static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) {
bool
usePublicIp
=
(
connInfo
.
serverIp
==
tsPublicIpInt
);
SRpcIpSet
ipSet
=
{
0
};
mgmtGetMnodeIp
Lis
t
(
&
ipSet
,
usePublicIp
);
mgmtGetMnodeIp
Se
t
(
&
ipSet
,
usePublicIp
);
mTrace
(
"conn from ip:%s user:%s redirect msg"
,
taosIpStr
(
connInfo
.
clientIp
),
connInfo
.
user
);
rpcSendRedirectRsp
(
rpcMsg
->
handle
,
&
ipSet
);
return
;
...
...
@@ -337,7 +338,7 @@ static void mgmtProcessHeartBeatMsg(SQueuedMsg *pMsg) {
return
;
}
mgmtGetMnodeIp
Lis
t
(
&
pHBRsp
->
ipList
,
pMsg
->
usePublicIp
);
mgmtGetMnodeIp
Se
t
(
&
pHBRsp
->
ipList
,
pMsg
->
usePublicIp
);
/*
* TODO
...
...
@@ -424,7 +425,7 @@ static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) {
pConnectRsp
->
writeAuth
=
pUser
->
writeAuth
;
pConnectRsp
->
superAuth
=
pUser
->
superAuth
;
mgmtGetMnodeIp
Lis
t
(
&
pConnectRsp
->
ipList
,
pMsg
->
usePublicIp
);
mgmtGetMnodeIp
Se
t
(
&
pConnectRsp
->
ipList
,
pMsg
->
usePublicIp
);
connect_over:
rpcRsp
.
code
=
code
;
...
...
tests/script/test.sh
浏览文件 @
273cc322
...
...
@@ -11,7 +11,8 @@ set +e
FILE_NAME
=
RELEASE
=
0
ASYNC
=
0
while
getopts
"f:a"
arg
VALGRIND
=
0
while
getopts
"f:av"
arg
do
case
$arg
in
f
)
...
...
@@ -20,6 +21,9 @@ do
a
)
ASYNC
=
1
;;
v
)
VALGRIND
=
1
;;
?
)
echo
"unknow argument"
;;
...
...
@@ -96,10 +100,14 @@ ulimit -c unlimited
#sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e
if
[
-n
"
$FILE_NAME
"
]
;
then
echo
"ExcuteCmd:"
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
echo
"------------------------------------------------------------------------"
#valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME
if
[
$VALGRIND
-eq
1
]
;
then
echo
valgrind
--tool
=
memcheck
--leak-check
=
full
--show-reachable
=
no
--track-origins
=
yes
--show-leak-kinds
=
all
-v
--workaround-gcc296-bugs
=
yes
--log-file
=
${
CODE_DIR
}
/../script/valgrind.log
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
valgrind
--tool
=
memcheck
--leak-check
=
full
--show-reachable
=
no
--track-origins
=
yes
--show-leak-kinds
=
all
-v
--workaround-gcc296-bugs
=
yes
--log-file
=
${
CODE_DIR
}
/../script/valgrind.log
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
else
echo
"ExcuteCmd:"
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
fi
else
echo
"ExcuteCmd:"
$PROGRAM
-c
$CFG_DIR
-f
basicSuite.sim
echo
"------------------------------------------------------------------------"
...
...
tests/script/unique/mnode/mgmt22.sim
浏览文件 @
273cc322
...
...
@@ -109,3 +109,7 @@ endi
if $data3_3 != null then
goto show7
endi
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
\ No newline at end of file
tests/script/unique/mnode/mgmt24.sim
浏览文件 @
273cc322
...
...
@@ -78,3 +78,7 @@ endi
if $data3_2 != slave then
goto step5
endi
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
\ No newline at end of file
tests/script/unique/mnode/mgmt25.sim
浏览文件 @
273cc322
...
...
@@ -93,3 +93,7 @@ endi
if $dnode3Role != slave then
return -1
endi
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
\ No newline at end of file
tests/script/unique/mnode/mgmt26.sim
浏览文件 @
273cc322
...
...
@@ -123,3 +123,6 @@ if $dnode3Role != slave then
return -1
endi
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
\ No newline at end of file
tests/script/unique/mnode/mgmtr2.sim
浏览文件 @
273cc322
...
...
@@ -83,3 +83,7 @@ endi
if $dnode3Role != null then
return -1
endi
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
\ No newline at end of file
tests/script/unique/mnode/secondIp.sim
浏览文件 @
273cc322
...
...
@@ -38,5 +38,6 @@ if $data4_2 != 4 then
return -1
endi
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
\ No newline at end of file
tests/script/unique/mnode/testSuite.sim
浏览文件 @
273cc322
...
...
@@ -7,4 +7,3 @@ run unique/mnode/mgmt33.sim
run unique/mnode/mgmt34.sim
run unique/mnode/mgmtr2.sim
run unique/mnode/secondIp.sim
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录