Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
246ea1df
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
246ea1df
编写于
7月 18, 2020
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify from ip to ep
上级
599df650
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
53 addition
and
64 deletion
+53
-64
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+4
-4
src/client/src/tscServer.c
src/client/src/tscServer.c
+42
-53
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
src/inc/trpc.h
src/inc/trpc.h
+3
-3
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
246ea1df
...
...
@@ -55,8 +55,8 @@ typedef struct STableComInfo {
typedef
struct
SCMCorVgroupInfo
{
int32_t
version
;
int8_t
inUse
;
int8_t
numOf
I
ps
;
S
IpAddr
i
pAddr
[
TSDB_MAX_REPLICA
];
int8_t
numOf
E
ps
;
S
EpAddr
e
pAddr
[
TSDB_MAX_REPLICA
];
}
SCMCorVgroupInfo
;
typedef
struct
STableMeta
{
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
246ea1df
...
...
@@ -143,10 +143,10 @@ struct SSchema tscGetTbnameColumnSchema() {
static
void
tscInitCorVgroupInfo
(
SCMCorVgroupInfo
*
corVgroupInfo
,
SCMVgroupInfo
*
vgroupInfo
)
{
corVgroupInfo
->
version
=
0
;
corVgroupInfo
->
inUse
=
0
;
corVgroupInfo
->
numOf
Ips
=
vgroupInfo
->
numOfI
ps
;
for
(
int32_t
i
=
0
;
i
<
corVgroupInfo
->
numOf
I
ps
;
i
++
)
{
strncpy
(
corVgroupInfo
->
ipAddr
[
i
].
fqdn
,
vgroupInfo
->
i
pAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
corVgroupInfo
->
ipAddr
[
i
].
port
=
vgroupInfo
->
i
pAddr
[
i
].
port
;
corVgroupInfo
->
numOf
Eps
=
vgroupInfo
->
numOfE
ps
;
for
(
int32_t
i
=
0
;
i
<
corVgroupInfo
->
numOf
E
ps
;
i
++
)
{
strncpy
(
corVgroupInfo
->
epAddr
[
i
].
fqdn
,
vgroupInfo
->
e
pAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
corVgroupInfo
->
epAddr
[
i
].
port
=
vgroupInfo
->
e
pAddr
[
i
].
port
;
}
}
STableMeta
*
tscCreateTableMetaFromMsg
(
STableMetaMsg
*
pTableMetaMsg
,
size_t
*
size
)
{
...
...
src/client/src/tscServer.c
浏览文件 @
246ea1df
...
...
@@ -53,64 +53,53 @@ static void tscSetDnodeEpSet(SSqlObj* pSql, SCMVgroupInfo* pVgroupInfo) {
return
;
}
pEp
Lis
t
->
numOfEps
=
pVgroupInfo
->
numOfEps
;
pEp
Se
t
->
numOfEps
=
pVgroupInfo
->
numOfEps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOfEps
;
++
i
)
{
strcpy
(
pEp
Lis
t
->
fqdn
[
i
],
pVgroupInfo
->
epAddr
[
i
].
fqdn
);
pEp
Lis
t
->
port
[
i
]
=
pVgroupInfo
->
epAddr
[
i
].
port
;
strcpy
(
pEp
Se
t
->
fqdn
[
i
],
pVgroupInfo
->
epAddr
[
i
].
fqdn
);
pEp
Se
t
->
port
[
i
]
=
pVgroupInfo
->
epAddr
[
i
].
port
;
}
}
void
tscIpSetCopy
(
SRpcIpSet
*
dst
,
SRpcIpSet
*
src
)
{
dst
->
numOfIps
=
src
->
numOfIps
;
dst
->
inUse
=
src
->
inUse
;
for
(
int32_t
i
=
0
;
i
<
src
->
numOfIps
;
++
i
)
{
dst
->
port
[
i
]
=
src
->
port
[
i
];
strncpy
(
dst
->
fqdn
[
i
],
src
->
fqdn
[
i
],
TSDB_FQDN_LEN
);
}
}
static
void
tscDumpMgmtIpSet
(
SRpcIpSet
*
ipSet
)
{
taosCorBeginRead
(
&
tscMgmtIpSet
.
version
);
SRpcIpSet
*
src
=
&
tscMgmtIpSet
.
ipSet
;
tscIpSetCopy
(
ipSet
,
src
);
taosCorEndRead
(
&
tscMgmtIpSet
.
version
);
static
void
tscDumpMgmtEpSet
(
SRpcEpSet
*
epSet
)
{
taosCorBeginRead
(
&
tscMgmtEpSet
.
version
);
*
epSet
=
tscMgmtEpSet
.
epSet
;
taosCorEndRead
(
&
tscMgmtEpSet
.
version
);
}
static
void
tsc
IpSetHtons
(
SRpcI
pSet
*
s
)
{
for
(
int32_t
i
=
0
;
i
<
s
->
numOf
I
ps
;
i
++
)
{
static
void
tsc
EpSetHtons
(
SRpcE
pSet
*
s
)
{
for
(
int32_t
i
=
0
;
i
<
s
->
numOf
E
ps
;
i
++
)
{
s
->
port
[
i
]
=
htons
(
s
->
port
[
i
]);
}
}
bool
tsc
IpSetIsEqual
(
SRpcIpSet
*
s1
,
SRpcI
pSet
*
s2
)
{
if
(
s1
->
numOf
Ips
!=
s2
->
numOfI
ps
||
s1
->
inUse
!=
s2
->
inUse
)
{
bool
tsc
EpSetIsEqual
(
SRpcEpSet
*
s1
,
SRpcE
pSet
*
s2
)
{
if
(
s1
->
numOf
Eps
!=
s2
->
numOfE
ps
||
s1
->
inUse
!=
s2
->
inUse
)
{
return
false
;
}
for
(
int32_t
i
=
0
;
i
<
s1
->
numOf
I
ps
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
s1
->
numOf
E
ps
;
i
++
)
{
if
(
s1
->
port
[
i
]
!=
s2
->
port
[
i
]
||
strncmp
(
s1
->
fqdn
[
i
],
s2
->
fqdn
[
i
],
TSDB_FQDN_LEN
)
!=
0
)
return
false
;
}
return
true
;
}
void
tscUpdateMgmt
IpList
(
SRpcIpSet
*
pI
pSet
)
{
void
tscUpdateMgmt
EpSet
(
SRpcEpSet
*
pE
pSet
)
{
// no need to update if equal
taosCorBeginWrite
(
&
tscMgmtIpSet
.
version
);
// or copy directly, tscMgmtIpSet.ipSet = *pIpSet
SRpcIpSet
*
mgmtIpSet
=
&
tscMgmtIpSet
.
ipSet
;
tscIpSetCopy
(
mgmtIpSet
,
pIpSet
);
taosCorEndWrite
(
&
tscMgmtIpSet
.
version
);
taosCorBeginWrite
(
&
tscMgmtEpSet
.
version
);
tscMgmtEpSet
.
epSet
=
*
pEpSet
;
taosCorEndWrite
(
&
tscMgmtEpSet
.
version
);
}
static
void
tscDump
IpSetFromVgroupInfo
(
SCMCorVgroupInfo
*
pVgroupInfo
,
SRpcIpSet
*
pI
pSet
)
{
static
void
tscDump
EpSetFromVgroupInfo
(
SCMCorVgroupInfo
*
pVgroupInfo
,
SRpcEpSet
*
pE
pSet
)
{
if
(
pVgroupInfo
==
NULL
)
{
return
;}
taosCorBeginRead
(
&
pVgroupInfo
->
version
);
int8_t
inUse
=
pVgroupInfo
->
inUse
;
p
I
pSet
->
inUse
=
(
inUse
>=
0
&&
inUse
<
TSDB_MAX_REPLICA
)
?
inUse
:
0
;
p
IpSet
->
numOfIps
=
pVgroupInfo
->
numOfI
ps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOf
I
ps
;
++
i
)
{
strncpy
(
p
IpSet
->
fqdn
[
i
],
pVgroupInfo
->
i
pAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
p
IpSet
->
port
[
i
]
=
pVgroupInfo
->
i
pAddr
[
i
].
port
;
p
E
pSet
->
inUse
=
(
inUse
>=
0
&&
inUse
<
TSDB_MAX_REPLICA
)
?
inUse
:
0
;
p
EpSet
->
numOfEps
=
pVgroupInfo
->
numOfE
ps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOf
E
ps
;
++
i
)
{
strncpy
(
p
EpSet
->
fqdn
[
i
],
pVgroupInfo
->
e
pAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
p
EpSet
->
port
[
i
]
=
pVgroupInfo
->
e
pAddr
[
i
].
port
;
}
taosCorEndRead
(
&
pVgroupInfo
->
version
);
}
static
void
tscUpdateVgroupInfo
(
SSqlObj
*
pObj
,
SRpc
IpSet
*
pI
pSet
)
{
static
void
tscUpdateVgroupInfo
(
SSqlObj
*
pObj
,
SRpc
EpSet
*
pE
pSet
)
{
SSqlCmd
*
pCmd
=
&
pObj
->
cmd
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
if
(
pTableMetaInfo
==
NULL
||
pTableMetaInfo
->
pTableMeta
==
NULL
)
{
return
;}
...
...
@@ -130,7 +119,7 @@ void tscPrintMgmtEp() {
SRpcEpSet
dump
;
tscDumpMgmtEpSet
(
&
dump
);
if
(
dump
.
numOfEps
<=
0
)
{
tscError
(
"invalid mnode EP list:%d"
,
dump
.
numOfE
P
s
);
tscError
(
"invalid mnode EP list:%d"
,
dump
.
numOfE
p
s
);
}
else
{
for
(
int
i
=
0
;
i
<
dump
.
numOfEps
;
++
i
)
{
tscDebug
(
"mnode index:%d %s:%d"
,
i
,
dump
.
fqdn
[
i
],
dump
.
port
[
i
]);
...
...
@@ -166,10 +155,10 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
code
==
0
)
{
SCMHeartBeatRsp
*
pRsp
=
(
SCMHeartBeatRsp
*
)
pRes
->
pRsp
;
SRpcEpSet
*
pEpList
=
&
pRsp
->
epLis
t
;
if
(
pEpLis
t
->
numOfEps
>
0
)
{
tscEpSetHtons
(
pEpLis
t
);
tscUpdateMgmtEp
List
(
pEpLis
t
);
SRpcEpSet
*
epSet
=
&
pRsp
->
epSe
t
;
if
(
epSe
t
->
numOfEps
>
0
)
{
tscEpSetHtons
(
epSe
t
);
tscUpdateMgmtEp
Set
(
epSe
t
);
}
pSql
->
pTscObj
->
connId
=
htonl
(
pRsp
->
connId
);
...
...
@@ -242,7 +231,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
// set the mgmt ip list
if
(
pSql
->
cmd
.
command
>=
TSDB_SQL_MGMT
)
{
tscDumpMgmtEpSet
(
&
pSql
->
ep
Lis
t
);
tscDumpMgmtEpSet
(
&
pSql
->
ep
Se
t
);
}
memcpy
(
pMsg
,
pSql
->
cmd
.
payload
,
pSql
->
cmd
.
payloadLen
);
...
...
@@ -296,11 +285,11 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
if
(
pEpSet
)
{
//SRpcEpSet dump;
tscEpSetHtons
(
pEpSet
);
if
(
tscEpSetIsEqual
(
&
pSql
->
ep
Lis
t
,
pEpSet
))
{
if
(
tscEpSetIsEqual
(
&
pSql
->
ep
Se
t
,
pEpSet
))
{
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
tscUpdateVgroupInfo
(
pSql
,
pEpSet
);
}
else
{
tscUpdateMgmtEp
Lis
t
(
pEpSet
);
tscUpdateMgmtEp
Se
t
(
pEpSet
);
}
}
}
...
...
@@ -589,7 +578,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
// pSql->cmd.payloadLen is set during copying data into payload
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
tscDumpEpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
ep
Lis
t
);
tscDumpEpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
ep
Se
t
);
tscDebug
(
"%p build submit msg, vgId:%d numOfTables:%d numberOfEP:%d"
,
pSql
,
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
pSql
->
epSet
.
numOfEps
);
...
...
@@ -631,7 +620,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
}
else
{
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
}
tscSetDnodeEp
Lis
t
(
pSql
,
pVgroupInfo
);
tscSetDnodeEp
Se
t
(
pSql
,
pVgroupInfo
);
if
(
pVgroupInfo
!=
NULL
)
{
pQueryMsg
->
head
.
vgId
=
htonl
(
pVgroupInfo
->
vgId
);
...
...
@@ -654,7 +643,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
index
);
// set the vgroup info
tscSetDnodeEp
Lis
t
(
pSql
,
&
pTableIdList
->
vgInfo
);
tscSetDnodeEp
Se
t
(
pSql
,
&
pTableIdList
->
vgInfo
);
pQueryMsg
->
head
.
vgId
=
htonl
(
pTableIdList
->
vgInfo
.
vgId
);
int32_t
numOfTables
=
taosArrayGetSize
(
pTableIdList
->
itemList
);
...
...
@@ -1200,11 +1189,11 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pShowMsg
->
payloadLen
=
htons
(
pPattern
->
n
);
}
}
else
{
SSQLToken
*
p
I
pAddr
=
&
pShowInfo
->
prefix
;
assert
(
p
IpAddr
->
n
>
0
&&
pI
pAddr
->
type
>
0
);
SSQLToken
*
p
E
pAddr
=
&
pShowInfo
->
prefix
;
assert
(
p
EpAddr
->
n
>
0
&&
pE
pAddr
->
type
>
0
);
strncpy
(
pShowMsg
->
payload
,
p
IpAddr
->
z
,
pI
pAddr
->
n
);
pShowMsg
->
payloadLen
=
htons
(
p
I
pAddr
->
n
);
strncpy
(
pShowMsg
->
payload
,
p
EpAddr
->
z
,
pE
pAddr
->
n
);
pShowMsg
->
payloadLen
=
htons
(
p
E
pAddr
->
n
);
}
pCmd
->
payloadLen
=
sizeof
(
SCMShowMsg
)
+
pShowMsg
->
payloadLen
;
...
...
@@ -1387,7 +1376,7 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
tscDumpEpSetFromVgroupInfo
(
&
pTableMetaInfo
->
pTableMeta
->
corVgroupInfo
,
&
pSql
->
ep
Lis
t
);
tscDumpEpSetFromVgroupInfo
(
&
pTableMetaInfo
->
pTableMeta
->
corVgroupInfo
,
&
pSql
->
ep
Se
t
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2011,9 +2000,9 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
assert
(
len
<=
sizeof
(
pObj
->
db
));
tstrncpy
(
pObj
->
db
,
temp
,
sizeof
(
pObj
->
db
));
if
(
pConnect
->
ep
Lis
t
.
numOfEps
>
0
)
{
tscEpSetHtons
(
&
pConnect
->
ep
Lis
t
);
tscUpdateMgmtEp
List
(
&
pConnect
->
epLis
t
);
if
(
pConnect
->
ep
Se
t
.
numOfEps
>
0
)
{
tscEpSetHtons
(
&
pConnect
->
ep
Se
t
);
tscUpdateMgmtEp
Set
(
&
pConnect
->
epSe
t
);
}
strcpy
(
pObj
->
sversion
,
pConnect
->
serverVersion
);
...
...
src/client/src/tscSql.c
浏览文件 @
246ea1df
...
...
@@ -62,7 +62,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
}
if
(
ip
)
{
if
(
tscSetMgmtEp
Lis
tFromCfg
(
ip
,
NULL
)
<
0
)
return
NULL
;
if
(
tscSetMgmtEp
Se
tFromCfg
(
ip
,
NULL
)
<
0
)
return
NULL
;
if
(
port
)
tscMgmtEpSet
.
epSet
.
port
[
0
]
=
port
;
}
...
...
src/client/src/tscUtil.c
浏览文件 @
246ea1df
...
...
@@ -2145,7 +2145,7 @@ char* strdup_throw(const char* str) {
return
p
;
}
int
tscSetMgmtEp
Lis
tFromCfg
(
const
char
*
first
,
const
char
*
second
)
{
int
tscSetMgmtEp
Se
tFromCfg
(
const
char
*
first
,
const
char
*
second
)
{
// init mgmt ip set
tscMgmtEpSet
.
version
=
0
;
SRpcEpSet
*
mgmtEpSet
=
&
(
tscMgmtEpSet
.
epSet
);
...
...
src/inc/trpc.h
浏览文件 @
246ea1df
...
...
@@ -35,10 +35,10 @@ typedef struct SRpcEpSet {
char
fqdn
[
TSDB_MAX_REPLICA
][
TSDB_FQDN_LEN
];
}
SRpcEpSet
;
typedef
struct
SRpcCor
I
pSet
{
typedef
struct
SRpcCor
E
pSet
{
int32_t
version
;
SRpc
IpSet
i
pSet
;
}
SRpcCor
I
pSet
;
SRpc
EpSet
e
pSet
;
}
SRpcCor
E
pSet
;
typedef
struct
SRpcConnInfo
{
uint32_t
clientIp
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录