Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7b0088b5
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,发现更多精彩内容 >>
未验证
提交
7b0088b5
编写于
1月 16, 2020
作者:
H
haojun Liao
提交者:
GitHub
1月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1141 from taosdata/feature/slguan
TBASE-1452 #1136
上级
faf5fc1f
733cb473
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
41 addition
and
60 deletion
+41
-60
src/client/src/tscServer.c
src/client/src/tscServer.c
+41
-60
未找到文件。
src/client/src/tscServer.c
浏览文件 @
7b0088b5
...
...
@@ -53,6 +53,42 @@ 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
)
{
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.
* If the client start to connect to a non-management node from the client, and the first retry may fail due to
...
...
@@ -79,28 +115,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
code
==
0
)
{
SHeartBeatRsp
*
pRsp
=
(
SHeartBeatRsp
*
)
pRes
->
pRsp
;
SIpList
*
pIpList
=
&
pRsp
->
ipList
;
if
(
pIpList
->
numOfIps
!=
0
)
{
//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
();
}
}
tscSetMgmtIpList
(
pIpList
);
if
(
pRsp
->
killConnection
)
{
tscKillConnection
(
pObj
);
...
...
@@ -231,7 +246,8 @@ void tscGetConnToVnode(SSqlObj *pSql, uint8_t *pCode) {
char
ipstr
[
40
]
=
{
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;
//continue;
...
...
@@ -334,24 +350,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
void
tscProcessMgmtRedirect
(
SSqlObj
*
pSql
,
uint8_t
*
cont
)
{
SIpList
*
pIpList
=
(
SIpList
*
)(
cont
);
tscMgmtIpList
.
numOfIps
=
pIpList
->
numOfIps
;
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
();
}
}
tscSetMgmtIpList
(
pIpList
);
if
(
pSql
->
cmd
.
command
<
TSDB_SQL_READ
)
{
tsMasterIndex
=
0
;
...
...
@@ -3393,25 +3392,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
SIpList
*
pIpList
;
char
*
rsp
=
pRes
->
pRsp
+
sizeof
(
SConnectRsp
);
pIpList
=
(
SIpList
*
)
rsp
;
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
();
tscSetMgmtIpList
(
pIpList
);
strcpy
(
pObj
->
sversion
,
pConnect
->
version
);
pObj
->
writeAuth
=
pConnect
->
writeAuth
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录