Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
07e2f961
T
TDengine
项目概览
~笨蛋陪你哭
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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,发现更多精彩内容 >>
提交
07e2f961
编写于
8月 13, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] fix error in closing the conns.
上级
cfc7da14
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
38 deletion
+54
-38
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+45
-34
src/client/src/tscSql.c
src/client/src/tscSql.c
+7
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
07e2f961
...
...
@@ -210,7 +210,7 @@ void tscTagCondRelease(STagCond* pCond);
void
tscGetSrcColumnInfo
(
SSrcColumnInfo
*
pColInfo
,
SQueryInfo
*
pQueryInfo
);
void
tscSetFreeHeatBeat
(
STscObj
*
pObj
);
bool
tscShouldFreeHeatBeat
(
SSqlObj
*
pHb
);
bool
tscShouldFreeHea
r
tBeat
(
SSqlObj
*
pHb
);
bool
tscShouldBeFreed
(
SSqlObj
*
pSql
);
STableMetaInfo
*
tscGetTableMetaInfoFromCmd
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
,
int32_t
tableIndex
);
...
...
src/client/src/tscServer.c
浏览文件 @
07e2f961
...
...
@@ -171,46 +171,23 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
void
tscProcessActivityTimer
(
void
*
handle
,
void
*
tmrId
)
{
STscObj
*
pObj
=
(
STscObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
return
;
}
if
(
pObj
==
NULL
)
return
;
if
(
pObj
->
signature
!=
pObj
)
return
;
if
(
pObj
->
pTimer
!=
tmrId
)
return
;
if
(
pObj
->
pHb
==
NULL
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
NULL
==
pSql
)
return
;
pSql
->
fp
=
tscProcessHeartBeatRsp
;
SQueryInfo
*
pQueryInfo
=
NULL
;
tscGetQueryInfoDetailSafely
(
&
pSql
->
cmd
,
0
,
&
pQueryInfo
);
pQueryInfo
->
command
=
TSDB_SQL_HB
;
pSql
->
cmd
.
command
=
TSDB_SQL_HB
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
(
pSql
->
cmd
),
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
taosTFree
(
pSql
);
return
;
}
pSql
->
cmd
.
command
=
TSDB_SQL_HB
;
pSql
->
param
=
pObj
;
pSql
->
pTscObj
=
pObj
;
pSql
->
signature
=
pSql
;
pObj
->
pHb
=
pSql
;
tscAddSubqueryInfo
(
&
pObj
->
pHb
->
cmd
);
tscDebug
(
"%p HB is allocated, pObj:%p"
,
pObj
->
pHb
,
pObj
);
SSqlObj
*
pHB
=
pObj
->
pHb
;
if
(
pObj
->
pTimer
!=
tmrId
||
pHB
==
NULL
)
{
return
;
}
if
(
tscShouldFreeHea
tBeat
(
pObj
->
pHb
))
{
tscDebug
(
"%p free HB object and release connection"
,
p
Obj
->
pHb
);
tscFreeSqlObj
(
p
Obj
->
pHb
);
if
(
tscShouldFreeHea
rtBeat
(
pHB
))
{
tscDebug
(
"%p free HB object and release connection"
,
p
HB
);
tscFreeSqlObj
(
p
HB
);
tscCloseTscObj
(
pObj
);
}
else
{
// taosMsleep(500);
int32_t
code
=
tscProcessSql
(
pObj
->
pHb
);
int32_t
code
=
tscProcessSql
(
pHB
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p failed to sent HB to server, reason:%s"
,
p
Obj
->
pHb
,
tstrerror
(
code
));
tscError
(
"%p failed to sent HB to server, reason:%s"
,
p
HB
,
tstrerror
(
code
));
}
}
}
...
...
@@ -268,6 +245,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
return
;
}
pSql
->
pRpcCtx
=
NULL
;
// clear the rpcCtx
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
if
(
pQueryInfo
!=
NULL
&&
pQueryInfo
->
type
==
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
tscDebug
(
"%p sqlObj needs to be released or DB connection is closed, cmd:%d type:%d, pObj:%p signature:%p"
,
...
...
@@ -1956,6 +1935,35 @@ int tscProcessShowRsp(SSqlObj *pSql) {
return
0
;
}
static
void
createHBObj
(
STscObj
*
pObj
)
{
if
(
pObj
->
pHb
!=
NULL
)
{
return
;
}
SSqlObj
*
pSql
=
(
SSqlObj
*
)
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
NULL
==
pSql
)
return
;
pSql
->
fp
=
tscProcessHeartBeatRsp
;
SQueryInfo
*
pQueryInfo
=
NULL
;
tscGetQueryInfoDetailSafely
(
&
pSql
->
cmd
,
0
,
&
pQueryInfo
);
pQueryInfo
->
command
=
TSDB_SQL_HB
;
pSql
->
cmd
.
command
=
pQueryInfo
->
command
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
(
pSql
->
cmd
),
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
taosTFree
(
pSql
);
return
;
}
pSql
->
param
=
pObj
;
pSql
->
pTscObj
=
pObj
;
pSql
->
signature
=
pSql
;
pObj
->
pHb
=
pSql
;
tscAddSubqueryInfo
(
&
pObj
->
pHb
->
cmd
);
tscDebug
(
"%p HB is allocated, pObj:%p"
,
pObj
->
pHb
,
pObj
);
}
int
tscProcessConnectRsp
(
SSqlObj
*
pSql
)
{
char
temp
[
TSDB_TABLE_FNAME_LEN
*
2
];
STscObj
*
pObj
=
pSql
->
pTscObj
;
...
...
@@ -1977,6 +1985,9 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
pObj
->
writeAuth
=
pConnect
->
writeAuth
;
pObj
->
superAuth
=
pConnect
->
superAuth
;
pObj
->
connId
=
htonl
(
pConnect
->
connId
);
createHBObj
(
pObj
);
taosTmrReset
(
tscProcessActivityTimer
,
tsShellActivityTimer
*
500
,
pObj
,
tscTmr
,
&
pObj
->
pTimer
);
return
0
;
...
...
src/client/src/tscSql.c
浏览文件 @
07e2f961
...
...
@@ -216,10 +216,15 @@ void taos_close(TAOS *taos) {
}
if
(
pObj
->
pHb
!=
NULL
)
{
if
(
pObj
->
pHb
->
pRpcCtx
!=
NULL
)
{
// wait for rsp from dnode
rpcCancelRequest
(
pObj
->
pHb
->
pRpcCtx
);
}
tscSetFreeHeatBeat
(
pObj
);
}
else
{
tscCloseTscObj
(
pObj
);
tscFreeSqlObj
(
pObj
->
pHb
);
}
tscCloseTscObj
(
pObj
);
}
void
waitForQueryRsp
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
07e2f961
...
...
@@ -1394,7 +1394,7 @@ void tscSetFreeHeatBeat(STscObj* pObj) {
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
}
bool
tscShouldFreeHeatBeat
(
SSqlObj
*
pHb
)
{
bool
tscShouldFreeHea
r
tBeat
(
SSqlObj
*
pHb
)
{
assert
(
pHb
==
pHb
->
signature
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pHb
->
cmd
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录