Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
adminstrot
TDengine
提交
4fd1d1f1
TDengine
项目概览
adminstrot
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4fd1d1f1
编写于
8月 02, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]tracking the total number of qhandle in dnode.
上级
24e24ba1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
4 deletion
+26
-4
src/vnode/inc/vnodeInt.h
src/vnode/inc/vnodeInt.h
+1
-0
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+25
-4
未找到文件。
src/vnode/inc/vnodeInt.h
浏览文件 @
4fd1d1f1
...
...
@@ -26,6 +26,7 @@ extern "C" {
#include "vnode.h"
extern
int32_t
vDebugFlag
;
extern
int32_t
vNumOfExistedQHandle
;
// current initialized and existed query handle in current dnode
#define vFatal(...) { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", 255, __VA_ARGS__); }}
#define vError(...) { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", 255, __VA_ARGS__); }}
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
4fd1d1f1
...
...
@@ -21,6 +21,8 @@
#include "query.h"
#include "vnodeStatus.h"
int32_t
vNumOfExistedQHandle
;
// current initialized and existed query handle in current dnode
static
int32_t
(
*
vnodeProcessReadMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SVnodeObj
*
pVnode
,
SVReadMsg
*
pRead
);
static
int32_t
vnodeProcessQueryMsg
(
SVnodeObj
*
pVnode
,
SVReadMsg
*
pRead
);
static
int32_t
vnodeProcessFetchMsg
(
SVnodeObj
*
pVnode
,
SVReadMsg
*
pRead
);
...
...
@@ -247,7 +249,8 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
handle
==
NULL
)
{
// failed to register qhandle
pRsp
->
code
=
terrno
;
terrno
=
0
;
vError
(
"vgId:%d, QInfo:0x%"
PRIx64
"-%p register qhandle failed, return to app, code:%s"
,
pVnode
->
vgId
,
qId
,
(
void
*
)
pQInfo
,
vError
(
"vgId:%d, QInfo:0x%"
PRIx64
"-%p register qhandle failed, return to app, code:%s,"
,
pVnode
->
vgId
,
qId
,
(
void
*
)
pQInfo
,
tstrerror
(
pRsp
->
code
));
qDestroyQueryInfo
(
pQInfo
);
// destroy it directly
return
pRsp
->
code
;
...
...
@@ -260,10 +263,12 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
qId
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:0x%"
PRIx64
"-%p, query discarded since link is broken, %p"
,
pVnode
->
vgId
,
qId
,
*
handle
,
pRead
->
rpcHandle
);
pRsp
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
return
pRsp
->
code
;
}
}
else
{
assert
(
pQInfo
==
NULL
);
}
...
...
@@ -277,6 +282,9 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
return
pRsp
->
code
;
}
}
int32_t
remain
=
atomic_add_fetch_32
(
&
vNumOfExistedQHandle
,
1
);
vTrace
(
"vgId:%d, new qhandle created, total qhandle:%d"
,
pVnode
->
vgId
,
remain
);
}
else
{
assert
(
pCont
!=
NULL
);
void
**
qhandle
=
(
void
**
)
pRead
->
qhandle
;
...
...
@@ -318,8 +326,14 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// NOTE: if the qhandle is not put into vread queue or query is completed, free the qhandle.
// If the building of result is not required, simply free it. Otherwise, mandatorily free the qhandle
if
(
freehandle
||
(
!
buildRes
))
{
if
(
freehandle
)
{
int32_t
remain
=
atomic_sub_fetch_32
(
&
vNumOfExistedQHandle
,
1
);
vTrace
(
"vgId:%d, QInfo:%p, start to free qhandle, remain qhandle:%d"
,
pVnode
->
vgId
,
*
qhandle
,
remain
);
}
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
qhandle
,
freehandle
);
}
}
}
...
...
@@ -357,7 +371,10 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// kill current query and free corresponding resources.
if
(
pRetrieve
->
free
==
1
)
{
vWarn
(
"vgId:%d, QInfo:%"
PRIx64
"-%p, retrieve msg received to kill query and free qhandle"
,
pVnode
->
vgId
,
pRetrieve
->
qId
,
*
handle
);
int32_t
remain
=
atomic_sub_fetch_32
(
&
vNumOfExistedQHandle
,
1
);
vWarn
(
"vgId:%d, QInfo:%"
PRIx64
"-%p, retrieve msg received to kill query and free qhandle, remain qhandle:%d"
,
pVnode
->
vgId
,
pRetrieve
->
qId
,
*
handle
,
remain
);
qKillQuery
(
*
handle
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
...
...
@@ -368,7 +385,10 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// register the qhandle to connect to quit query immediate if connection is broken
if
(
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
pRetrieve
->
qId
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:%"
PRIu64
"-%p, retrieve discarded since link is broken, conn:%p"
,
pVnode
->
vgId
,
pRetrieve
->
qhandle
,
*
handle
,
pRead
->
rpcHandle
);
int32_t
remain
=
atomic_sub_fetch_32
(
&
vNumOfExistedQHandle
,
1
);
vError
(
"vgId:%d, QInfo:%"
PRIu64
"-%p, retrieve discarded since link is broken, conn:%p, remain qhandle:%d"
,
pVnode
->
vgId
,
pRetrieve
->
qhandle
,
*
handle
,
pRead
->
rpcHandle
,
remain
);
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
qKillQuery
(
*
handle
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
...
...
@@ -390,7 +410,6 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
!
tsRetrieveBlockingModel
)
{
if
(
!
buildRes
)
{
assert
(
pRead
->
rpcHandle
!=
NULL
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
false
);
return
TSDB_CODE_QRY_NOT_READY
;
}
...
...
@@ -403,6 +422,8 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// If qhandle is not added into vread queue, the query should be completed already or paused with error.
// Here free qhandle immediately
if
(
freeHandle
)
{
int32_t
remain
=
atomic_sub_fetch_32
(
&
vNumOfExistedQHandle
,
1
);
vTrace
(
"vgId:%d, QInfo:%p, start to free qhandle, remain qhandle:%d"
,
pVnode
->
vgId
,
*
handle
,
remain
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录