Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e52fd48d
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看板
提交
e52fd48d
编写于
5月 18, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/2.0tsdb
上级
50e24fd9
44613c3c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
67 addition
and
72 deletion
+67
-72
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-0
src/client/src/tscServer.c
src/client/src/tscServer.c
+5
-25
src/client/src/tscSql.c
src/client/src/tscSql.c
+7
-21
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+5
-8
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+30
-0
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-1
src/common/src/tglobal.c
src/common/src/tglobal.c
+2
-2
src/inc/taosdef.h
src/inc/taosdef.h
+2
-2
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+13
-13
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
e52fd48d
...
...
@@ -264,6 +264,7 @@ bool hasMoreVnodesToTry(SSqlObj *pSql);
void
tscTryQueryNextVnode
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
void
tscAsyncQuerySingleRowForNextVnode
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
void
(
*
queryFp
)());
int
tscSetMgmtIpListFromCfg
(
const
char
*
first
,
const
char
*
second
);
void
*
malloc_throw
(
size_t
size
);
void
*
calloc_throw
(
size_t
nmemb
,
size_t
size
);
...
...
src/client/src/tscServer.c
浏览文件 @
e52fd48d
...
...
@@ -68,7 +68,7 @@ void tscPrintMgmtIp() {
}
}
void
tscSetMgmtIpList
FromCluster
(
SRpcIpSet
*
pIpList
)
{
void
tscSetMgmtIpList
(
SRpcIpSet
*
pIpList
)
{
tscMgmtIpSet
.
numOfIps
=
pIpList
->
numOfIps
;
tscMgmtIpSet
.
inUse
=
pIpList
->
inUse
;
for
(
int32_t
i
=
0
;
i
<
tscMgmtIpSet
.
numOfIps
;
++
i
)
{
...
...
@@ -76,16 +76,6 @@ void tscSetMgmtIpListFromCluster(SRpcIpSet *pIpList) {
}
}
void
tscSetMgmtIpListFromEdge
()
{
if
(
tscMgmtIpSet
.
numOfIps
!=
1
)
{
tscMgmtIpSet
.
numOfIps
=
1
;
tscMgmtIpSet
.
inUse
=
0
;
taosGetFqdnPortFromEp
(
tsFirst
,
tscMgmtIpSet
.
fqdn
[
0
],
&
tscMgmtIpSet
.
port
[
0
]);
tscTrace
(
"edge mgmt IP list:"
);
tscPrintMgmtIp
();
}
}
void
tscUpdateIpSet
(
void
*
ahandle
,
SRpcIpSet
*
pIpSet
)
{
tscMgmtIpSet
=
*
pIpSet
;
tscTrace
(
"mgmt IP list is changed for ufp is called, numOfIps:%d inUse:%d"
,
tscMgmtIpSet
.
numOfIps
,
tscMgmtIpSet
.
inUse
);
...
...
@@ -94,18 +84,6 @@ void tscUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) {
}
}
void
tscSetMgmtIpList
(
SRpcIpSet
*
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
...
...
@@ -133,7 +111,8 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
code
==
0
)
{
SCMHeartBeatRsp
*
pRsp
=
(
SCMHeartBeatRsp
*
)
pRes
->
pRsp
;
SRpcIpSet
*
pIpList
=
&
pRsp
->
ipList
;
tscSetMgmtIpList
(
pIpList
);
if
(
pIpList
->
numOfIps
>
0
)
tscSetMgmtIpList
(
pIpList
);
if
(
pRsp
->
killConnection
)
{
tscKillConnection
(
pObj
);
...
...
@@ -2225,7 +2204,8 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
assert
(
len
<=
tListLen
(
pObj
->
db
));
strncpy
(
pObj
->
db
,
temp
,
tListLen
(
pObj
->
db
));
tscSetMgmtIpList
(
&
pConnect
->
ipList
);
if
(
pConnect
->
ipList
.
numOfIps
>
0
)
tscSetMgmtIpList
(
&
pConnect
->
ipList
);
strcpy
(
pObj
->
sversion
,
pConnect
->
serverVersion
);
pObj
->
writeAuth
=
pConnect
->
writeAuth
;
...
...
src/client/src/tscSql.c
浏览文件 @
e52fd48d
...
...
@@ -65,32 +65,18 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
terrno
=
TSDB_CODE_INVALID_PASS
;
return
NULL
;
}
if
(
ip
)
{
if
(
tscSetMgmtIpListFromCfg
(
ip
,
NULL
)
<
0
)
return
NULL
;
if
(
port
)
tscMgmtIpSet
.
port
[
0
]
=
port
;
}
void
*
pDnodeConn
=
NULL
;
if
(
tscInitRpc
(
user
,
pass
,
&
pDnodeConn
)
!=
0
)
{
terrno
=
TSDB_CODE_NETWORK_UNAVAIL
;
return
NULL
;
}
tscMgmtIpSet
.
numOfIps
=
0
;
if
(
ip
&&
ip
[
0
])
{
tscMgmtIpSet
.
inUse
=
0
;
tscMgmtIpSet
.
numOfIps
=
1
;
strcpy
(
tscMgmtIpSet
.
fqdn
[
0
],
ip
);
tscMgmtIpSet
.
port
[
0
]
=
port
?
port
:
tsDnodeShellPort
;
}
else
{
if
(
tsFirst
[
0
]
!=
0
)
{
taosGetFqdnPortFromEp
(
tsFirst
,
tscMgmtIpSet
.
fqdn
[
tscMgmtIpSet
.
numOfIps
],
&
tscMgmtIpSet
.
port
[
tscMgmtIpSet
.
numOfIps
]);
tscMgmtIpSet
.
numOfIps
++
;
}
if
(
tsSecond
[
0
]
!=
0
)
{
taosGetFqdnPortFromEp
(
tsSecond
,
tscMgmtIpSet
.
fqdn
[
tscMgmtIpSet
.
numOfIps
],
&
tscMgmtIpSet
.
port
[
tscMgmtIpSet
.
numOfIps
]);
tscMgmtIpSet
.
numOfIps
++
;
}
}
STscObj
*
pObj
=
(
STscObj
*
)
calloc
(
1
,
sizeof
(
STscObj
));
if
(
NULL
==
pObj
)
{
terrno
=
TSDB_CODE_CLI_OUT_OF_MEMORY
;
...
...
src/client/src/tscSystem.c
浏览文件 @
e52fd48d
...
...
@@ -23,6 +23,7 @@
#include "tutil.h"
#include "tsched.h"
#include "tscLog.h"
#include "tscUtil.h"
#include "tsclient.h"
#include "tglobal.h"
#include "tconfig.h"
...
...
@@ -114,14 +115,10 @@ void taos_init_imp() {
taosInitNote
(
tsNumOfLogLines
/
10
,
1
,
(
char
*
)
"tsc_note"
);
}
tscMgmtIpSet
.
inUse
=
0
;
tscMgmtIpSet
.
numOfIps
=
1
;
taosGetFqdnPortFromEp
(
tsFirst
,
tscMgmtIpSet
.
fqdn
[
0
],
&
tscMgmtIpSet
.
port
[
0
]);
if
(
tsSecond
[
0
]
&&
strcmp
(
tsSecond
,
tsFirst
)
!=
0
)
{
tscMgmtIpSet
.
numOfIps
=
2
;
taosGetFqdnPortFromEp
(
tsSecond
,
tscMgmtIpSet
.
fqdn
[
1
],
&
tscMgmtIpSet
.
port
[
1
]);
}
if
(
tscSetMgmtIpListFromCfg
(
tsFirst
,
tsSecond
)
<
0
)
{
tscError
(
"failed to init mgmt IP list"
);
return
;
}
tscInitMsgsFp
();
int
queueSize
=
tsMaxVnodeConnections
+
tsMaxMeterConnections
+
tsMaxMgmtConnections
+
tsMaxMgmtConnections
;
...
...
src/client/src/tscUtil.c
浏览文件 @
e52fd48d
...
...
@@ -2163,3 +2163,33 @@ char* strdup_throw(const char* str) {
}
return
p
;
}
int
tscSetMgmtIpListFromCfg
(
const
char
*
first
,
const
char
*
second
)
{
tscMgmtIpSet
.
numOfIps
=
0
;
tscMgmtIpSet
.
inUse
=
0
;
if
(
first
&&
first
[
0
]
!=
0
)
{
if
(
strlen
(
first
)
>=
TSDB_FQDN_LEN
)
{
terrno
=
TSDB_CODE_INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
first
,
tscMgmtIpSet
.
fqdn
[
tscMgmtIpSet
.
numOfIps
],
&
tscMgmtIpSet
.
port
[
tscMgmtIpSet
.
numOfIps
]);
tscMgmtIpSet
.
numOfIps
++
;
}
if
(
second
&&
second
[
0
]
!=
0
)
{
if
(
strlen
(
second
)
>=
TSDB_FQDN_LEN
)
{
terrno
=
TSDB_CODE_INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
second
,
tscMgmtIpSet
.
fqdn
[
tscMgmtIpSet
.
numOfIps
],
&
tscMgmtIpSet
.
port
[
tscMgmtIpSet
.
numOfIps
]);
tscMgmtIpSet
.
numOfIps
++
;
}
if
(
tscMgmtIpSet
.
numOfIps
==
0
)
{
terrno
=
TSDB_CODE_INVALID_FQDN
;
return
-
1
;
}
return
0
;
}
src/common/inc/tglobal.h
浏览文件 @
e52fd48d
...
...
@@ -175,7 +175,7 @@ void taosInitGlobalCfg();
bool
taosCheckGlobalCfg
();
void
taosSetAllDebugFlag
();
bool
taosCfgDynamicOptions
(
char
*
msg
);
int
taosGetFqdnPortFromEp
(
char
*
ep
,
char
*
fqdn
,
uint16_t
*
port
);
int
taosGetFqdnPortFromEp
(
c
onst
c
har
*
ep
,
char
*
fqdn
,
uint16_t
*
port
);
#ifdef __cplusplus
}
...
...
src/common/src/tglobal.c
浏览文件 @
e52fd48d
...
...
@@ -61,7 +61,7 @@ int32_t tscEmbedded = 0;
*/
int64_t
tsMsPerDay
[]
=
{
86400000L
,
86400000000L
};
char
tsFirst
[
TSDB_FQDN_LEN
]
=
{
0
};
char
tsFirst
[
TSDB_FQDN_LEN
]
=
{
0
};
char
tsSecond
[
TSDB_FQDN_LEN
]
=
{
0
};
char
tsArbitrator
[
TSDB_FQDN_LEN
]
=
{
0
};
char
tsLocalEp
[
TSDB_FQDN_LEN
]
=
{
0
};
// Local End Point, hostname:port
...
...
@@ -1252,7 +1252,7 @@ bool taosCheckGlobalCfg() {
return
true
;
}
int
taosGetFqdnPortFromEp
(
char
*
ep
,
char
*
fqdn
,
uint16_t
*
port
)
{
int
taosGetFqdnPortFromEp
(
c
onst
c
har
*
ep
,
char
*
fqdn
,
uint16_t
*
port
)
{
*
port
=
0
;
strcpy
(
fqdn
,
ep
);
...
...
src/inc/taosdef.h
浏览文件 @
e52fd48d
...
...
@@ -218,7 +218,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_LOCALE_LEN 64
#define TSDB_TIMEZONE_LEN 64
#define TSDB_FQDN_LEN
72
#define TSDB_FQDN_LEN
256
#define TSDB_IPv4ADDR_LEN 16
#define TSDB_FILENAME_LEN 128
#define TSDB_METER_VNODE_BITS 20
...
...
@@ -234,7 +234,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_DEFAULT_PKT_SIZE 65480 //same as RPC_MAX_UDP_SIZE
#define TSDB_PAYLOAD_SIZE (TSDB_DEFAULT_PKT_SIZE - 100)
#define TSDB_DEFAULT_PAYLOAD_SIZE
1024
// default payload size
#define TSDB_DEFAULT_PAYLOAD_SIZE
2048
// default payload size
#define TSDB_EXTRA_PAYLOAD_SIZE 128 // extra bytes for auth
#define TSDB_CQ_SQL_SIZE 1024
#define TSDB_MAX_VNODES 256
...
...
src/inc/taoserror.h
浏览文件 @
e52fd48d
...
...
@@ -170,6 +170,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_QHANDLE, 0, 459, "invalid handle"
TAOS_DEFINE_ERROR
(
TSDB_CODE_QUERY_CANCELLED
,
0
,
460
,
"query cancelled"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_IE
,
0
,
461
,
"invalid ie"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VALUE
,
0
,
462
,
"invalid value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_FQDN
,
0
,
463
,
"invalid FQDN"
)
// others
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_FILE_FORMAT
,
0
,
500
,
"invalid file format"
)
...
...
src/inc/taosmsg.h
浏览文件 @
e52fd48d
...
...
@@ -187,13 +187,13 @@ typedef struct SMsgHead {
// Submit message for one table
typedef
struct
SSubmitBlk
{
int64_t
uid
;
// table unique id
int32_t
tid
;
// table id
int32_t
padding
;
// TODO just for padding here
int32_t
sversion
;
// data schema version
int32_t
len
;
// data part length, not including the SSubmitBlk head
int16_t
numOfRows
;
// total number of rows in current submit block
char
data
[];
u
int64_t
uid
;
// table unique id
int32_t
tid
;
// table id
int32_t
padding
;
// TODO just for padding here
int32_t
sversion
;
// data schema version
int32_t
len
;
// data part length, not including the SSubmitBlk head
int16_t
numOfRows
;
// total number of rows in current submit block
char
data
[];
}
SSubmitBlk
;
// Submit message for this TSDB
...
...
@@ -327,9 +327,9 @@ typedef struct {
}
SMDDropTableMsg
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
int64_t
uid
;
int32_t
contLen
;
int32_t
vgId
;
u
int64_t
uid
;
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
}
SMDDropSTableMsg
;
...
...
@@ -404,9 +404,9 @@ typedef struct SColumnInfo {
}
SColumnInfo
;
typedef
struct
STableIdInfo
{
int64_t
uid
;
int32_t
tid
;
TSKEY
key
;
// last accessed ts, for subscription
u
int64_t
uid
;
int32_t
tid
;
TSKEY
key
;
// last accessed ts, for subscription
}
STableIdInfo
;
typedef
struct
STimeWindow
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录