Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a1ce0a26
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看板
未验证
提交
a1ce0a26
编写于
9月 21, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
9月 21, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3615 from taosdata/bugfix/cache
[TD-1529]<fix>: use cache in subscribe & prepare
上级
1d894d6e
6e3d6372
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
4 deletion
+19
-4
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+5
-1
src/client/src/tscStream.c
src/client/src/tscStream.c
+1
-2
src/client/src/tscSub.c
src/client/src/tscSub.c
+13
-1
未找到文件。
src/client/src/tscPrepare.c
浏览文件 @
a1ce0a26
...
@@ -546,6 +546,10 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
...
@@ -546,6 +546,10 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
pSql
->
cmd
.
numOfParams
=
0
;
pSql
->
cmd
.
numOfParams
=
0
;
pSql
->
cmd
.
batchSize
=
0
;
pSql
->
cmd
.
batchSize
=
0
;
uint64_t
handle
=
(
uint64_t
)
pSql
;
pSql
->
self
=
taosCachePut
(
tscObjCache
,
&
handle
,
sizeof
(
uint64_t
),
&
pSql
,
sizeof
(
uint64_t
),
2
*
3600
*
1000
);
T_REF_INC
(
pSql
->
pTscObj
);
int32_t
code
=
tsParseSql
(
pSql
,
true
);
int32_t
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
// wait for the callback function to post the semaphore
// wait for the callback function to post the semaphore
...
@@ -574,7 +578,7 @@ int taos_stmt_close(TAOS_STMT* stmt) {
...
@@ -574,7 +578,7 @@ int taos_stmt_close(TAOS_STMT* stmt) {
free
(
normal
->
sql
);
free
(
normal
->
sql
);
}
}
t
scFreeSqlObj
(
pStmt
->
pSql
);
t
aos_free_result
(
pStmt
->
pSql
);
free
(
pStmt
);
free
(
pStmt
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
src/client/src/tscStream.c
浏览文件 @
a1ce0a26
...
@@ -612,7 +612,6 @@ void taos_close_stream(TAOS_STREAM *handle) {
...
@@ -612,7 +612,6 @@ void taos_close_stream(TAOS_STREAM *handle) {
* Here, we need a check before release memory
* Here, we need a check before release memory
*/
*/
if
(
pSql
->
signature
==
pSql
)
{
if
(
pSql
->
signature
==
pSql
)
{
T_REF_DEC
(
pSql
->
pTscObj
);
tscRemoveFromStreamList
(
pStream
,
pSql
);
tscRemoveFromStreamList
(
pStream
,
pSql
);
taosTmrStopA
(
&
(
pStream
->
pTimer
));
taosTmrStopA
(
&
(
pStream
->
pTimer
));
...
@@ -621,7 +620,7 @@ void taos_close_stream(TAOS_STREAM *handle) {
...
@@ -621,7 +620,7 @@ void taos_close_stream(TAOS_STREAM *handle) {
// notify CQ to release the pStream object
// notify CQ to release the pStream object
pStream
->
fp
(
pStream
->
param
,
NULL
,
NULL
);
pStream
->
fp
(
pStream
->
param
,
NULL
,
NULL
);
t
scFreeSqlObj
(
pSql
);
t
aos_free_result
(
pSql
);
pStream
->
pSql
=
NULL
;
pStream
->
pSql
=
NULL
;
taosTFree
(
pStream
);
taosTFree
(
pStream
);
...
...
src/client/src/tscSub.c
浏览文件 @
a1ce0a26
...
@@ -152,6 +152,10 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
...
@@ -152,6 +152,10 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
goto
fail
;
goto
fail
;
}
}
uint64_t
handle
=
(
uint64_t
)
pSql
;
pSql
->
self
=
taosCachePut
(
tscObjCache
,
&
handle
,
sizeof
(
uint64_t
),
&
pSql
,
sizeof
(
uint64_t
),
2
*
3600
*
1000
);
T_REF_INC
(
pSql
->
pTscObj
);
code
=
tsParseSql
(
pSql
,
false
);
code
=
tsParseSql
(
pSql
,
false
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
tsem_wait
(
&
pSub
->
sem
);
tsem_wait
(
&
pSub
->
sem
);
...
@@ -173,7 +177,11 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
...
@@ -173,7 +177,11 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
fail:
fail:
tscError
(
"tscCreateSubscription failed at line %d, reason: %s"
,
line
,
tstrerror
(
code
));
tscError
(
"tscCreateSubscription failed at line %d, reason: %s"
,
line
,
tstrerror
(
code
));
if
(
pSql
!=
NULL
)
{
if
(
pSql
!=
NULL
)
{
tscFreeSqlObj
(
pSql
);
if
(
pSql
->
self
!=
NULL
)
{
taos_free_result
(
pSql
);
}
else
{
tscFreeSqlObj
(
pSql
);
}
pSql
=
NULL
;
pSql
=
NULL
;
}
}
if
(
pSub
!=
NULL
)
{
if
(
pSub
!=
NULL
)
{
...
@@ -494,6 +502,10 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
...
@@ -494,6 +502,10 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
}
}
}
}
if
(
pSub
->
pSql
!=
NULL
)
{
taos_free_result
(
pSub
->
pSql
);
}
tscFreeSqlObj
(
pSub
->
pSql
);
tscFreeSqlObj
(
pSub
->
pSql
);
taosArrayDestroy
(
pSub
->
progress
);
taosArrayDestroy
(
pSub
->
progress
);
tsem_destroy
(
&
pSub
->
sem
);
tsem_destroy
(
&
pSub
->
sem
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录