Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
25ee3b48
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看板
提交
25ee3b48
编写于
10月 13, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] refactor client code
上级
6a88d306
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
171 addition
and
181 deletion
+171
-181
src/client/inc/tscLocalMerge.h
src/client/inc/tscLocalMerge.h
+0
-7
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+0
-1
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+9
-2
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+6
-22
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+12
-6
src/client/src/tscServer.c
src/client/src/tscServer.c
+16
-8
src/client/src/tscSql.c
src/client/src/tscSql.c
+12
-3
src/client/src/tscStream.c
src/client/src/tscStream.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+103
-122
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+10
-8
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+1
-0
未找到文件。
src/client/inc/tscLocalMerge.h
浏览文件 @
25ee3b48
...
@@ -72,17 +72,10 @@ typedef struct SLocalReducer {
...
@@ -72,17 +72,10 @@ typedef struct SLocalReducer {
bool
orderPrjOnSTable
;
// projection query on stable
bool
orderPrjOnSTable
;
// projection query on stable
}
SLocalReducer
;
}
SLocalReducer
;
typedef
struct
SSubqueryState
{
int32_t
numOfRemain
;
// the number of remain unfinished subquery
int32_t
numOfTotal
;
// the number of total sub-queries
uint64_t
numOfRetrievedRows
;
// total number of points in this query
}
SSubqueryState
;
typedef
struct
SRetrieveSupport
{
typedef
struct
SRetrieveSupport
{
tExtMemBuffer
**
pExtMemBuffer
;
// for build loser tree
tExtMemBuffer
**
pExtMemBuffer
;
// for build loser tree
tOrderDescriptor
*
pOrderDescriptor
;
tOrderDescriptor
*
pOrderDescriptor
;
SColumnModel
*
pFinalColModel
;
// colModel for final result
SColumnModel
*
pFinalColModel
;
// colModel for final result
SSubqueryState
*
pState
;
int32_t
subqueryIndex
;
// index of current vnode in vnode list
int32_t
subqueryIndex
;
// index of current vnode in vnode list
SSqlObj
*
pParentSql
;
SSqlObj
*
pParentSql
;
tFilePage
*
localBuffer
;
// temp buffer, there is a buffer for each vnode to
tFilePage
*
localBuffer
;
// temp buffer, there is a buffer for each vnode to
...
...
src/client/inc/tscUtil.h
浏览文件 @
25ee3b48
...
@@ -66,7 +66,6 @@ typedef struct STidTags {
...
@@ -66,7 +66,6 @@ typedef struct STidTags {
#pragma pack(pop)
#pragma pack(pop)
typedef
struct
SJoinSupporter
{
typedef
struct
SJoinSupporter
{
SSubqueryState
*
pState
;
SSqlObj
*
pObj
;
// parent SqlObj
SSqlObj
*
pObj
;
// parent SqlObj
int32_t
subqueryIndex
;
// index of sub query
int32_t
subqueryIndex
;
// index of sub query
SInterval
interval
;
SInterval
interval
;
...
...
src/client/inc/tsclient.h
浏览文件 @
25ee3b48
...
@@ -334,6 +334,12 @@ typedef struct STscObj {
...
@@ -334,6 +334,12 @@ typedef struct STscObj {
T_REF_DECLARE
()
T_REF_DECLARE
()
}
STscObj
;
}
STscObj
;
typedef
struct
SSubqueryState
{
int32_t
numOfRemain
;
// the number of remain unfinished subquery
int32_t
numOfSub
;
// the number of total sub-queries
uint64_t
numOfRetrievedRows
;
// total number of points in this query
}
SSubqueryState
;
typedef
struct
SSqlObj
{
typedef
struct
SSqlObj
{
void
*
signature
;
void
*
signature
;
pthread_t
owner
;
// owner of sql object, by which it is executed
pthread_t
owner
;
// owner of sql object, by which it is executed
...
@@ -355,10 +361,11 @@ typedef struct SSqlObj {
...
@@ -355,10 +361,11 @@ typedef struct SSqlObj {
tsem_t
rspSem
;
tsem_t
rspSem
;
SSqlCmd
cmd
;
SSqlCmd
cmd
;
SSqlRes
res
;
SSqlRes
res
;
uint16_t
numOfSubs
;
SSubqueryState
subState
;
struct
SSqlObj
**
pSubs
;
struct
SSqlObj
**
pSubs
;
struct
SSqlObj
*
prev
,
*
next
;
struct
SSqlObj
*
prev
,
*
next
;
struct
SSqlObj
**
self
;
struct
SSqlObj
**
self
;
}
SSqlObj
;
}
SSqlObj
;
...
...
src/client/src/tscAsync.c
浏览文件 @
25ee3b48
...
@@ -361,15 +361,6 @@ void tscProcessFetchRow(SSchedMsg *pMsg) {
...
@@ -361,15 +361,6 @@ void tscProcessFetchRow(SSchedMsg *pMsg) {
(
*
pSql
->
fetchFp
)(
pSql
->
param
,
pSql
,
pRes
->
tsrow
);
(
*
pSql
->
fetchFp
)(
pSql
->
param
,
pSql
,
pRes
->
tsrow
);
}
}
void
tscProcessAsyncRes
(
SSchedMsg
*
pMsg
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
pMsg
->
ahandle
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
assert
(
pSql
->
fp
!=
NULL
&&
pSql
->
fetchFp
!=
NULL
);
pSql
->
fp
=
pSql
->
fetchFp
;
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
pRes
->
code
);
}
// this function will be executed by queue task threads, so the terrno is not valid
// this function will be executed by queue task threads, so the terrno is not valid
static
void
tscProcessAsyncError
(
SSchedMsg
*
pMsg
)
{
static
void
tscProcessAsyncError
(
SSchedMsg
*
pMsg
)
{
void
(
*
fp
)()
=
pMsg
->
ahandle
;
void
(
*
fp
)()
=
pMsg
->
ahandle
;
...
@@ -393,22 +384,15 @@ void tscQueueAsyncRes(SSqlObj *pSql) {
...
@@ -393,22 +384,15 @@ void tscQueueAsyncRes(SSqlObj *pSql) {
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscDebug
(
"%p SqlObj is freed, not add into queue async res"
,
pSql
);
tscDebug
(
"%p SqlObj is freed, not add into queue async res"
,
pSql
);
return
;
return
;
}
else
{
tscError
(
"%p add into queued async res, code:%s"
,
pSql
,
tstrerror
(
pSql
->
res
.
code
));
}
}
SSchedMsg
schedMsg
=
{
0
};
tscError
(
"%p add into queued async res, code:%s"
,
pSql
,
tstrerror
(
pSql
->
res
.
code
));
schedMsg
.
fp
=
tscProcessAsyncRes
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
thandle
=
(
void
*
)
1
;
schedMsg
.
msg
=
NULL
;
taosScheduleTask
(
tscQhandle
,
&
schedMsg
);
}
void
tscProcessAsyncFree
(
SSchedMsg
*
pMsg
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
pMsg
->
ahandle
;
assert
(
pSql
->
fp
!=
NULL
&&
pSql
->
fetchFp
!=
NULL
);
tscDebug
(
"%p sql is freed"
,
pSql
);
taos_free_result
(
pSql
);
pSql
->
fp
=
pSql
->
fetchFp
;
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
pRes
->
code
);
}
}
int
tscSendMsgToServer
(
SSqlObj
*
pSql
);
int
tscSendMsgToServer
(
SSqlObj
*
pSql
);
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
25ee3b48
...
@@ -639,7 +639,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
...
@@ -639,7 +639,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
(
*
pMemBuffer
)
=
(
tExtMemBuffer
**
)
malloc
(
POINTER_BYTES
*
pSql
->
numOfSubs
);
(
*
pMemBuffer
)
=
(
tExtMemBuffer
**
)
malloc
(
POINTER_BYTES
*
pSql
->
subState
.
numOfSub
);
if
(
*
pMemBuffer
==
NULL
)
{
if
(
*
pMemBuffer
==
NULL
)
{
tscError
(
"%p failed to allocate memory"
,
pSql
);
tscError
(
"%p failed to allocate memory"
,
pSql
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
25ee3b48
...
@@ -1603,8 +1603,8 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
...
@@ -1603,8 +1603,8 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
setExprInfoForFunctions
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SSchema
*
pSchema
,
SConvertFunc
cvtFunc
,
char
*
aliasName
,
static
int32_t
setExprInfoForFunctions
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SSchema
*
pSchema
,
SConvertFunc
cvtFunc
,
int32_t
resColIdx
,
SColumnIndex
*
pColIndex
)
{
char
*
aliasName
,
int32_t
resColIdx
,
SColumnIndex
*
pColIndex
,
bool
finalResult
)
{
const
char
*
msg1
=
"not support column types"
;
const
char
*
msg1
=
"not support column types"
;
int16_t
type
=
0
;
int16_t
type
=
0
;
...
@@ -1650,8 +1650,13 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
...
@@ -1650,8 +1650,13 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
SColumnIndex
index
=
{.
tableIndex
=
pColIndex
->
tableIndex
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
SColumnIndex
index
=
{.
tableIndex
=
pColIndex
->
tableIndex
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
index
);
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
index
);
// if it is not in the final result, do not add it
SColumnList
ids
=
getColumnList
(
1
,
pColIndex
->
tableIndex
,
pColIndex
->
columnIndex
);
SColumnList
ids
=
getColumnList
(
1
,
pColIndex
->
tableIndex
,
pColIndex
->
columnIndex
);
insertResultField
(
pQueryInfo
,
resColIdx
,
&
ids
,
bytes
,
(
int8_t
)
type
,
columnName
,
pExpr
);
if
(
finalResult
)
{
insertResultField
(
pQueryInfo
,
resColIdx
,
&
ids
,
bytes
,
(
int8_t
)
type
,
columnName
,
pExpr
);
}
else
{
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
(
ids
.
ids
[
0
]));
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1926,7 +1931,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -1926,7 +1931,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
for
(
int32_t
j
=
0
;
j
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
++
j
)
{
index
.
columnIndex
=
j
;
index
.
columnIndex
=
j
;
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
pItem
->
aliasName
,
colIndex
++
,
&
index
)
!=
0
)
{
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
pItem
->
aliasName
,
colIndex
++
,
&
index
,
finalResult
)
!=
0
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
}
}
...
@@ -1943,7 +1948,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -1943,7 +1948,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if
((
index
.
columnIndex
>=
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
))
||
(
index
.
columnIndex
<
0
))
{
if
((
index
.
columnIndex
>=
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
))
||
(
index
.
columnIndex
<
0
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
}
}
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
pItem
->
aliasName
,
colIndex
+
i
,
&
index
)
!=
0
)
{
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
pItem
->
aliasName
,
colIndex
+
i
,
&
index
,
finalResult
)
!=
0
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
...
@@ -1980,7 +1986,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -1980,7 +1986,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
for
(
int32_t
i
=
0
;
i
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
++
i
)
{
SColumnIndex
index
=
{.
tableIndex
=
j
,
.
columnIndex
=
i
};
SColumnIndex
index
=
{.
tableIndex
=
j
,
.
columnIndex
=
i
};
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
pItem
->
aliasName
,
colIndex
,
&
index
)
!=
0
)
{
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
pItem
->
aliasName
,
colIndex
,
&
index
,
finalResult
)
!=
0
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
...
...
src/client/src/tscServer.c
浏览文件 @
25ee3b48
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
#include "tschemautil.h"
#include "tschemautil.h"
#include "tsclient.h"
#include "tsclient.h"
#include "ttimer.h"
#include "ttimer.h"
#include "tutil.h"
#include "tlockfree.h"
#include "tlockfree.h"
SRpcCorEpSet
tscMgmtEpSet
;
SRpcCorEpSet
tscMgmtEpSet
;
...
@@ -478,20 +477,29 @@ void tscKillSTableQuery(SSqlObj *pSql) {
...
@@ -478,20 +477,29 @@ void tscKillSTableQuery(SSqlObj *pSql) {
pSql
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
pSql
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
for
(
int
i
=
0
;
i
<
pSql
->
numOfSubs
;
++
i
)
{
for
(
int
i
=
0
;
i
<
pSql
->
subState
.
numOfSub
;
++
i
)
{
// NOTE: pSub may have been released already here
// NOTE: pSub may have been released already here
SSqlObj
*
pSub
=
pSql
->
pSubs
[
i
];
SSqlObj
*
pSub
=
pSql
->
pSubs
[
i
];
if
(
pSub
==
NULL
)
{
if
(
pSub
==
NULL
)
{
continue
;
continue
;
}
}
pSub
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
void
**
p
=
taosCacheAcquireByKey
(
tscObjCache
,
&
pSub
,
sizeof
(
TSDB_CACHE_PTR_TYPE
));
if
(
pSub
->
pRpcCtx
!=
NULL
)
{
if
(
p
==
NULL
)
{
rpcCancelRequest
(
pSub
->
pRpcCtx
);
continue
;
pSub
->
pRpcCtx
=
NULL
;
}
SSqlObj
*
pSubObj
=
(
SSqlObj
*
)
(
*
p
);
assert
(
pSubObj
->
self
==
(
SSqlObj
**
)
p
);
pSubObj
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
if
(
pSubObj
->
pRpcCtx
!=
NULL
)
{
rpcCancelRequest
(
pSubObj
->
pRpcCtx
);
pSubObj
->
pRpcCtx
=
NULL
;
}
}
tscQueueAsyncRes
(
pSub
);
// async res? not other functions?
tscQueueAsyncRes
(
pSubObj
);
// async res? not other functions?
taosCacheRelease
(
tscObjCache
,
(
void
**
)
&
p
,
false
);
}
}
tscDebug
(
"%p super table query cancelled"
,
pSql
);
tscDebug
(
"%p super table query cancelled"
,
pSql
);
...
@@ -1455,7 +1463,7 @@ int tscProcessLocalRetrieveRsp(SSqlObj *pSql) {
...
@@ -1455,7 +1463,7 @@ int tscProcessLocalRetrieveRsp(SSqlObj *pSql) {
int
tscProcessRetrieveLocalMergeRsp
(
SSqlObj
*
pSql
)
{
int
tscProcessRetrieveLocalMergeRsp
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
int32_t
code
=
pRes
->
code
;
int32_t
code
=
pRes
->
code
;
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSql.c
浏览文件 @
25ee3b48
...
@@ -523,7 +523,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
...
@@ -523,7 +523,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
pRes->numOfClauseTotal = 0;
pRes->numOfClauseTotal = 0;
pRes->rspType = 0;
pRes->rspType = 0;
pSql->
numOfSubs
= 0;
pSql->
subState.numOfSub
= 0;
taosTFree(pSql->pSubs);
taosTFree(pSql->pSubs);
assert(pSql->fp == NULL);
assert(pSql->fp == NULL);
...
@@ -559,7 +559,7 @@ int taos_select_db(TAOS *taos, const char *db) {
...
@@ -559,7 +559,7 @@ int taos_select_db(TAOS *taos, const char *db) {
}
}
// send free message to vnode to free qhandle and corresponding resources in vnode
// send free message to vnode to free qhandle and corresponding resources in vnode
static
bool
tscKillQueryInDnode
(
SSqlObj
*
pSql
)
{
static
UNUSED_FUNC
bool
tscKillQueryInDnode
(
SSqlObj
*
pSql
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
@@ -568,10 +568,18 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) {
...
@@ -568,10 +568,18 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) {
}
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
if
(
(
pQueryInfo
==
NULL
)
||
tscIsTwoStageSTableQuery
(
pQueryInfo
,
0
)
)
{
if
(
pQueryInfo
==
NULL
)
{
return
true
;
return
true
;
}
}
if
(
pSql
->
pRpcCtx
!=
NULL
)
{
rpcCancelRequest
(
pSql
->
pRpcCtx
);
pSql
->
pRpcCtx
=
NULL
;
return
true
;
}
else
{
pSql
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
tscRemoveFromSqlList
(
pSql
);
tscRemoveFromSqlList
(
pSql
);
...
@@ -700,6 +708,7 @@ void taos_stop_query(TAOS_RES *res) {
...
@@ -700,6 +708,7 @@ void taos_stop_query(TAOS_RES *res) {
}
else
{
// TODO multithreads bug
}
else
{
// TODO multithreads bug
if
(
pSql
->
cmd
.
command
<
TSDB_SQL_LOCAL
&&
pSql
->
pRpcCtx
!=
NULL
)
{
if
(
pSql
->
cmd
.
command
<
TSDB_SQL_LOCAL
&&
pSql
->
pRpcCtx
!=
NULL
)
{
rpcCancelRequest
(
pSql
->
pRpcCtx
);
rpcCancelRequest
(
pSql
->
pRpcCtx
);
pSql
->
pRpcCtx
=
NULL
;
}
}
}
}
...
...
src/client/src/tscStream.c
浏览文件 @
25ee3b48
...
@@ -274,7 +274,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
...
@@ -274,7 +274,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
taosCacheRelease
(
tscMetaCache
,
(
void
**
)
&
(
pTableMetaInfo
->
pTableMeta
),
false
);
taosCacheRelease
(
tscMetaCache
,
(
void
**
)
&
(
pTableMetaInfo
->
pTableMeta
),
false
);
tscFreeSqlResult
(
pSql
);
tscFreeSqlResult
(
pSql
);
taosTFree
(
pSql
->
pSubs
);
taosTFree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
taosTFree
(
pTableMetaInfo
->
vgroupList
);
taosTFree
(
pTableMetaInfo
->
vgroupList
);
tscSetNextLaunchTimer
(
pStream
,
pSql
);
tscSetNextLaunchTimer
(
pStream
,
pSql
);
}
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
25ee3b48
此差异已折叠。
点击以展开。
src/client/src/tscUtil.c
浏览文件 @
25ee3b48
...
@@ -360,26 +360,26 @@ void tscPartiallyFreeSqlObj(SSqlObj* pSql) {
...
@@ -360,26 +360,26 @@ void tscPartiallyFreeSqlObj(SSqlObj* pSql) {
tscFreeSqlResult
(
pSql
);
tscFreeSqlResult
(
pSql
);
taosTFree
(
pSql
->
pSubs
);
taosTFree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
self
=
0
;
pSql
->
self
=
0
;
tscResetSqlCmdObj
(
pCmd
,
false
);
tscResetSqlCmdObj
(
pCmd
,
false
);
}
}
static
UNUSED_FUNC
void
tscFreeSubobj
(
SSqlObj
*
pSql
)
{
static
void
tscFreeSubobj
(
SSqlObj
*
pSql
)
{
if
(
pSql
->
numOfSubs
==
0
)
{
if
(
pSql
->
subState
.
numOfSub
==
0
)
{
return
;
return
;
}
}
tscDebug
(
"%p start to free sub SqlObj, numOfSub:%d"
,
pSql
,
pSql
->
numOfSubs
);
tscDebug
(
"%p start to free sub SqlObj, numOfSub:%d"
,
pSql
,
pSql
->
subState
.
numOfSub
);
for
(
int32_t
i
=
0
;
i
<
pSql
->
numOfSubs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pSql
->
subState
.
numOfSub
;
++
i
)
{
tscDebug
(
"%p free sub SqlObj:%p, index:%d"
,
pSql
,
pSql
->
pSubs
[
i
],
i
);
tscDebug
(
"%p free sub SqlObj:%p, index:%d"
,
pSql
,
pSql
->
pSubs
[
i
],
i
);
taos_free_result
(
pSql
->
pSubs
[
i
]);
taos_free_result
(
pSql
->
pSubs
[
i
]);
pSql
->
pSubs
[
i
]
=
NULL
;
pSql
->
pSubs
[
i
]
=
NULL
;
}
}
pSql
->
numOfSubs
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
}
}
/**
/**
...
@@ -415,7 +415,9 @@ void tscFreeSqlObj(SSqlObj* pSql) {
...
@@ -415,7 +415,9 @@ void tscFreeSqlObj(SSqlObj* pSql) {
tscDebug
(
"%p start to free sqlObj"
,
pSql
);
tscDebug
(
"%p start to free sqlObj"
,
pSql
);
pSql
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
tscFreeSubobj
(
pSql
);
tscFreeSubobj
(
pSql
);
tscPartiallyFreeSqlObj
(
pSql
);
tscPartiallyFreeSqlObj
(
pSql
);
pSql
->
signature
=
NULL
;
pSql
->
signature
=
NULL
;
...
@@ -2284,7 +2286,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2284,7 +2286,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
*
*
* For super table join with projection query, if anyone of the subquery is exhausted, the query completed.
* For super table join with projection query, if anyone of the subquery is exhausted, the query completed.
*/
*/
pSql
->
numOfSubs
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
pCmd
->
command
=
TSDB_SQL_SELECT
;
pCmd
->
command
=
TSDB_SQL_SELECT
;
tscResetForNextRetrieve
(
pRes
);
tscResetForNextRetrieve
(
pRes
);
...
@@ -2316,7 +2318,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2316,7 +2318,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
pRes
->
numOfTotal
=
num
;
pRes
->
numOfTotal
=
num
;
taosTFree
(
pSql
->
pSubs
);
taosTFree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
fp
=
fp
;
pSql
->
fp
=
fp
;
tscDebug
(
"%p try data in the next subclause:%d, total subclause:%d"
,
pSql
,
pCmd
->
clauseIndex
,
pCmd
->
numOfClause
);
tscDebug
(
"%p try data in the next subclause:%d, total subclause:%d"
,
pSql
,
pCmd
->
clauseIndex
,
pCmd
->
numOfClause
);
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
25ee3b48
...
@@ -261,6 +261,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
...
@@ -261,6 +261,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
if
(
vnodeNotifyCurrentQhandle
(
pReadMsg
->
rpcMsg
.
handle
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
vnodeNotifyCurrentQhandle
(
pReadMsg
->
rpcMsg
.
handle
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:%p, retrieve discarded since link is broken, %p"
,
pVnode
->
vgId
,
*
handle
,
pReadMsg
->
rpcMsg
.
handle
);
vError
(
"vgId:%d, QInfo:%p, retrieve discarded since link is broken, %p"
,
pVnode
->
vgId
,
*
handle
,
pReadMsg
->
rpcMsg
.
handle
);
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
qKillQuery
(
*
handle
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
return
code
;
return
code
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录