Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
92ab4a4d
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看板
未验证
提交
92ab4a4d
编写于
9月 21, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
9月 21, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3599 from taosdata/release/s102
Release/s102
上级
e589dc24
f0db6224
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
25 addition
and
31 deletion
+25
-31
src/client/src/tscServer.c
src/client/src/tscServer.c
+8
-5
src/client/src/tscSql.c
src/client/src/tscSql.c
+7
-24
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+2
-0
src/util/src/tcache.c
src/util/src/tcache.c
+8
-2
未找到文件。
src/client/src/tscServer.c
浏览文件 @
92ab4a4d
...
@@ -188,8 +188,8 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
...
@@ -188,8 +188,8 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
if
(
tscShouldFreeHeartBeat
(
pHB
))
{
if
(
tscShouldFreeHeartBeat
(
pHB
))
{
tscDebug
(
"%p free HB object and release connection"
,
pHB
);
tscDebug
(
"%p free HB object and release connection"
,
pHB
);
tscFreeSqlObj
(
pHB
)
;
pObj
->
pHb
=
0
;
t
scCloseTscObj
(
pObj
);
t
aos_free_result
(
pHB
);
}
else
{
}
else
{
int32_t
code
=
tscProcessSql
(
pHB
);
int32_t
code
=
tscProcessSql
(
pHB
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -1959,6 +1959,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
...
@@ -1959,6 +1959,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
return
0
;
return
0
;
}
}
// TODO multithread problem
static
void
createHBObj
(
STscObj
*
pObj
)
{
static
void
createHBObj
(
STscObj
*
pObj
)
{
if
(
pObj
->
pHb
!=
NULL
)
{
if
(
pObj
->
pHb
!=
NULL
)
{
return
;
return
;
...
@@ -1987,10 +1988,13 @@ static void createHBObj(STscObj* pObj) {
...
@@ -1987,10 +1988,13 @@ static void createHBObj(STscObj* pObj) {
pSql
->
pTscObj
=
pObj
;
pSql
->
pTscObj
=
pObj
;
pSql
->
signature
=
pSql
;
pSql
->
signature
=
pSql
;
pObj
->
pHb
=
pSql
;
pObj
->
pHb
=
pSql
;
T_REF_INC
(
pObj
);
tscAddSubqueryInfo
(
&
pObj
->
pHb
->
cmd
);
tscAddSubqueryInfo
(
&
pObj
->
pHb
->
cmd
);
int64_t
ad
=
(
int64_t
)
pSql
;
pSql
->
self
=
taosCachePut
(
tscObjCache
,
&
ad
,
sizeof
(
int64_t
),
&
pSql
,
sizeof
(
int64_t
),
2
*
60
*
1000
);
T_REF_INC
(
pObj
);
tscDebug
(
"%p HB is allocated, pObj:%p"
,
pObj
->
pHb
,
pObj
);
tscDebug
(
"%p HB is allocated, pObj:%p"
,
pObj
->
pHb
,
pObj
);
}
}
...
@@ -2017,8 +2021,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
...
@@ -2017,8 +2021,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
pObj
->
connId
=
htonl
(
pConnect
->
connId
);
pObj
->
connId
=
htonl
(
pConnect
->
connId
);
createHBObj
(
pObj
);
createHBObj
(
pObj
);
taosTmrReset
(
tscProcessActivityTimer
,
tsShellActivityTimer
*
500
,
pObj
,
tscTmr
,
&
pObj
->
pTimer
);
// taosTmrReset(tscProcessActivityTimer, tsShellActivityTimer * 500, pObj, tscTmr, &pObj->pTimer);
return
0
;
return
0
;
}
}
...
...
src/client/src/tscSql.c
浏览文件 @
92ab4a4d
...
@@ -263,32 +263,15 @@ void taos_close(TAOS *taos) {
...
@@ -263,32 +263,15 @@ void taos_close(TAOS *taos) {
return
;
return
;
}
}
if
(
pObj
->
pHb
!=
NULL
)
{
SSqlObj
*
pHb
=
pObj
->
pHb
;
if
(
pObj
->
pHb
->
pRpcCtx
!=
NULL
)
{
// wait for rsp from dnode
if
(
pHb
!=
NULL
)
{
rpcCancelRequest
(
pObj
->
pHb
->
pRpcCtx
);
if
(
pHb
->
pRpcCtx
!=
NULL
)
{
// wait for rsp from dnode
}
rpcCancelRequest
(
pHb
->
pRpcCtx
);
}
tscSetFreeHeatBeat
(
pObj
);
tscFreeSqlObj
(
pObj
->
pHb
);
pObj
->
pHb
=
NULL
;
}
taos_free_result
(
pHb
);
}
// free all sqlObjs created by using this connect before free the STscObj
// while(1) {
// pthread_mutex_lock(&pObj->mutex);
// void* p = pObj->sqlList;
// pthread_mutex_unlock(&pObj->mutex);
//
// if (p == NULL) {
// break;
// }
//
// tscDebug("%p waiting for sqlObj to be freed, %p", pObj, p);
// taosMsleep(100);
//
// // todo fix me!! two threads call taos_free_result will cause problem.
// tscDebug("%p free :%p", pObj, p);
// taos_free_result(p);
// }
int32_t
ref
=
T_REF_DEC
(
pObj
);
int32_t
ref
=
T_REF_DEC
(
pObj
);
assert
(
ref
>=
0
);
assert
(
ref
>=
0
);
...
...
src/rpc/src/rpcMain.c
浏览文件 @
92ab4a4d
...
@@ -580,6 +580,8 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
...
@@ -580,6 +580,8 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
void
*
shandle
=
(
connType
&
RPC_CONN_TCP
)
?
pRpc
->
tcphandle
:
pRpc
->
udphandle
;
void
*
shandle
=
(
connType
&
RPC_CONN_TCP
)
?
pRpc
->
tcphandle
:
pRpc
->
udphandle
;
pConn
->
chandle
=
(
*
taosOpenConn
[
connType
])(
shandle
,
pConn
,
pConn
->
peerIp
,
pConn
->
peerPort
);
pConn
->
chandle
=
(
*
taosOpenConn
[
connType
])(
shandle
,
pConn
,
pConn
->
peerIp
,
pConn
->
peerPort
);
if
(
pConn
->
chandle
==
NULL
)
{
if
(
pConn
->
chandle
==
NULL
)
{
tError
(
"failed to connect to:0x%x:%d"
,
pConn
->
peerIp
,
pConn
->
peerPort
);
terrno
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
terrno
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
rpcCloseConn
(
pConn
);
rpcCloseConn
(
pConn
);
pConn
=
NULL
;
pConn
=
NULL
;
...
...
src/util/src/tcache.c
浏览文件 @
92ab4a4d
...
@@ -260,7 +260,13 @@ static void incRefFn(void* ptNode) {
...
@@ -260,7 +260,13 @@ static void incRefFn(void* ptNode) {
}
}
void
*
taosCacheAcquireByKey
(
SCacheObj
*
pCacheObj
,
const
void
*
key
,
size_t
keyLen
)
{
void
*
taosCacheAcquireByKey
(
SCacheObj
*
pCacheObj
,
const
void
*
key
,
size_t
keyLen
)
{
if
(
pCacheObj
==
NULL
||
taosHashGetSize
(
pCacheObj
->
pHashTable
)
==
0
||
pCacheObj
->
deleting
==
1
)
{
if
(
pCacheObj
==
NULL
||
pCacheObj
->
deleting
==
1
)
{
return
NULL
;
}
if
(
taosHashGetSize
(
pCacheObj
->
pHashTable
)
==
0
)
{
atomic_add_fetch_32
(
&
pCacheObj
->
statistics
.
missCount
,
1
);
uError
(
"cache:%s, key:%p, not in cache, retrieved failed, reason: empty sqlObj cache"
,
pCacheObj
->
name
,
key
);
return
NULL
;
return
NULL
;
}
}
...
@@ -274,7 +280,7 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen
...
@@ -274,7 +280,7 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen
uDebug
(
"cache:%s, key:%p, %p is retrieved from cache, refcnt:%d"
,
pCacheObj
->
name
,
key
,
pData
,
T_REF_VAL_GET
(
ptNode
));
uDebug
(
"cache:%s, key:%p, %p is retrieved from cache, refcnt:%d"
,
pCacheObj
->
name
,
key
,
pData
,
T_REF_VAL_GET
(
ptNode
));
}
else
{
}
else
{
atomic_add_fetch_32
(
&
pCacheObj
->
statistics
.
missCount
,
1
);
atomic_add_fetch_32
(
&
pCacheObj
->
statistics
.
missCount
,
1
);
u
Debug
(
"cache:%s, key:%p, not in cache, retrieved failed"
,
pCacheObj
->
name
,
key
);
u
Error
(
"cache:%s, key:%p, not in cache, retrieved failed"
,
pCacheObj
->
name
,
key
);
}
}
atomic_add_fetch_32
(
&
pCacheObj
->
statistics
.
totalAccess
,
1
);
atomic_add_fetch_32
(
&
pCacheObj
->
statistics
.
totalAccess
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录