Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f14c76d2
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f14c76d2
编写于
8月 06, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-805] decrease the memory consumption during interval query.
上级
9191700f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
6 deletion
+25
-6
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+19
-5
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+4
-0
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
f14c76d2
...
...
@@ -52,10 +52,10 @@ typedef struct SWindowStatus {
typedef
struct
SWindowResult
{
uint16_t
numOfRows
;
// number of rows of current time window
SWindowStatus
status
;
// this result status: closed or opened
SPosInfo
pos
;
// Position of current result in disk-based output buffer
SResultInfo
*
resultInfo
;
// For each result column, there is a resultInfo
STimeWindow
window
;
// The time window that current result covers.
SWindowStatus
status
;
// this result status: closed or opened
}
SWindowResult
;
/**
...
...
@@ -122,6 +122,7 @@ typedef struct SQueryCostInfo {
uint32_t
discardBlocks
;
uint64_t
elapsedTime
;
uint64_t
computTime
;
uint64_t
internalSupSize
;
}
SQueryCostInfo
;
typedef
struct
SQuery
{
...
...
src/query/src/qExecutor.c
浏览文件 @
f14c76d2
...
...
@@ -398,8 +398,18 @@ static SWindowResult *doSetTimeWindowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SWin
// more than the capacity, reallocate the resources
if
(
pWindowResInfo
->
size
>=
pWindowResInfo
->
capacity
)
{
int64_t
newCap
=
pWindowResInfo
->
capacity
*
1
.
5
;
int64_t
newCap
=
0
;
if
(
pWindowResInfo
->
capacity
>
10000
)
{
newCap
=
pWindowResInfo
->
capacity
*
1
.
25
;
}
else
{
newCap
=
pWindowResInfo
->
capacity
*
1
.
5
;
}
printf
(
"%ld
\n
"
,
newCap
);
char
*
t
=
realloc
(
pWindowResInfo
->
pResult
,
newCap
*
sizeof
(
SWindowResult
));
pRuntimeEnv
->
summary
.
internalSupSize
+=
(
newCap
-
pWindowResInfo
->
capacity
)
*
sizeof
(
SWindowResult
);
if
(
t
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
...
...
@@ -2659,7 +2669,7 @@ int32_t mergeIntoGroupResult(SQInfo *pQInfo) {
qDebug
(
"QInfo:%p no result in group %d, continue"
,
pQInfo
,
pQInfo
->
groupIndex
-
1
);
}
if
(
pQInfo
->
groupIndex
==
numOfGroups
)
{
if
(
pQInfo
->
groupIndex
==
numOfGroups
&&
pQInfo
->
offset
==
pQInfo
->
numOfGroupResultPages
)
{
SET_STABLE_QUERY_OVER
(
pQInfo
);
}
...
...
@@ -2705,7 +2715,6 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
memcpy
(
pDest
+
offset
*
bytes
,
pData
->
data
+
pRuntimeEnv
->
offset
[
i
]
*
pData
->
num
,
bytes
*
pData
->
num
);
}
// rows += pData->num;
offset
+=
pData
->
num
;
}
...
...
@@ -2796,6 +2805,11 @@ int32_t mergeIntoGroupResultImpl(SQInfo *pQInfo, SArray *pGroup) {
int64_t
startt
=
taosGetTimestampMs
();
while
(
1
)
{
if
(
IS_QUERY_KILLED
(
pQInfo
))
{
qDebug
(
"QInfo:%p it is already killed, abort"
,
pQInfo
);
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_TSC_QUERY_CANCELLED
);
}
int32_t
pos
=
pTree
->
pNode
[
0
].
index
;
SWindowResInfo
*
pWindowResInfo
=
&
pTableList
[
pos
]
->
windowResInfo
;
...
...
@@ -3958,6 +3972,8 @@ static void queryCostStatis(SQInfo *pQInfo) {
" load data block:%d, total rows:%"
PRId64
", check rows:%"
PRId64
,
pQInfo
,
pSummary
->
elapsedTime
,
pSummary
->
totalBlocks
,
pSummary
->
loadBlockStatis
,
pSummary
->
loadBlocks
,
pSummary
->
totalRows
,
pSummary
->
totalCheckedRows
);
qDebug
(
"QInfo:%p :cost summary: internal size:%"
PRId64
,
pQInfo
,
pSummary
->
internalSupSize
);
}
static
void
updateOffsetVal
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SDataBlockInfo
*
pBlockInfo
)
{
...
...
@@ -6039,8 +6055,6 @@ static void freeQInfo(SQInfo *pQInfo) {
}
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
setQueryKilled
(
pQInfo
);
qDebug
(
"QInfo:%p start to free QInfo"
,
pQInfo
);
for
(
int32_t
col
=
0
;
col
<
pQuery
->
numOfOutput
;
++
col
)
{
taosTFree
(
pQuery
->
sdata
[
col
]);
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
f14c76d2
...
...
@@ -251,6 +251,10 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
return
code
;
}
// todo add more error check here
// register the qhandle to connect to quit query immediate if connection is broken
vnodeNotifyCurrentQhandle
(
pReadMsg
->
rpcMsg
.
handle
,
*
handle
,
pVnode
->
vgId
);
bool
freeHandle
=
true
;
bool
buildRes
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录