Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d01a0c59
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看板
提交
d01a0c59
编写于
3月 08, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compile error for rpc interface changed
上级
3870a01e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
52 deletion
+65
-52
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+0
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+62
-48
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+1
-1
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+1
-1
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
d01a0c59
...
...
@@ -379,7 +379,7 @@ int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion);
void
tscInitMsgs
();
extern
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
);
void
tscProcessMsgFromServer
(
char
type
,
void
*
pCont
,
int
contLen
,
void
*
ahandle
,
int32_t
code
);
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
);
int
tscProcessSql
(
SSqlObj
*
pSql
);
void
tscAsyncInsertMultiVnodesProxy
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
...
...
src/client/src/tscAsync.c
浏览文件 @
d01a0c59
...
...
@@ -320,7 +320,6 @@ void tscProcessFetchRow(SSchedMsg *pMsg) {
void
tscProcessAsyncRes
(
SSchedMsg
*
pMsg
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
pMsg
->
ahandle
;
STscObj
*
pTscObj
=
pSql
->
pTscObj
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
...
src/client/src/tscServer.c
浏览文件 @
d01a0c59
...
...
@@ -98,6 +98,7 @@ void tscSetMgmtIpList(SRpcIpSet *pIpList) {
* The retry will not be executed since only *two* retry is allowed in case of single management node in the cluster.
* Therefore, we need to multiply the retry times by factor of 2 to fix this problem.
*/
UNUSED_FUNC
static
int32_t
tscGetMgmtConnMaxRetryTimes
()
{
int32_t
factor
=
2
;
return
tscMgmtIpList
.
numOfIps
*
factor
;
...
...
@@ -185,20 +186,35 @@ int tscSendMsgToServer(SSqlObj *pSql) {
pSql
->
ipList
->
port
=
tsVnodeShellPort
;
tscPrint
(
"%p msg:%s is sent to server %d"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
],
pSql
->
ipList
->
port
);
memcpy
(
pMsg
,
pSql
->
cmd
.
payload
+
tsRpcHeadSize
,
pSql
->
cmd
.
payloadLen
);
rpcSendRequest
(
pVnodeConn
,
pSql
->
ipList
,
pSql
->
cmd
.
msgType
,
pMsg
,
pSql
->
cmd
.
payloadLen
,
pSql
);
SRpcMsg
rpcMsg
=
{
.
msgType
=
pSql
->
cmd
.
msgType
,
.
pCont
=
pMsg
,
.
contLen
=
pSql
->
cmd
.
payloadLen
,
.
handle
=
pSql
,
.
code
=
0
};
rpcSendRequest
(
pVnodeConn
,
pSql
->
ipList
,
&
rpcMsg
);
}
else
{
pSql
->
ipList
->
port
=
tsMgmtShellPort
;
tscPrint
(
"%p msg:%s is sent to server %d"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
],
pSql
->
ipList
->
port
);
memcpy
(
pMsg
,
pSql
->
cmd
.
payload
,
pSql
->
cmd
.
payloadLen
);
rpcSendRequest
(
pTscMgmtConn
,
pSql
->
ipList
,
pSql
->
cmd
.
msgType
,
pMsg
,
pSql
->
cmd
.
payloadLen
,
pSql
);
SRpcMsg
rpcMsg
=
{
.
msgType
=
pSql
->
cmd
.
msgType
,
.
pCont
=
pMsg
,
.
contLen
=
pSql
->
cmd
.
payloadLen
,
.
handle
=
pSql
,
.
code
=
0
};
rpcSendRequest
(
pTscMgmtConn
,
pSql
->
ipList
,
&
rpcMsg
);
}
return
TSDB_CODE_SUCCESS
;
}
void
tscProcessMsgFromServer
(
char
type
,
void
*
pCont
,
int
contLen
,
void
*
ahandle
,
int32_t
code
)
{
tscPrint
(
"response:%s is received, len:%d error:%s"
,
taosMsg
[
(
uint8_t
)
type
],
contLen
,
tstrerror
(
code
));
SSqlObj
*
pSql
=
(
SSqlObj
*
)
a
handle
;
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
)
{
tscPrint
(
"response:%s is received, len:%d error:%s"
,
taosMsg
[
rpcMsg
->
msgType
],
rpcMsg
->
contLen
,
tstrerror
(
rpcMsg
->
code
));
SSqlObj
*
pSql
=
(
SSqlObj
*
)
rpcMsg
->
handle
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscError
(
"%p sql is already released, signature:%p"
,
pSql
,
pSql
->
signature
);
return
;
...
...
@@ -207,24 +223,24 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
STscObj
*
pObj
=
pSql
->
pTscObj
;
tscTrace
(
"%p msg:%p is received from server"
,
pSql
,
pCont
);
tscTrace
(
"%p msg:%p is received from server"
,
pSql
,
rpcMsg
->
pCont
);
if
(
pSql
->
freed
||
pObj
->
signature
!=
pObj
)
{
tscTrace
(
"%p sql is already released or DB connection is closed, freed:%d pObj:%p signature:%p"
,
pSql
,
pSql
->
freed
,
pObj
,
pObj
->
signature
);
tscFreeSqlObj
(
pSql
);
rpcFreeCont
(
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
if
(
pCont
==
NULL
)
{
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
if
(
rpcMsg
->
pCont
==
NULL
)
{
rpcMsg
->
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
}
else
{
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
if
(
code
==
TSDB_CODE_NOT_ACTIVE_TABLE
||
code
==
TSDB_CODE_INVALID_TABLE_ID
||
code
==
TSDB_CODE_INVALID_VNODE_ID
||
code
==
TSDB_CODE_NOT_ACTIVE_VNODE
||
code
==
TSDB_CODE_NETWORK_UNAVAIL
||
code
==
TSDB_CODE_NOT_ACTIVE_SESSION
||
code
==
TSDB_CODE_TABLE_ID_MISMATCH
)
{
if
(
rpcMsg
->
code
==
TSDB_CODE_NOT_ACTIVE_TABLE
||
rpcMsg
->
code
==
TSDB_CODE_INVALID_TABLE_ID
||
rpcMsg
->
code
==
TSDB_CODE_INVALID_VNODE_ID
||
rpcMsg
->
code
==
TSDB_CODE_NOT_ACTIVE_VNODE
||
rpcMsg
->
code
==
TSDB_CODE_NETWORK_UNAVAIL
||
rpcMsg
->
code
==
TSDB_CODE_NOT_ACTIVE_SESSION
||
rpcMsg
->
code
==
TSDB_CODE_TABLE_ID_MISMATCH
)
{
/*
* not_active_table: 1. the virtual node may fail to create table, since the procedure of create table is asynchronized,
* the virtual node may have not create table till now, so try again by using the new metermeta.
...
...
@@ -236,24 +252,24 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
* not_active_session: db has been move to other node, the vnode does not exist on this dnode anymore.
*/
if
(
pCmd
->
command
==
TSDB_SQL_CONNECT
)
{
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
rpcFreeCont
(
pCont
);
rpcMsg
->
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
else
if
(
pCmd
->
command
==
TSDB_SQL_HB
)
{
code
=
TSDB_CODE_NOT_READY
;
rpcFreeCont
(
pCont
);
rpcMsg
->
code
=
TSDB_CODE_NOT_READY
;
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
else
{
tscTrace
(
"%p it shall renew meter meta, code:%d"
,
pSql
,
code
);
tscTrace
(
"%p it shall renew meter meta, code:%d"
,
pSql
,
rpcMsg
->
code
);
pSql
->
maxRetry
=
TSDB_VNODES_SUPPORT
*
2
;
pSql
->
res
.
code
=
(
uint8_t
)
code
;
// keep the previous error code
pSql
->
res
.
code
=
rpcMsg
->
code
;
// keep the previous error code
code
=
tscRenewMeterMeta
(
pSql
,
pMeterMetaInfo
->
name
);
rpcMsg
->
code
=
tscRenewMeterMeta
(
pSql
,
pMeterMetaInfo
->
name
);
if
(
pMeterMetaInfo
->
pMeterMeta
)
{
tscSendMsgToServer
(
pSql
);
rpcFreeCont
(
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
}
...
...
@@ -266,16 +282,16 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
pRes
->
rspLen
=
0
;
if
(
pRes
->
code
!=
TSDB_CODE_QUERY_CANCELLED
)
{
pRes
->
code
=
(
code
!=
TSDB_CODE_SUCCESS
)
?
code
:
TSDB_CODE_NETWORK_UNAVAIL
;
pRes
->
code
=
(
rpcMsg
->
code
!=
TSDB_CODE_SUCCESS
)
?
rpcMsg
->
code
:
TSDB_CODE_NETWORK_UNAVAIL
;
}
else
{
tscTrace
(
"%p query is cancelled, code:%d"
,
pSql
,
pRes
->
code
);
}
if
(
pRes
->
code
!=
TSDB_CODE_QUERY_CANCELLED
)
{
assert
(
t
ype
==
pCmd
->
msgType
+
1
);
pRes
->
code
=
(
int32_t
)
code
;
pRes
->
rspType
=
t
ype
;
pRes
->
rspLen
=
contLen
;
assert
(
rpcMsg
->
msgT
ype
==
pCmd
->
msgType
+
1
);
pRes
->
code
=
(
int32_t
)
rpcMsg
->
code
;
pRes
->
rspType
=
rpcMsg
->
msgT
ype
;
pRes
->
rspLen
=
rpcMsg
->
contLen
;
char
*
tmp
=
(
char
*
)
realloc
(
pRes
->
pRsp
,
pRes
->
rspLen
);
if
(
tmp
==
NULL
)
{
...
...
@@ -283,7 +299,7 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
}
else
{
pRes
->
pRsp
=
tmp
;
if
(
pRes
->
rspLen
)
{
memcpy
(
pRes
->
pRsp
,
pCont
,
pRes
->
rspLen
);
memcpy
(
pRes
->
pRsp
,
rpcMsg
->
pCont
,
pRes
->
rspLen
);
}
}
...
...
@@ -296,8 +312,8 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
* There is not response callback function for submit response.
* The actual inserted number of points is the first number.
*/
if
(
t
ype
==
TSDB_MSG_TYPE_SUBMIT_RSP
)
{
SShellSubmitRspMsg
*
pMsg
=
pRes
->
pRsp
;
if
(
rpcMsg
->
msgT
ype
==
TSDB_MSG_TYPE_SUBMIT_RSP
)
{
SShellSubmitRspMsg
*
pMsg
=
(
SShellSubmitRspMsg
*
)
pRes
->
pRsp
;
pMsg
->
code
=
htonl
(
pMsg
->
code
);
pMsg
->
numOfRows
=
htonl
(
pMsg
->
numOfRows
);
pMsg
->
affectedRows
=
htonl
(
pMsg
->
affectedRows
);
...
...
@@ -316,14 +332,14 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
tsem_post
(
&
pSql
->
rspSem
);
}
else
{
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
tscProcessMsgRsp
[
pCmd
->
command
])
code
=
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
rpcMsg
->
code
=
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
if
(
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
rpcMsg
->
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
int
command
=
pCmd
->
command
;
void
*
taosres
=
tscKeepConn
[
command
]
?
pSql
:
NULL
;
code
=
pRes
->
code
?
-
pRes
->
code
:
pRes
->
numOfRows
;
rpcMsg
->
code
=
pRes
->
code
?
-
pRes
->
code
:
pRes
->
numOfRows
;
tscTrace
(
"%p Async SQL result:%d res:%p"
,
pSql
,
code
,
taosres
);
tscTrace
(
"%p Async SQL result:%d res:%p"
,
pSql
,
rpcMsg
->
code
,
taosres
);
/*
* Whether to free sqlObj or not should be decided before call the user defined function, since this SqlObj
...
...
@@ -335,9 +351,9 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
*/
bool
shouldFree
=
tscShouldFreeAsyncSqlObj
(
pSql
);
if
(
command
==
TSDB_SQL_INSERT
)
{
// handle multi-vnode insertion situation
(
*
pSql
->
fp
)(
pSql
,
taosres
,
code
);
(
*
pSql
->
fp
)(
pSql
,
taosres
,
rpcMsg
->
code
);
}
else
{
(
*
pSql
->
fp
)(
pSql
->
param
,
taosres
,
code
);
(
*
pSql
->
fp
)(
pSql
->
param
,
taosres
,
rpcMsg
->
code
);
}
if
(
shouldFree
)
{
...
...
@@ -353,7 +369,7 @@ void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle,
}
}
rpcFreeCont
(
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
}
static
SSqlObj
*
tscCreateSqlObjForSubquery
(
SSqlObj
*
pSql
,
SRetrieveSupport
*
trsupport
,
SSqlObj
*
prevSqlObj
);
...
...
@@ -1206,7 +1222,7 @@ int tscBuildRetrieveMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pStart
=
pSql
->
cmd
.
payload
+
tsRpcHeadSize
;
pMsg
=
pStart
;
SRetrieveTableMsg
*
pRetrieveMsg
=
(
S
ShellSubmit
Msg
*
)
pMsg
;
SRetrieveTableMsg
*
pRetrieveMsg
=
(
S
RetrieveTable
Msg
*
)
pMsg
;
pRetrieveMsg
->
qhandle
=
htobe64
(
pSql
->
res
.
qhandle
);
pMsg
+=
sizeof
(
pSql
->
res
.
qhandle
);
...
...
@@ -1221,13 +1237,13 @@ int tscBuildRetrieveMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
void
tscUpdateVnodeInSubmitMsg
(
SSqlObj
*
pSql
,
char
*
buf
)
{
SShellSubmitMsg
*
pShellMsg
;
char
*
pMsg
;
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
,
0
);
//
SShellSubmitMsg *pShellMsg;
//
char * pMsg;
//
SMeterMetaInfo * pMeterMetaInfo = tscGetMeterMetaInfo(&pSql->cmd, pSql->cmd.clauseIndex, 0);
STableMeta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
//
STableMeta *pMeterMeta = pMeterMetaInfo->pMeterMeta;
pMsg
=
buf
+
tsRpcHeadSize
;
//
pMsg = buf + tsRpcHeadSize;
//TODO set iplist
//pShellMsg = (SShellSubmitMsg *)pMsg;
...
...
@@ -1999,7 +2015,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
memcpy
(
pMsg
,
&
pInfo
->
pCreateTableInfo
->
usingInfo
.
tagdata
,
sizeof
(
STagData
));
pMsg
+=
sizeof
(
STagData
);
}
else
{
// create (super) table
pSchema
=
pCreateTableMsg
->
schema
;
pSchema
=
(
SSchema
*
)
pCreateTableMsg
->
schema
;
for
(
int
i
=
0
;
i
<
pCmd
->
numOfCols
+
pCmd
->
count
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
pQueryInfo
,
i
);
...
...
@@ -2039,7 +2055,7 @@ int tscEstimateAlterTableMsgLength(SSqlCmd *pCmd) {
int
tscBuildAlterTableMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SAlterTableMsg
*
pAlterTableMsg
;
char
*
pMsg
,
*
pStart
;
char
*
pMsg
;
int
msgLen
=
0
;
int
size
=
0
;
...
...
@@ -2557,7 +2573,6 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int
tscProcessMeterMetaRsp
(
SSqlObj
*
pSql
)
{
STableMeta
*
pMeta
;
SSchema
*
pSchema
;
uint8_t
ieType
;
pMeta
=
(
STableMeta
*
)
pSql
->
res
.
pRsp
;
...
...
@@ -2661,7 +2676,7 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
for
(
i
=
0
;
i
<
totalNum
;
i
++
)
{
SMultiTableMeta
*
pMultiMeta
=
(
SMultiTableMeta
*
)
rsp
;
STableMeta
*
pMeta
=
&
pMultiMeta
->
metas
;
STableMeta
*
pMeta
=
pMultiMeta
->
metas
;
pMeta
->
sid
=
htonl
(
pMeta
->
sid
);
pMeta
->
sversion
=
htons
(
pMeta
->
sversion
);
...
...
@@ -3023,7 +3038,7 @@ int tscProcessAlterDbMsgRsp(SSqlObj *pSql) {
int
tscProcessQueryRsp
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryTableRsp
*
pQuery
=
(
S
Retrieve
TableRsp
*
)
pRes
->
pRsp
;
SQueryTableRsp
*
pQuery
=
(
S
Query
TableRsp
*
)
pRes
->
pRsp
;
pQuery
->
qhandle
=
htobe64
(
pQuery
->
qhandle
);
pRes
->
qhandle
=
pQuery
->
qhandle
;
...
...
@@ -3035,7 +3050,6 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
int
tscProcessRetrieveRspFromVnode
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
STscObj
*
pObj
=
pSql
->
pTscObj
;
SRetrieveTableRsp
*
pRetrieve
=
(
SRetrieveTableRsp
*
)
pRes
->
pRsp
;
...
...
src/client/src/tscSystem.c
浏览文件 @
d01a0c59
...
...
@@ -72,7 +72,7 @@ int32_t tscInitRpc(const char *user, const char *secret) {
rpcInit
.
cfp
=
tscProcessMsgFromServer
;
rpcInit
.
sessions
=
tsMaxVnodeConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
user
=
user
;
rpcInit
.
user
=
(
char
*
)
user
;
rpcInit
.
ckey
=
"key"
;
rpcInit
.
secret
=
secretEncrypt
;
...
...
src/rpc/src/rpcMain.c
浏览文件 @
d01a0c59
...
...
@@ -359,7 +359,7 @@ void rpcSendRequest(void *shandle, SRpcIpSet *pIpSet, SRpcMsg *pMsg) {
// connection type is application specific.
// for TDengine, all the query, show commands shall have TCP connection
char
type
=
pMsg
->
msgType
;
if
(
type
==
TSDB_MSG_TYPE_
DNODE_QUERY
||
type
==
TSDB_MSG_TYPE_DNOD
E_RETRIEVE
||
if
(
type
==
TSDB_MSG_TYPE_
QUERY
||
type
==
TSDB_MSG_TYP
E_RETRIEVE
||
type
==
TSDB_MSG_TYPE_STABLE_META
||
type
==
TSDB_MSG_TYPE_MULTI_TABLE_META
||
type
==
TSDB_MSG_TYPE_SHOW
)
pContext
->
connType
=
RPC_CONN_TCPC
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录