Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
546a8cdf
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
546a8cdf
编写于
1月 16, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TBASE-1452 #1136
上级
6d1209ec
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
60 deletion
+40
-60
src/client/src/tscServer.c
src/client/src/tscServer.c
+40
-60
未找到文件。
src/client/src/tscServer.c
浏览文件 @
546a8cdf
...
@@ -53,6 +53,41 @@ void tscPrintMgmtIp() {
...
@@ -53,6 +53,41 @@ void tscPrintMgmtIp() {
}
}
}
}
void
tscSetMgmtIpListFromCluster
(
SIpList
*
pIpList
)
{
tscMgmtIpList
.
numOfIps
=
pIpList
->
numOfIps
;
if
(
memcmp
(
tscMgmtIpList
.
ip
,
pIpList
->
ip
,
pIpList
->
numOfIps
*
4
)
!=
0
)
{
for
(
int
i
=
0
;
i
<
pIpList
->
numOfIps
;
++
i
)
{
tinet_ntoa
(
tscMgmtIpList
.
ipstr
[
i
],
pIpList
->
ip
[
i
]);
tscMgmtIpList
.
ip
[
i
]
=
pIpList
->
ip
[
i
];
}
tscTrace
(
"cluster mgmt IP list:"
);
tscPrintMgmtIp
();
}
}
void
tscSetMgmtIpListFromEdge
()
{
if
(
tscMgmtIpList
.
numOfIps
!=
2
)
{
strcpy
(
tscMgmtIpList
.
ipstr
[
0
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
strcpy
(
tscMgmtIpList
.
ipstr
[
1
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
1
]
=
inet_addr
(
tsMasterIp
);
tscTrace
(
"edge mgmt IP list:"
);
tscPrintMgmtIp
();
}
}
void
tscSetMgmtIpList
(
SIpList
*
pIpList
)
{
/*
* The iplist returned by the cluster edition is the current management nodes
* and the iplist returned by the edge edition is empty
*/
if
(
pIpList
->
numOfIps
!=
0
)
{
tscSetMgmtIpListFromCluster
(
pIpList
);
}
else
{
tscSetMgmtIpListFromEdge
();
}
}
/*
/*
* For each management node, try twice at least in case of poor network situation.
* For each management node, try twice at least in case of poor network situation.
* If the client start to connect to a non-management node from the client, and the first retry may fail due to
* If the client start to connect to a non-management node from the client, and the first retry may fail due to
...
@@ -79,28 +114,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
...
@@ -79,28 +114,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
code
==
0
)
{
if
(
code
==
0
)
{
SHeartBeatRsp
*
pRsp
=
(
SHeartBeatRsp
*
)
pRes
->
pRsp
;
SHeartBeatRsp
*
pRsp
=
(
SHeartBeatRsp
*
)
pRes
->
pRsp
;
SIpList
*
pIpList
=
&
pRsp
->
ipList
;
SIpList
*
pIpList
=
&
pRsp
->
ipList
;
if
(
pIpList
->
numOfIps
!=
0
)
{
tscSetMgmtIpList
(
pIpList
);
//heart beat from cluster edition
tscMgmtIpList
.
numOfIps
=
pIpList
->
numOfIps
;
if
(
memcmp
(
tscMgmtIpList
.
ip
,
pIpList
->
ip
,
pIpList
->
numOfIps
*
4
)
!=
0
)
{
for
(
int
i
=
0
;
i
<
pIpList
->
numOfIps
;
++
i
)
{
tinet_ntoa
(
tscMgmtIpList
.
ipstr
[
i
],
pIpList
->
ip
[
i
]);
tscMgmtIpList
.
ip
[
i
]
=
pIpList
->
ip
[
i
];
}
tscTrace
(
"new mgmt IP list:"
);
tscPrintMgmtIp
();
}
}
else
{
//heart beat from edge edition
if
(
tscMgmtIpList
.
numOfIps
!=
2
)
{
strcpy
(
tscMgmtIpList
.
ipstr
[
0
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
strcpy
(
tscMgmtIpList
.
ipstr
[
1
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
1
]
=
inet_addr
(
tsMasterIp
);
tscTrace
(
"mgmt IP list:"
);
tscPrintMgmtIp
();
}
}
if
(
pRsp
->
killConnection
)
{
if
(
pRsp
->
killConnection
)
{
tscKillConnection
(
pObj
);
tscKillConnection
(
pObj
);
...
@@ -231,7 +245,8 @@ void tscGetConnToVnode(SSqlObj *pSql, uint8_t *pCode) {
...
@@ -231,7 +245,8 @@ void tscGetConnToVnode(SSqlObj *pSql, uint8_t *pCode) {
char
ipstr
[
40
]
=
{
0
};
char
ipstr
[
40
]
=
{
0
};
if
(
pVPeersDesc
[
pSql
->
index
].
ip
==
0
)
{
if
(
pVPeersDesc
[
pSql
->
index
].
ip
==
0
)
{
/*
/*
* Only the stand-alone version, ip is 0, at this time we use mastrIp
* in the edge edition, ip is 0, and at this time we use masterIp instead
* in the cluster edition, ip is vnode ip
*/
*/
//(pSql->index) = (pSql->index + 1) % TSDB_VNODES_SUPPORT;
//(pSql->index) = (pSql->index + 1) % TSDB_VNODES_SUPPORT;
//continue;
//continue;
...
@@ -334,24 +349,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
...
@@ -334,24 +349,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
void
tscProcessMgmtRedirect
(
SSqlObj
*
pSql
,
uint8_t
*
cont
)
{
void
tscProcessMgmtRedirect
(
SSqlObj
*
pSql
,
uint8_t
*
cont
)
{
SIpList
*
pIpList
=
(
SIpList
*
)(
cont
);
SIpList
*
pIpList
=
(
SIpList
*
)(
cont
);
tscMgmtIpList
.
numOfIps
=
pIpList
->
numOfIps
;
tscSetMgmtIpList
(
pIpList
);
if
(
pIpList
->
numOfIps
!=
0
)
{
for
(
int
i
=
0
;
i
<
pIpList
->
numOfIps
;
++
i
)
{
tinet_ntoa
(
tscMgmtIpList
.
ipstr
[
i
],
pIpList
->
ip
[
i
]);
tscMgmtIpList
.
ip
[
i
]
=
pIpList
->
ip
[
i
];
tscTrace
(
"Update mgmt IP, index:%d ip:%s"
,
i
,
tscMgmtIpList
.
ipstr
[
i
]);
}
}
else
{
if
(
tscMgmtIpList
.
numOfIps
!=
2
)
{
strcpy
(
tscMgmtIpList
.
ipstr
[
0
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
strcpy
(
tscMgmtIpList
.
ipstr
[
1
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
1
]
=
inet_addr
(
tsMasterIp
);
tscTrace
(
"Update mgmt IP list:"
);
tscPrintMgmtIp
();
}
}
if
(
pSql
->
cmd
.
command
<
TSDB_SQL_READ
)
{
if
(
pSql
->
cmd
.
command
<
TSDB_SQL_READ
)
{
tsMasterIndex
=
0
;
tsMasterIndex
=
0
;
...
@@ -3393,25 +3391,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
...
@@ -3393,25 +3391,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
SIpList
*
pIpList
;
SIpList
*
pIpList
;
char
*
rsp
=
pRes
->
pRsp
+
sizeof
(
SConnectRsp
);
char
*
rsp
=
pRes
->
pRsp
+
sizeof
(
SConnectRsp
);
pIpList
=
(
SIpList
*
)
rsp
;
pIpList
=
(
SIpList
*
)
rsp
;
tscSetMgmtIpList
(
pIpList
);
if
(
pIpList
->
numOfIps
!=
0
)
{
tscMgmtIpList
.
numOfIps
=
pIpList
->
numOfIps
;
for
(
int
i
=
0
;
i
<
pIpList
->
numOfIps
;
++
i
)
{
tinet_ntoa
(
tscMgmtIpList
.
ipstr
[
i
],
pIpList
->
ip
[
i
]);
tscMgmtIpList
.
ip
[
i
]
=
pIpList
->
ip
[
i
];
}
}
else
{
if
(
tscMgmtIpList
.
numOfIps
!=
2
)
{
strcpy
(
tscMgmtIpList
.
ipstr
[
0
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
strcpy
(
tscMgmtIpList
.
ipstr
[
1
],
tsMasterIp
);
tscMgmtIpList
.
ip
[
1
]
=
inet_addr
(
tsMasterIp
);
}
}
rsp
+=
sizeof
(
SIpList
)
+
sizeof
(
int32_t
)
*
pIpList
->
numOfIps
;
tscPrintMgmtIp
();
strcpy
(
pObj
->
sversion
,
pConnect
->
version
);
strcpy
(
pObj
->
sversion
,
pConnect
->
version
);
pObj
->
writeAuth
=
pConnect
->
writeAuth
;
pObj
->
writeAuth
=
pConnect
->
writeAuth
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录