Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2bf71e71
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看板
提交
2bf71e71
编写于
12月 10, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TBASE-1241]
上级
fe4fb353
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
136 addition
and
66 deletion
+136
-66
src/client/src/tscServer.c
src/client/src/tscServer.c
+5
-0
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-29
src/inc/taosmsg.h
src/inc/taosmsg.h
+4
-0
src/inc/tglobalcfg.h
src/inc/tglobalcfg.h
+2
-0
src/inc/tutil.h
src/inc/tutil.h
+2
-0
src/system/detail/inc/mgmt.h
src/system/detail/inc/mgmt.h
+3
-1
src/system/detail/src/dnodeService.c
src/system/detail/src/dnodeService.c
+2
-6
src/system/detail/src/mgmtMeter.c
src/system/detail/src/mgmtMeter.c
+13
-9
src/system/detail/src/mgmtShell.c
src/system/detail/src/mgmtShell.c
+49
-12
src/system/detail/src/mgmtVgroup.c
src/system/detail/src/mgmtVgroup.c
+10
-6
src/util/src/tglobalcfg.c
src/util/src/tglobalcfg.c
+10
-0
src/util/src/tutil.c
src/util/src/tutil.c
+33
-3
未找到文件。
src/client/src/tscServer.c
浏览文件 @
2bf71e71
...
@@ -2642,6 +2642,11 @@ int tscBuildConnectMsg(SSqlObj *pSql) {
...
@@ -2642,6 +2642,11 @@ int tscBuildConnectMsg(SSqlObj *pSql) {
db
=
(
db
==
NULL
)
?
pObj
->
db
:
db
+
1
;
db
=
(
db
==
NULL
)
?
pObj
->
db
:
db
+
1
;
strcpy
(
pConnect
->
db
,
db
);
strcpy
(
pConnect
->
db
,
db
);
strcpy
(
pConnect
->
clientVersion
,
version
);
pConnect
->
usePublicIp
=
(
int8_t
)
tsUsePublicIp
;
pConnect
->
isCluster
=
(
int8_t
)
tsIsCluster
;
memset
(
pConnect
->
reserved
,
0
,
sizeof
(
pConnect
->
reserved
));
pMsg
+=
sizeof
(
SConnectMsg
);
pMsg
+=
sizeof
(
SConnectMsg
);
msgLen
=
pMsg
-
pStart
;
msgLen
=
pMsg
-
pStart
;
...
...
src/client/src/tscSql.c
浏览文件 @
2bf71e71
...
@@ -165,38 +165,12 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
...
@@ -165,38 +165,12 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
// version compare only requires the first 3 segments of the version string
// version compare only requires the first 3 segments of the version string
int32_t
comparedSegments
=
3
;
int
code
=
taosCheckVersion
(
version
,
taos_get_server_info
(
taos
),
3
);
char
client_version
[
64
]
=
{
0
};
if
(
code
!=
0
)
{
char
server_version
[
64
]
=
{
0
};
pObj
->
pSql
->
res
.
code
=
code
;
int
clientVersionNumber
[
4
]
=
{
0
};
int
serverVersionNumber
[
4
]
=
{
0
};
strcpy
(
client_version
,
version
);
strcpy
(
server_version
,
taos_get_server_info
(
taos
));
if
(
!
taosGetVersionNumber
(
client_version
,
clientVersionNumber
))
{
tscError
(
"taos:%p, invalid client version:%s"
,
taos
,
client_version
);
pObj
->
pSql
->
res
.
code
=
TSDB_CODE_INVALID_CLIENT_VERSION
;
taos_close
(
taos
);
taos_close
(
taos
);
return
NULL
;
return
NULL
;
}
}
if
(
!
taosGetVersionNumber
(
server_version
,
serverVersionNumber
))
{
tscError
(
"taos:%p, invalid server version:%s"
,
taos
,
server_version
);
pObj
->
pSql
->
res
.
code
=
TSDB_CODE_INVALID_CLIENT_VERSION
;
taos_close
(
taos
);
return
NULL
;
}
for
(
int32_t
i
=
0
;
i
<
comparedSegments
;
++
i
)
{
if
(
clientVersionNumber
[
i
]
!=
serverVersionNumber
[
i
])
{
tscError
(
"taos:%p, the %d-th number of server version:%s not matched with client version:%s, close connection"
,
taos
,
i
,
server_version
,
version
);
pObj
->
pSql
->
res
.
code
=
TSDB_CODE_INVALID_CLIENT_VERSION
;
taos_close
(
taos
);
return
NULL
;
}
}
}
}
return
taos
;
return
taos
;
...
...
src/inc/taosmsg.h
浏览文件 @
2bf71e71
...
@@ -350,7 +350,11 @@ typedef struct {
...
@@ -350,7 +350,11 @@ typedef struct {
}
SAlterTableMsg
;
}
SAlterTableMsg
;
typedef
struct
{
typedef
struct
{
char
clientVersion
[
TSDB_VERSION_LEN
];
char
db
[
TSDB_METER_ID_LEN
];
char
db
[
TSDB_METER_ID_LEN
];
int8_t
usePublicIp
;
int8_t
isCluster
;
int8_t
reserved
[
14
];
}
SConnectMsg
;
}
SConnectMsg
;
typedef
struct
{
typedef
struct
{
...
...
src/inc/tglobalcfg.h
浏览文件 @
2bf71e71
...
@@ -151,6 +151,8 @@ extern int tsAdminRowLimit;
...
@@ -151,6 +151,8 @@ extern int tsAdminRowLimit;
extern
int
tsTscEnableRecordSql
;
extern
int
tsTscEnableRecordSql
;
extern
int
tsAnyIp
;
extern
int
tsAnyIp
;
extern
int
tsUsePublicIp
;
extern
int
tsIsCluster
;
extern
char
tsMonitorDbName
[];
extern
char
tsMonitorDbName
[];
extern
char
tsInternalPass
[];
extern
char
tsInternalPass
[];
...
...
src/inc/tutil.h
浏览文件 @
2bf71e71
...
@@ -187,6 +187,8 @@ static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, unsigned int inLen, cha
...
@@ -187,6 +187,8 @@ static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, unsigned int inLen, cha
memcpy
(
target
,
context
.
digest
,
TSDB_KEY_LEN
);
memcpy
(
target
,
context
.
digest
,
TSDB_KEY_LEN
);
}
}
int
taosCheckVersion
(
char
*
input_client_version
,
char
*
input_server_version
,
int
compared_segments
);
char
*
taosIpStr
(
uint32_t
ipInt
);
char
*
taosIpStr
(
uint32_t
ipInt
);
#define TAOS_ALLOC_MODE_DEFAULT 0
#define TAOS_ALLOC_MODE_DEFAULT 0
...
...
src/system/detail/inc/mgmt.h
浏览文件 @
2bf71e71
...
@@ -222,6 +222,8 @@ typedef struct _connObj {
...
@@ -222,6 +222,8 @@ typedef struct _connObj {
char
superAuth
:
1
;
// super user flag
char
superAuth
:
1
;
// super user flag
char
writeAuth
:
1
;
// write flag
char
writeAuth
:
1
;
// write flag
char
killConnection
:
1
;
// kill the connection flag
char
killConnection
:
1
;
// kill the connection flag
char
usePublicIp
:
1
;
// if the connection request is publicIp
char
reserved
:
4
;
uint32_t
queryId
;
// query ID to be killed
uint32_t
queryId
;
// query ID to be killed
uint32_t
streamId
;
// stream ID to be killed
uint32_t
streamId
;
// stream ID to be killed
uint32_t
ip
;
// shell IP
uint32_t
ip
;
// shell IP
...
@@ -343,7 +345,7 @@ void mgmtCleanUpVgroups();
...
@@ -343,7 +345,7 @@ void mgmtCleanUpVgroups();
int
mgmtInitMeters
();
int
mgmtInitMeters
();
STabObj
*
mgmtGetMeter
(
char
*
meterId
);
STabObj
*
mgmtGetMeter
(
char
*
meterId
);
STabObj
*
mgmtGetMeterInfo
(
char
*
src
,
char
*
tags
[]);
STabObj
*
mgmtGetMeterInfo
(
char
*
src
,
char
*
tags
[]);
int
mgmtRetrieveMetricMeta
(
void
*
thandle
,
char
**
pStart
,
SMetricMetaMsg
*
pInfo
);
int
mgmtRetrieveMetricMeta
(
SConnObj
*
pConn
,
char
**
pStart
,
SMetricMetaMsg
*
pInfo
);
int
mgmtCreateMeter
(
SDbObj
*
pDb
,
SCreateTableMsg
*
pCreate
);
int
mgmtCreateMeter
(
SDbObj
*
pDb
,
SCreateTableMsg
*
pCreate
);
int
mgmtDropMeter
(
SDbObj
*
pDb
,
char
*
meterId
,
int
ignore
);
int
mgmtDropMeter
(
SDbObj
*
pDb
,
char
*
meterId
,
int
ignore
);
int
mgmtAlterMeter
(
SDbObj
*
pDb
,
SAlterTableMsg
*
pAlter
);
int
mgmtAlterMeter
(
SDbObj
*
pDb
,
SAlterTableMsg
*
pAlter
);
...
...
src/system/detail/src/dnodeService.c
浏览文件 @
2bf71e71
...
@@ -55,12 +55,8 @@ int main(int argc, char *argv[]) {
...
@@ -55,12 +55,8 @@ int main(int argc, char *argv[]) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
else
if
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)
{
#ifdef CLUSTER
char
*
versionStr
=
tsIsCluster
?
"enterprise"
:
"community"
;
printf
(
"enterprise version: %s compatible_version: %s
\n
"
,
version
,
compatible_version
);
printf
(
"%s version: %s compatible_version: %s
\n
"
,
versionStr
,
version
,
compatible_version
);
#else
printf
(
"community version: %s compatible_version: %s
\n
"
,
version
,
compatible_version
);
#endif
printf
(
"gitinfo: %s
\n
"
,
gitinfo
);
printf
(
"gitinfo: %s
\n
"
,
gitinfo
);
printf
(
"buildinfo: %s
\n
"
,
buildinfo
);
printf
(
"buildinfo: %s
\n
"
,
buildinfo
);
return
0
;
return
0
;
...
...
src/system/detail/src/mgmtMeter.c
浏览文件 @
2bf71e71
...
@@ -987,7 +987,7 @@ SSchema *mgmtGetMeterSchema(STabObj *pMeter) {
...
@@ -987,7 +987,7 @@ SSchema *mgmtGetMeterSchema(STabObj *pMeter) {
/*
/*
* serialize SVnodeSidList to byte array
* serialize SVnodeSidList to byte array
*/
*/
static
char
*
mgmtBuildMetricMetaMsg
(
STabObj
*
pMeter
,
int32_t
*
ovgId
,
SVnodeSidList
**
pList
,
SMetricMeta
*
pMeta
,
static
char
*
mgmtBuildMetricMetaMsg
(
S
ConnObj
*
pConn
,
S
TabObj
*
pMeter
,
int32_t
*
ovgId
,
SVnodeSidList
**
pList
,
SMetricMeta
*
pMeta
,
int32_t
tagLen
,
int16_t
numOfTags
,
int16_t
*
tagsId
,
int32_t
maxNumOfMeters
,
int32_t
tagLen
,
int16_t
numOfTags
,
int16_t
*
tagsId
,
int32_t
maxNumOfMeters
,
char
*
pMsg
)
{
char
*
pMsg
)
{
if
(
pMeter
->
gid
.
vgId
!=
*
ovgId
||
((
*
pList
)
!=
NULL
&&
(
*
pList
)
->
numOfSids
>=
maxNumOfMeters
))
{
if
(
pMeter
->
gid
.
vgId
!=
*
ovgId
||
((
*
pList
)
!=
NULL
&&
(
*
pList
)
->
numOfSids
>=
maxNumOfMeters
))
{
...
@@ -1004,8 +1004,13 @@ static char *mgmtBuildMetricMetaMsg(STabObj *pMeter, int32_t *ovgId, SVnodeSidLi
...
@@ -1004,8 +1004,13 @@ static char *mgmtBuildMetricMetaMsg(STabObj *pMeter, int32_t *ovgId, SVnodeSidLi
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pMeter
->
gid
.
vgId
);
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pMeter
->
gid
.
vgId
);
for
(
int
i
=
0
;
i
<
TSDB_VNODES_SUPPORT
;
++
i
)
{
for
(
int
i
=
0
;
i
<
TSDB_VNODES_SUPPORT
;
++
i
)
{
(
*
pList
)
->
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
publicIp
;
if
(
pConn
->
usePublicIp
)
{
(
*
pList
)
->
vpeerDesc
[
i
].
vnode
=
pVgroup
->
vnodeGid
[
i
].
vnode
;
(
*
pList
)
->
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
publicIp
;
(
*
pList
)
->
vpeerDesc
[
i
].
vnode
=
pVgroup
->
vnodeGid
[
i
].
vnode
;
}
else
{
(
*
pList
)
->
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
ip
;
(
*
pList
)
->
vpeerDesc
[
i
].
vnode
=
pVgroup
->
vnodeGid
[
i
].
vnode
;
}
}
}
pMsg
+=
sizeof
(
SVnodeSidList
);
pMsg
+=
sizeof
(
SVnodeSidList
);
...
@@ -1102,10 +1107,10 @@ static SMetricMetaElemMsg *doConvertMetricMetaMsg(SMetricMetaMsg *pMetricMetaMsg
...
@@ -1102,10 +1107,10 @@ static SMetricMetaElemMsg *doConvertMetricMetaMsg(SMetricMetaMsg *pMetricMetaMsg
return
pElem
;
return
pElem
;
}
}
static
int32_t
mgmtBuildMetricMetaRspMsg
(
void
*
thandle
,
SMetricMetaMsg
*
pMetricMetaMsg
,
tQueryResultset
*
pResult
,
static
int32_t
mgmtBuildMetricMetaRspMsg
(
SConnObj
*
pConn
,
SMetricMetaMsg
*
pMetricMetaMsg
,
tQueryResultset
*
pResult
,
char
**
pStart
,
int32_t
*
tagLen
,
int32_t
rspMsgSize
,
int32_t
maxTablePerVnode
,
char
**
pStart
,
int32_t
*
tagLen
,
int32_t
rspMsgSize
,
int32_t
maxTablePerVnode
,
int32_t
code
)
{
int32_t
code
)
{
*
pStart
=
taosBuildRspMsgWithSize
(
thandle
,
TSDB_MSG_TYPE_METRIC_META_RSP
,
rspMsgSize
);
*
pStart
=
taosBuildRspMsgWithSize
(
pConn
->
thandle
,
TSDB_MSG_TYPE_METRIC_META_RSP
,
rspMsgSize
);
if
(
*
pStart
==
NULL
)
{
if
(
*
pStart
==
NULL
)
{
return
0
;
return
0
;
}
}
...
@@ -1143,7 +1148,7 @@ static int32_t mgmtBuildMetricMetaRspMsg(void *thandle, SMetricMetaMsg *pMetricM
...
@@ -1143,7 +1148,7 @@ static int32_t mgmtBuildMetricMetaRspMsg(void *thandle, SMetricMetaMsg *pMetricM
for
(
int32_t
i
=
0
;
i
<
pResult
[
j
].
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pResult
[
j
].
num
;
++
i
)
{
STabObj
*
pMeter
=
pResult
[
j
].
pRes
[
i
];
STabObj
*
pMeter
=
pResult
[
j
].
pRes
[
i
];
pMsg
=
mgmtBuildMetricMetaMsg
(
pMeter
,
&
ovgId
,
&
pList
,
pMeta
,
tagLen
[
j
],
pElem
->
numOfTags
,
pElem
->
tagCols
,
pMsg
=
mgmtBuildMetricMetaMsg
(
p
Conn
,
p
Meter
,
&
ovgId
,
&
pList
,
pMeta
,
tagLen
[
j
],
pElem
->
numOfTags
,
pElem
->
tagCols
,
maxTablePerVnode
,
pMsg
);
maxTablePerVnode
,
pMsg
);
}
}
...
@@ -1159,7 +1164,7 @@ static int32_t mgmtBuildMetricMetaRspMsg(void *thandle, SMetricMetaMsg *pMetricM
...
@@ -1159,7 +1164,7 @@ static int32_t mgmtBuildMetricMetaRspMsg(void *thandle, SMetricMetaMsg *pMetricM
return
msgLen
;
return
msgLen
;
}
}
int
mgmtRetrieveMetricMeta
(
void
*
thandle
,
char
**
pStart
,
SMetricMetaMsg
*
pMetricMetaMsg
)
{
int
mgmtRetrieveMetricMeta
(
SConnObj
*
pConn
,
char
**
pStart
,
SMetricMetaMsg
*
pMetricMetaMsg
)
{
/*
/*
* naive method: Do not limit the maximum number of meters in each
* naive method: Do not limit the maximum number of meters in each
* vnode(subquery), split the result according to vnodes
* vnode(subquery), split the result according to vnodes
...
@@ -1233,8 +1238,7 @@ int mgmtRetrieveMetricMeta(void *thandle, char **pStart, SMetricMetaMsg *pMetric
...
@@ -1233,8 +1238,7 @@ int mgmtRetrieveMetricMeta(void *thandle, char **pStart, SMetricMetaMsg *pMetric
msgLen
=
512
;
msgLen
=
512
;
}
}
msgLen
=
mgmtBuildMetricMetaRspMsg
(
thandle
,
pMetricMetaMsg
,
result
,
pStart
,
tagLen
,
msgLen
,
maxMetersPerVNodeForQuery
,
msgLen
=
mgmtBuildMetricMetaRspMsg
(
pConn
,
pMetricMetaMsg
,
result
,
pStart
,
tagLen
,
msgLen
,
maxMetersPerVNodeForQuery
,
ret
);
ret
);
for
(
int32_t
i
=
0
;
i
<
pMetricMetaMsg
->
numOfMeters
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pMetricMetaMsg
->
numOfMeters
;
++
i
)
{
tQueryResultClean
(
&
result
[
i
]);
tQueryResultClean
(
&
result
[
i
]);
...
...
src/system/detail/src/mgmtShell.c
浏览文件 @
2bf71e71
...
@@ -314,8 +314,13 @@ int mgmtProcessMeterMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) {
...
@@ -314,8 +314,13 @@ int mgmtProcessMeterMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) {
goto
_exit_code
;
goto
_exit_code
;
}
}
for
(
int
i
=
0
;
i
<
TSDB_VNODES_SUPPORT
;
++
i
)
{
for
(
int
i
=
0
;
i
<
TSDB_VNODES_SUPPORT
;
++
i
)
{
pMeta
->
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
publicIp
;
if
(
pConn
->
usePublicIp
)
{
pMeta
->
vpeerDesc
[
i
].
vnode
=
htonl
(
pVgroup
->
vnodeGid
[
i
].
vnode
);
pMeta
->
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
publicIp
;
pMeta
->
vpeerDesc
[
i
].
vnode
=
htonl
(
pVgroup
->
vnodeGid
[
i
].
vnode
);
}
else
{
pMeta
->
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
ip
;
pMeta
->
vpeerDesc
[
i
].
vnode
=
htonl
(
pVgroup
->
vnodeGid
[
i
].
vnode
);
}
}
}
}
}
}
}
...
@@ -453,8 +458,13 @@ int mgmtProcessMultiMeterMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) {
...
@@ -453,8 +458,13 @@ int mgmtProcessMultiMeterMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) {
}
}
for
(
int
i
=
0
;
i
<
TSDB_VNODES_SUPPORT
;
++
i
)
{
for
(
int
i
=
0
;
i
<
TSDB_VNODES_SUPPORT
;
++
i
)
{
pMeta
->
meta
.
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
publicIp
;
if
(
pConn
->
usePublicIp
)
{
pMeta
->
meta
.
vpeerDesc
[
i
].
vnode
=
htonl
(
pVgroup
->
vnodeGid
[
i
].
vnode
);
pMeta
->
meta
.
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
publicIp
;
pMeta
->
meta
.
vpeerDesc
[
i
].
vnode
=
htonl
(
pVgroup
->
vnodeGid
[
i
].
vnode
);
}
else
{
pMeta
->
meta
.
vpeerDesc
[
i
].
ip
=
pVgroup
->
vnodeGid
[
i
].
ip
;
pMeta
->
meta
.
vpeerDesc
[
i
].
vnode
=
htonl
(
pVgroup
->
vnodeGid
[
i
].
vnode
);
}
}
}
}
}
}
}
...
@@ -526,7 +536,7 @@ int mgmtProcessMetricMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) {
...
@@ -526,7 +536,7 @@ int mgmtProcessMetricMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) {
msgLen
=
pMsg
-
pStart
;
msgLen
=
pMsg
-
pStart
;
}
else
{
}
else
{
msgLen
=
mgmtRetrieveMetricMeta
(
pConn
->
thandle
,
&
pStart
,
pMetricMetaMsg
);
msgLen
=
mgmtRetrieveMetricMeta
(
pConn
,
&
pStart
,
pMetricMetaMsg
);
if
(
msgLen
<=
0
)
{
if
(
msgLen
<=
0
)
{
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_METRIC_META_RSP
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_METRIC_META_RSP
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
return
0
;
return
0
;
...
@@ -1099,10 +1109,17 @@ int mgmtProcessHeartBeatMsg(char *cont, int contLen, SConnObj *pConn) {
...
@@ -1099,10 +1109,17 @@ int mgmtProcessHeartBeatMsg(char *cont, int contLen, SConnObj *pConn) {
pHBRsp
->
killConnection
=
pConn
->
killConnection
;
pHBRsp
->
killConnection
=
pConn
->
killConnection
;
#ifdef CLUSTER
#ifdef CLUSTER
int
size
=
pSdbPublicIpList
->
numOfIps
*
4
;
if
(
pConn
->
usePublicIp
)
{
pHBRsp
->
ipList
.
numOfIps
=
pSdbPublicIpList
->
numOfIps
;
int
size
=
pSdbPublicIpList
->
numOfIps
*
4
;
memcpy
(
pHBRsp
->
ipList
.
ip
,
pSdbPublicIpList
->
ip
,
size
);
pHBRsp
->
ipList
.
numOfIps
=
pSdbPublicIpList
->
numOfIps
;
pMsg
+=
sizeof
(
SHeartBeatRsp
)
+
size
;
memcpy
(
pHBRsp
->
ipList
.
ip
,
pSdbPublicIpList
->
ip
,
size
);
pMsg
+=
sizeof
(
SHeartBeatRsp
)
+
size
;
}
else
{
int
size
=
pSdbIpList
->
numOfIps
*
4
;
pHBRsp
->
ipList
.
numOfIps
=
pSdbIpList
->
numOfIps
;
memcpy
(
pHBRsp
->
ipList
.
ip
,
pSdbIpList
->
ip
,
size
);
pMsg
+=
sizeof
(
SHeartBeatRsp
)
+
size
;
}
#else
#else
pMsg
+=
sizeof
(
SHeartBeatRsp
);
pMsg
+=
sizeof
(
SHeartBeatRsp
);
#endif
#endif
...
@@ -1178,6 +1195,18 @@ int mgmtProcessConnectMsg(char *pMsg, int msgLen, SConnObj *pConn) {
...
@@ -1178,6 +1195,18 @@ int mgmtProcessConnectMsg(char *pMsg, int msgLen, SConnObj *pConn) {
pAcct
=
mgmtGetAcct
(
pUser
->
acct
);
pAcct
=
mgmtGetAcct
(
pUser
->
acct
);
code
=
taosCheckVersion
(
pConnectMsg
->
clientVersion
,
version
,
3
);
if
(
code
!=
0
)
{
mError
(
"invalid client version:%s"
,
pConnectMsg
->
clientVersion
);
goto
_rsp
;
}
if
(
pConnectMsg
->
isCluster
!=
tsIsCluster
)
{
mError
(
"Cluster Edition and lite Edition cannot be interconnected, client:%d server:%d"
,
pConnectMsg
->
isCluster
,
tsIsCluster
);
code
=
TSDB_CODE_INVALID_CLIENT_VERSION
;
goto
_rsp
;
}
if
(
pConnectMsg
->
db
[
0
])
{
if
(
pConnectMsg
->
db
[
0
])
{
sprintf
(
dbName
,
"%x%s%s"
,
pAcct
->
acctId
,
TS_PATH_DELIMITER
,
pConnectMsg
->
db
);
sprintf
(
dbName
,
"%x%s%s"
,
pAcct
->
acctId
,
TS_PATH_DELIMITER
,
pConnectMsg
->
db
);
pDb
=
mgmtGetDb
(
dbName
);
pDb
=
mgmtGetDb
(
dbName
);
...
@@ -1217,9 +1246,17 @@ _rsp:
...
@@ -1217,9 +1246,17 @@ _rsp:
pMsg
+=
sizeof
(
SConnectRsp
);
pMsg
+=
sizeof
(
SConnectRsp
);
#ifdef CLUSTER
#ifdef CLUSTER
int
size
=
pSdbPublicIpList
->
numOfIps
*
4
+
sizeof
(
SIpList
);
if
(
pConnectMsg
->
usePublicIp
)
{
memcpy
(
pMsg
,
pSdbPublicIpList
,
size
);
pConn
->
usePublicIp
=
1
;
pMsg
+=
size
;
int
size
=
pSdbPublicIpList
->
numOfIps
*
4
+
sizeof
(
SIpList
);
memcpy
(
pMsg
,
pSdbPublicIpList
,
size
);
pMsg
+=
size
;
}
else
{
int
size
=
pSdbIpList
->
numOfIps
*
4
+
sizeof
(
SIpList
);
memcpy
(
pMsg
,
pSdbIpList
,
size
);
pMsg
+=
size
;
}
#endif
#endif
// set the time resolution: millisecond or microsecond
// set the time resolution: millisecond or microsecond
...
...
src/system/detail/src/mgmtVgroup.c
浏览文件 @
2bf71e71
...
@@ -102,13 +102,17 @@ int mgmtInitVgroups() {
...
@@ -102,13 +102,17 @@ int mgmtInitVgroups() {
}
}
taosIdPoolReinit
(
pVgroup
->
idPool
);
taosIdPoolReinit
(
pVgroup
->
idPool
);
#ifdef CLUSTER
if
(
pVgroup
->
vnodeGid
[
0
].
publicIp
==
0
)
{
if
(
tsIsCluster
)
{
pVgroup
->
vnodeGid
[
0
].
publicIp
=
inet_addr
(
tsPublicIp
);
/*
pVgroup
->
vnodeGid
[
0
].
ip
=
inet_addr
(
tsPrivateIp
);
* Upgrade from open source version to cluster version for the first time
sdbUpdateRow
(
vgSdb
,
pVgroup
,
tsVgUpdateSize
,
1
);
*/
if
(
pVgroup
->
vnodeGid
[
0
].
publicIp
==
0
)
{
pVgroup
->
vnodeGid
[
0
].
publicIp
=
inet_addr
(
tsPublicIp
);
pVgroup
->
vnodeGid
[
0
].
ip
=
inet_addr
(
tsPrivateIp
);
sdbUpdateRow
(
vgSdb
,
pVgroup
,
tsVgUpdateSize
,
1
);
}
}
}
#endif
mgmtSetDnodeVgid
(
pVgroup
->
vnodeGid
,
pVgroup
->
numOfVnodes
,
pVgroup
->
vgId
);
mgmtSetDnodeVgid
(
pVgroup
->
vnodeGid
,
pVgroup
->
numOfVnodes
,
pVgroup
->
vgId
);
}
}
...
...
src/util/src/tglobalcfg.c
浏览文件 @
2bf71e71
...
@@ -164,6 +164,13 @@ int tsAdminRowLimit = 10240;
...
@@ -164,6 +164,13 @@ int tsAdminRowLimit = 10240;
int
tsTscEnableRecordSql
=
0
;
int
tsTscEnableRecordSql
=
0
;
int
tsEnableCoreFile
=
0
;
int
tsEnableCoreFile
=
0
;
int
tsAnyIp
=
1
;
int
tsAnyIp
=
1
;
int
tsUsePublicIp
=
0
;
#ifdef CLUSTER
int
tsIsCluster
=
1
;
#else
int
tsIsCluster
=
0
;
#endif
int
tsRpcTimer
=
300
;
int
tsRpcTimer
=
300
;
int
tsRpcMaxTime
=
600
;
// seconds;
int
tsRpcMaxTime
=
600
;
// seconds;
...
@@ -780,6 +787,9 @@ static void doInitGlobalConfig() {
...
@@ -780,6 +787,9 @@ static void doInitGlobalConfig() {
TSDB_CFG_CTYPE_B_CONFIG
,
TSDB_CFG_CTYPE_B_CONFIG
,
0
,
1
,
0
,
TSDB_CFG_UTYPE_NONE
);
0
,
1
,
0
,
TSDB_CFG_UTYPE_NONE
);
tsInitConfigOption
(
cfg
++
,
"usePublicIp"
,
&
tsUsePublicIp
,
TSDB_CFG_VTYPE_INT
,
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
,
0
,
1
,
0
,
TSDB_CFG_UTYPE_NONE
);
// version info
// version info
tsInitConfigOption
(
cfg
++
,
"gitinfo"
,
gitinfo
,
TSDB_CFG_VTYPE_STRING
,
tsInitConfigOption
(
cfg
++
,
"gitinfo"
,
gitinfo
,
TSDB_CFG_VTYPE_STRING
,
TSDB_CFG_CTYPE_B_SHOW
|
TSDB_CFG_CTYPE_B_CLIENT
,
TSDB_CFG_CTYPE_B_SHOW
|
TSDB_CFG_CTYPE_B_CLIENT
,
...
...
src/util/src/tutil.c
浏览文件 @
2bf71e71
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include "ttime.h"
#include "ttime.h"
#include "ttypes.h"
#include "ttypes.h"
#include "tutil.h"
#include "tutil.h"
#include "tlog.h"
#include "taoserror.h"
int32_t
strdequote
(
char
*
z
)
{
int32_t
strdequote
(
char
*
z
)
{
if
(
z
==
NULL
)
{
if
(
z
==
NULL
)
{
...
@@ -450,10 +452,8 @@ bool taosValidateEncodec(char *encodec) {
...
@@ -450,10 +452,8 @@ bool taosValidateEncodec(char *encodec) {
return
false
;
return
false
;
}
}
iconv_close
(
cd
);
iconv_close
(
cd
);
return
true
;
#else
return
true
;
#endif
#endif
return
true
;
}
}
bool
taosGetVersionNumber
(
char
*
versionStr
,
int
*
versionNubmer
)
{
bool
taosGetVersionNumber
(
char
*
versionStr
,
int
*
versionNubmer
)
{
...
@@ -485,6 +485,36 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) {
...
@@ -485,6 +485,36 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) {
return
true
;
return
true
;
}
}
int
taosCheckVersion
(
char
*
input_client_version
,
char
*
input_server_version
,
int
comparedSegments
)
{
char
client_version
[
64
]
=
{
0
};
char
server_version
[
64
]
=
{
0
};
int
clientVersionNumber
[
4
]
=
{
0
};
int
serverVersionNumber
[
4
]
=
{
0
};
strcpy
(
client_version
,
input_client_version
);
strcpy
(
server_version
,
input_server_version
);
if
(
!
taosGetVersionNumber
(
client_version
,
clientVersionNumber
))
{
pError
(
"invalid client version:%s"
,
client_version
);
return
TSDB_CODE_INVALID_CLIENT_VERSION
;
}
if
(
!
taosGetVersionNumber
(
server_version
,
serverVersionNumber
))
{
pError
(
"invalid server version:%s"
,
server_version
);
return
TSDB_CODE_INVALID_CLIENT_VERSION
;
return
NULL
;
}
for
(
int32_t
i
=
0
;
i
<
comparedSegments
;
++
i
)
{
if
(
clientVersionNumber
[
i
]
!=
serverVersionNumber
[
i
])
{
tscError
(
"the %d-th number of server version:%s not matched with client version:%s"
,
i
,
server_version
,
version
);
return
TSDB_CODE_INVALID_CLIENT_VERSION
;
}
}
return
0
;
}
char
*
taosIpStr
(
uint32_t
ipInt
)
{
char
*
taosIpStr
(
uint32_t
ipInt
)
{
static
char
ipStrArray
[
3
][
30
];
static
char
ipStrArray
[
3
][
30
];
static
int
ipStrIndex
=
0
;
static
int
ipStrIndex
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录