Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XKZJ_WCL
TDengine
提交
f349c8af
T
TDengine
项目概览
XKZJ_WCL
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f349c8af
编写于
11月 26, 2020
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2257
上级
07bf2b3b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
40 deletion
+41
-40
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+15
-25
src/client/src/tscSql.c
src/client/src/tscSql.c
+20
-4
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+0
-5
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+4
-4
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
f349c8af
...
...
@@ -278,7 +278,7 @@ bool hasMoreClauseToTry(SSqlObj* pSql);
void
tscTryQueryNextVnode
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
void
tscAsyncQuerySingleRowForNextVnode
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
int
tscSetMgmtEpSetFromCfg
(
const
char
*
first
,
const
char
*
second
);
int
tscSetMgmtEpSetFromCfg
(
const
char
*
first
,
const
char
*
second
,
SRpcCorEpSet
*
corEpSet
);
bool
tscSetSqlOwner
(
SSqlObj
*
pSql
);
void
tscClearSqlOwner
(
SSqlObj
*
pSql
);
...
...
src/client/inc/tsclient.h
浏览文件 @
f349c8af
...
...
@@ -336,6 +336,7 @@ typedef struct STscObj {
struct
SSqlObj
*
pHb
;
struct
SSqlObj
*
sqlList
;
struct
SSqlStream
*
streamList
;
SRpcCorEpSet
*
tscCorMgmtEpSet
;
void
*
pDnodeConn
;
pthread_mutex_t
mutex
;
T_REF_DECLARE
()
...
...
@@ -515,7 +516,6 @@ extern int tsInsertHeadSize;
extern
int
tscNumOfThreads
;
extern
int
tscRefId
;
extern
SRpcCorEpSet
tscMgmtEpSet
;
extern
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
);
...
...
src/client/src/tscServer.c
浏览文件 @
f349c8af
...
...
@@ -26,7 +26,7 @@
#include "ttimer.h"
#include "tlockfree.h"
SRpcCorEpSet
tscMgmtEpSet
;
///
SRpcCorEpSet tscMgmtEpSet;
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
=
{
0
};
...
...
@@ -73,10 +73,11 @@ static void tscSetDnodeEpSet(SSqlObj* pSql, SVgroupInfo* pVgroupInfo) {
assert
(
hasFqdn
);
}
static
void
tscDumpMgmtEpSet
(
SRpcEpSet
*
epSet
)
{
taosCorBeginRead
(
&
tscMgmtEpSet
.
version
);
*
epSet
=
tscMgmtEpSet
.
epSet
;
taosCorEndRead
(
&
tscMgmtEpSet
.
version
);
static
void
tscDumpMgmtEpSet
(
SSqlObj
*
pSql
)
{
SRpcCorEpSet
*
pCorEpSet
=
pSql
->
pTscObj
->
tscCorMgmtEpSet
;
taosCorBeginRead
(
&
pCorEpSet
->
version
);
pSql
->
epSet
=
pCorEpSet
->
epSet
;
taosCorEndRead
(
&
pCorEpSet
->
version
);
}
static
void
tscEpSetHtons
(
SRpcEpSet
*
s
)
{
for
(
int32_t
i
=
0
;
i
<
s
->
numOfEps
;
i
++
)
{
...
...
@@ -94,11 +95,12 @@ bool tscEpSetIsEqual(SRpcEpSet *s1, SRpcEpSet *s2) {
}
return
true
;
}
void
tscUpdateMgmtEpSet
(
SRpcEpSet
*
pEpSet
)
{
void
tscUpdateMgmtEpSet
(
S
SqlObj
*
pSql
,
S
RpcEpSet
*
pEpSet
)
{
// no need to update if equal
taosCorBeginWrite
(
&
tscMgmtEpSet
.
version
);
tscMgmtEpSet
.
epSet
=
*
pEpSet
;
taosCorEndWrite
(
&
tscMgmtEpSet
.
version
);
SRpcCorEpSet
*
pCorEpSet
=
pSql
->
pTscObj
->
tscCorMgmtEpSet
;
taosCorBeginWrite
(
&
pCorEpSet
->
version
);
pCorEpSet
->
epSet
=
*
pEpSet
;
taosCorEndWrite
(
&
pCorEpSet
->
version
);
}
static
void
tscDumpEpSetFromVgroupInfo
(
SCorVgroupInfo
*
pVgroupInfo
,
SRpcEpSet
*
pEpSet
)
{
if
(
pVgroupInfo
==
NULL
)
{
return
;}
...
...
@@ -133,18 +135,6 @@ static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcEpSet *pEpSet) {
taosCorEndWrite
(
&
pVgroupInfo
->
version
);
}
void
tscPrintMgmtEp
()
{
SRpcEpSet
dump
;
tscDumpMgmtEpSet
(
&
dump
);
if
(
dump
.
numOfEps
<=
0
)
{
tscError
(
"invalid mnode EP list:%d"
,
dump
.
numOfEps
);
}
else
{
for
(
int
i
=
0
;
i
<
dump
.
numOfEps
;
++
i
)
{
tscDebug
(
"mnode index:%d %s:%d"
,
i
,
dump
.
fqdn
[
i
],
dump
.
port
[
i
]);
}
}
}
void
tscProcessHeartBeatRsp
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
STscObj
*
pObj
=
(
STscObj
*
)
param
;
if
(
pObj
==
NULL
)
return
;
...
...
@@ -162,7 +152,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
SRpcEpSet
*
epSet
=
&
pRsp
->
epSet
;
if
(
epSet
->
numOfEps
>
0
)
{
tscEpSetHtons
(
epSet
);
tscUpdateMgmtEpSet
(
epSet
);
tscUpdateMgmtEpSet
(
pSql
,
epSet
);
}
pSql
->
pTscObj
->
connId
=
htonl
(
pRsp
->
connId
);
...
...
@@ -227,7 +217,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
// set the mgmt ip list
if
(
pSql
->
cmd
.
command
>=
TSDB_SQL_MGMT
)
{
tscDumpMgmtEpSet
(
&
pSql
->
epSet
);
tscDumpMgmtEpSet
(
pSql
);
}
memcpy
(
pMsg
,
pSql
->
cmd
.
payload
,
pSql
->
cmd
.
payloadLen
);
...
...
@@ -289,7 +279,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
tscUpdateVgroupInfo
(
pSql
,
pEpSet
);
}
else
{
tscUpdateMgmtEpSet
(
pEpSet
);
tscUpdateMgmtEpSet
(
p
Sql
,
p
EpSet
);
}
}
}
...
...
@@ -2070,7 +2060,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
if
(
pConnect
->
epSet
.
numOfEps
>
0
)
{
tscEpSetHtons
(
&
pConnect
->
epSet
);
tscUpdateMgmtEpSet
(
&
pConnect
->
epSet
);
tscUpdateMgmtEpSet
(
pSql
,
&
pConnect
->
epSet
);
}
strcpy
(
pObj
->
sversion
,
pConnect
->
serverVersion
);
...
...
src/client/src/tscSql.c
浏览文件 @
f349c8af
...
...
@@ -58,6 +58,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
terrno
=
TSDB_CODE_TSC_INVALID_USER_LENGTH
;
return
NULL
;
}
SRpcCorEpSet
corMgmtEpSet
;
char
secretEncrypt
[
32
]
=
{
0
};
int
secretEncryptLen
=
0
;
...
...
@@ -82,11 +83,13 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
}
secretEncryptLen
=
outlen
;
}
if
(
ip
)
{
if
(
tscSetMgmtEpSetFromCfg
(
ip
,
NULL
)
<
0
)
return
NULL
;
if
(
port
)
tscMgmtEpSet
.
epSet
.
port
[
0
]
=
port
;
}
if
(
tscSetMgmtEpSetFromCfg
(
ip
,
NULL
,
&
corMgmtEpSet
)
<
0
)
return
NULL
;
if
(
port
)
corMgmtEpSet
.
epSet
.
port
[
0
]
=
port
;
}
else
{
if
(
tscSetMgmtEpSetFromCfg
(
tsFirst
,
tsSecond
,
&
corMgmtEpSet
)
<
0
)
return
NULL
;
}
void
*
pDnodeConn
=
NULL
;
if
(
tscInitRpc
(
user
,
secretEncrypt
,
&
pDnodeConn
)
!=
0
)
{
...
...
@@ -100,10 +103,20 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
rpcClose
(
pDnodeConn
);
return
NULL
;
}
// set up tscObj's mgmtEpSet
pObj
->
tscCorMgmtEpSet
=
(
SRpcCorEpSet
*
)
malloc
(
sizeof
(
SRpcCorEpSet
));
if
(
NULL
==
pObj
->
tscCorMgmtEpSet
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
free
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
}
memcpy
(
pObj
->
tscCorMgmtEpSet
,
&
corMgmtEpSet
,
sizeof
(
SRpcCorEpSet
));
pObj
->
signature
=
pObj
;
pObj
->
pDnodeConn
=
pDnodeConn
;
T_REF_INIT_VAL
(
pObj
,
1
);
tstrncpy
(
pObj
->
user
,
user
,
sizeof
(
pObj
->
user
));
secretEncryptLen
=
MIN
(
secretEncryptLen
,
sizeof
(
pObj
->
pass
));
...
...
@@ -115,6 +128,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
if
(
len
>=
TSDB_DB_NAME_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_DB_LENGTH
;
rpcClose
(
pDnodeConn
);
free
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
return
NULL
;
}
...
...
@@ -132,6 +146,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
if
(
NULL
==
pSql
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
free
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
return
NULL
;
}
...
...
@@ -149,6 +164,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
free
(
pSql
);
free
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
return
NULL
;
}
...
...
src/client/src/tscSystem.c
浏览文件 @
f349c8af
...
...
@@ -116,11 +116,6 @@ void taos_init_imp(void) {
taosInitNote
(
tsNumOfLogLines
/
10
,
1
,
(
char
*
)
"tsc_note"
);
}
if
(
tscSetMgmtEpSetFromCfg
(
tsFirst
,
tsSecond
)
<
0
)
{
tscError
(
"failed to init mnode EP list"
);
return
;
}
tscInitMsgsFp
();
int
queueSize
=
tsMaxConnections
*
2
;
...
...
src/client/src/tscUtil.c
浏览文件 @
f349c8af
...
...
@@ -867,7 +867,7 @@ void tscCloseTscObj(void *param) {
rpcClose
(
pObj
->
pDnodeConn
);
pObj
->
pDnodeConn
=
NULL
;
}
tfree
(
pObj
->
tscCorMgmtEpSet
);
pthread_mutex_destroy
(
&
pObj
->
mutex
);
tscDebug
(
"%p DB connection is closed, dnodeConn:%p"
,
pObj
,
p
);
...
...
@@ -2459,10 +2459,10 @@ char* strdup_throw(const char* str) {
return
p
;
}
int
tscSetMgmtEpSetFromCfg
(
const
char
*
first
,
const
char
*
second
)
{
int
tscSetMgmtEpSetFromCfg
(
const
char
*
first
,
const
char
*
second
,
SRpcCorEpSet
*
corMgmtEpSet
)
{
corMgmtEpSet
->
version
=
0
;
// init mgmt ip set
tscMgmtEpSet
.
version
=
0
;
SRpcEpSet
*
mgmtEpSet
=
&
(
tscMgmtEpSet
.
epSet
);
SRpcEpSet
*
mgmtEpSet
=
&
(
corMgmtEpSet
->
epSet
);
mgmtEpSet
->
numOfEps
=
0
;
mgmtEpSet
->
inUse
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录