Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
995a84be
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
995a84be
编写于
6月 11, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2238 from taosdata/hotfix/killquery
[td-592]refactor codes
上级
00abe271
a52c4bec
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
26 deletion
+30
-26
src/client/src/tscSql.c
src/client/src/tscSql.c
+30
-26
未找到文件。
src/client/src/tscSql.c
浏览文件 @
995a84be
...
...
@@ -475,6 +475,33 @@ int taos_select_db(TAOS *taos, const char *db) {
return
code
;
}
// send free message to vnode to free qhandle and corresponding resources in vnode
static
void
tscFreeQhandleInVnode
(
SSqlObj
*
pSql
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
pRes
->
completed
==
false
&&
!
tscIsTwoStageSTableQuery
(
pQueryInfo
,
0
)
&&
(
pCmd
->
command
==
TSDB_SQL_SELECT
||
pCmd
->
command
==
TSDB_SQL_SHOW
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_FETCH
)
&&
(
pCmd
->
command
==
TSDB_SQL_SELECT
&&
pSql
->
pStream
==
NULL
&&
pTableMetaInfo
->
pTableMeta
!=
NULL
))
{
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
tscTrace
(
"%p start to send msg to free qhandle in dnode, command:%s"
,
pSql
,
sqlCmd
[
pCmd
->
command
]);
pSql
->
freed
=
1
;
tscProcessSql
(
pSql
);
// in case of sync model query, waits for response and then goes on
if
(
pSql
->
fp
==
waitForQueryRsp
||
pSql
->
fp
==
waitForRetrieveRsp
)
{
sem_wait
(
&
pSql
->
rspSem
);
}
}
}
void
taos_free_result
(
TAOS_RES
*
res
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
res
;
tscTrace
(
"%p start to free result"
,
res
);
...
...
@@ -484,10 +511,8 @@ void taos_free_result(TAOS_RES *res) {
return
;
}
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
// The semaphore can not be changed while freeing async sub query objects.
SSqlRes
*
pRes
=
&
pSql
->
res
;
if
(
pRes
==
NULL
||
pRes
->
qhandle
==
0
)
{
tscTrace
(
"%p SqlObj is freed by app, qhandle is null"
,
pSql
);
tscFreeSqlObj
(
pSql
);
...
...
@@ -502,30 +527,9 @@ void taos_free_result(TAOS_RES *res) {
}
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
/*
* If the query process is cancelled by user in stable query, tscProcessSql should not be called
* for each subquery. Because the failure of execution tsProcessSql may trigger the callback function
* be executed, and the retry efforts may result in double free the resources, e.g.,SRetrieveSupport
*/
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
pRes
->
completed
==
false
&&
(
pCmd
->
command
==
TSDB_SQL_SELECT
||
pCmd
->
command
==
TSDB_SQL_SHOW
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_FETCH
)
&&
(
pCmd
->
command
==
TSDB_SQL_SELECT
&&
pSql
->
pStream
==
NULL
&&
pTableMetaInfo
->
pTableMeta
!=
NULL
))
{
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
tscTrace
(
"%p start to send msg to free qhandle in dnode, command:%s"
,
pSql
,
sqlCmd
[
pCmd
->
command
]);
pSql
->
freed
=
1
;
tscProcessSql
(
pSql
);
// in case of sync model query, waits for response and then goes on
if
(
pSql
->
fp
==
waitForQueryRsp
||
pSql
->
fp
==
waitForRetrieveRsp
)
{
sem_wait
(
&
pSql
->
rspSem
);
}
}
tscFreeQhandleInVnode
(
pSql
);
tscFreeSqlObj
(
pSql
);
tscTrace
(
"%p sql result is freed by app"
,
pSql
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录