Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
de06f055
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
de06f055
编写于
6月 27, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: stop query
上级
73dfd117
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
65 addition
and
22 deletion
+65
-22
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+3
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+25
-7
source/client/src/clientHb.c
source/client/src/clientHb.c
+30
-12
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+4
-1
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+0
-1
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+2
-0
tests/script/api/stopquery.c
tests/script/api/stopquery.c
+1
-0
未找到文件。
source/client/inc/clientInt.h
浏览文件 @
de06f055
...
...
@@ -66,7 +66,7 @@ enum {
typedef
struct
SAppInstInfo
SAppInstInfo
;
typedef
struct
{
char
*
key
;
char
*
key
;
// statistics
int32_t
reportCnt
;
int32_t
connKeyCnt
;
...
...
@@ -118,6 +118,7 @@ struct SAppInstInfo {
uint64_t
clusterId
;
void
*
pTransporter
;
SAppHbMgr
*
pAppHbMgr
;
char
*
instKey
;
};
typedef
struct
SAppInfo
{
...
...
@@ -336,6 +337,7 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp);
// cluster level
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
);
void
appHbMgrCleanup
(
void
);
void
hbRemoveAppHbMrg
(
SAppHbMgr
**
pAppHbMgr
);
// conn level
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int8_t
connType
);
...
...
source/client/src/clientEnv.c
浏览文件 @
de06f055
...
...
@@ -79,13 +79,13 @@ static void deregisterRequest(SRequestObj *pRequest) {
}
// todo close the transporter properly
void
closeTransporter
(
S
TscObj
*
pTscObj
)
{
if
(
p
TscObj
==
NULL
||
pTscObj
->
pAppInfo
->
pTransporter
==
NULL
)
{
void
closeTransporter
(
S
AppInstInfo
*
pAppInfo
)
{
if
(
p
AppInfo
==
NULL
||
pAppInfo
->
pTransporter
==
NULL
)
{
return
;
}
tscDebug
(
"free transporter:%p in
connObj: 0x%"
PRIx64
,
pTscObj
->
pAppInfo
->
pTransporter
,
pTscObj
->
id
);
rpcClose
(
p
TscObj
->
p
AppInfo
->
pTransporter
);
tscDebug
(
"free transporter:%p in
app inst %p"
,
pAppInfo
->
pTransporter
,
pAppInfo
);
rpcClose
(
pAppInfo
->
pTransporter
);
}
static
bool
clientRpcRfp
(
int32_t
code
)
{
...
...
@@ -130,6 +130,21 @@ void closeAllRequests(SHashObj *pRequests) {
}
}
void
destroyAppInst
(
SAppInstInfo
*
pAppInfo
)
{
tscDebug
(
"destroy app inst mgr %p"
,
pAppInfo
);
hbRemoveAppHbMrg
(
&
pAppInfo
->
pAppHbMgr
);
taosHashRemove
(
appInfo
.
pInstMap
,
pAppInfo
->
instKey
,
strlen
(
pAppInfo
->
instKey
));
taosMemoryFreeClear
(
pAppInfo
->
instKey
);
closeTransporter
(
pAppInfo
);
taosThreadMutexLock
(
&
pAppInfo
->
qnodeMutex
);
taosArrayDestroy
(
pAppInfo
->
pQnodeList
);
taosThreadMutexUnlock
(
&
pAppInfo
->
qnodeMutex
);
taosMemoryFree
(
pAppInfo
);
}
void
destroyTscObj
(
void
*
pObj
)
{
STscObj
*
pTscObj
=
pObj
;
...
...
@@ -138,11 +153,12 @@ void destroyTscObj(void *pObj) {
int64_t
connNum
=
atomic_sub_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
closeAllRequests
(
pTscObj
->
pRequests
);
schedulerStopQueryHb
(
pTscObj
->
pAppInfo
->
pTransporter
);
tscDebug
(
"connObj 0x%"
PRIx64
" p:%p destroyed, remain inst totalConn:%"
PRId64
,
pTscObj
->
id
,
pTscObj
,
pTscObj
->
pAppInfo
->
numOfConns
);
if
(
0
==
connNum
)
{
closeTransporter
(
pTscObj
);
destroyAppInst
(
pTscObj
->
pAppInfo
);
}
tscDebug
(
"connObj 0x%"
PRIx64
" p:%p destroyed, totalConn:%"
PRId64
,
pTscObj
->
id
,
pTscObj
,
pTscObj
->
pAppInfo
->
numOfConns
);
taosThreadMutexDestroy
(
&
pTscObj
->
mutex
);
taosMemoryFreeClear
(
pTscObj
);
}
...
...
@@ -174,6 +190,8 @@ void *createTscObj(const char *user, const char *auth, const char *db, int32_t c
pObj
->
id
=
taosAddRef
(
clientConnRefPool
,
pObj
);
pObj
->
schemalessType
=
1
;
atomic_add_fetch_64
(
&
pObj
->
pAppInfo
->
numOfConns
,
1
);
tscDebug
(
"connObj created, 0x%"
PRIx64
",p:%p"
,
pObj
->
id
,
pObj
);
return
pObj
;
}
...
...
source/client/src/clientHb.c
浏览文件 @
de06f055
...
...
@@ -790,22 +790,40 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) {
return
pAppHbMgr
;
}
void
hbFreeAppHbMgr
(
SAppHbMgr
*
pTarget
)
{
void
*
pIter
=
taosHashIterate
(
pTarget
->
activeInfo
,
NULL
);
while
(
pIter
!=
NULL
)
{
SClientHbReq
*
pOneReq
=
pIter
;
tFreeClientHbReq
(
pOneReq
);
pIter
=
taosHashIterate
(
pTarget
->
activeInfo
,
pIter
);
}
taosHashCleanup
(
pTarget
->
activeInfo
);
pTarget
->
activeInfo
=
NULL
;
taosMemoryFree
(
pTarget
->
key
);
taosMemoryFree
(
pTarget
);
}
void
hbRemoveAppHbMrg
(
SAppHbMgr
**
pAppHbMgr
)
{
taosThreadMutexLock
(
&
clientHbMgr
.
lock
);
int32_t
mgrSize
=
taosArrayGetSize
(
clientHbMgr
.
appHbMgrs
);
for
(
int32_t
i
=
0
;
i
<
mgrSize
;
++
i
)
{
SAppHbMgr
*
pItem
=
taosArrayGetP
(
clientHbMgr
.
appHbMgrs
,
i
);
if
(
pItem
==
*
pAppHbMgr
)
{
hbFreeAppHbMgr
(
*
pAppHbMgr
);
*
pAppHbMgr
=
NULL
;
taosArrayRemove
(
clientHbMgr
.
appHbMgrs
,
i
);
break
;
}
}
taosThreadMutexUnlock
(
&
clientHbMgr
.
lock
);
}
void
appHbMgrCleanup
(
void
)
{
int
sz
=
taosArrayGetSize
(
clientHbMgr
.
appHbMgrs
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SAppHbMgr
*
pTarget
=
taosArrayGetP
(
clientHbMgr
.
appHbMgrs
,
i
);
void
*
pIter
=
taosHashIterate
(
pTarget
->
activeInfo
,
NULL
);
while
(
pIter
!=
NULL
)
{
SClientHbReq
*
pOneReq
=
pIter
;
tFreeClientHbReq
(
pOneReq
);
pIter
=
taosHashIterate
(
pTarget
->
activeInfo
,
pIter
);
}
taosHashCleanup
(
pTarget
->
activeInfo
);
pTarget
->
activeInfo
=
NULL
;
taosMemoryFree
(
pTarget
->
key
);
taosMemoryFree
(
pTarget
);
hbFreeAppHbMgr
(
pTarget
);
}
}
...
...
source/client/src/clientImpl.c
浏览文件 @
de06f055
...
...
@@ -122,7 +122,10 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
p
->
pTransporter
=
openTransporter
(
user
,
secretEncrypt
,
tsNumOfCores
);
p
->
pAppHbMgr
=
appHbMgrInit
(
p
,
key
);
taosHashPut
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
),
&
p
,
POINTER_BYTES
);
p
->
instKey
=
key
;
key
=
NULL
;
tscDebug
(
"new app inst mgr %p, user:%s, ip:%s, port:%d"
,
p
,
user
,
ip
,
port
);
pInst
=
&
p
;
}
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
de06f055
...
...
@@ -87,7 +87,6 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
// update the appInstInfo
pTscObj
->
pAppInfo
->
clusterId
=
connectRsp
.
clusterId
;
atomic_add_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
pTscObj
->
connType
=
connectRsp
.
connType
;
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
de06f055
...
...
@@ -789,6 +789,8 @@ _return:
int32_t
ctgCallUserCb
(
void
*
param
)
{
SCtgJob
*
pJob
=
(
SCtgJob
*
)
param
;
//taosSsleep(2);
(
*
pJob
->
userFp
)(
&
pJob
->
jobRes
,
pJob
->
userParam
,
pJob
->
jobResCode
);
...
...
tests/script/api/stopquery.c
浏览文件 @
de06f055
...
...
@@ -368,6 +368,7 @@ void *closeThreadFp(void *arg) {
while
(
true
)
{
if
(
qParam
->
taos
)
{
usleep
(
rand
()
%
10000
);
//usleep(1000000);
taos_close
(
qParam
->
taos
);
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录