Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3d835e72
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看板
提交
3d835e72
编写于
12月 23, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-12275]<fix>(query):deal with allocation failure when extends output buf
上级
6b75c606
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
14 deletion
+16
-14
src/client/src/tscGlobalmerge.c
src/client/src/tscGlobalmerge.c
+2
-2
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+13
-11
未找到文件。
src/client/src/tscGlobalmerge.c
浏览文件 @
3d835e72
...
...
@@ -902,7 +902,7 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
// not belongs to the same group, return the result of current group;
setInputDataBlock
(
pOperator
,
pAggInfo
->
binfo
.
pCtx
,
pAggInfo
->
pExistBlock
,
TSDB_ORDER_ASC
);
updateOutputBuf
(
&
pAggInfo
->
binfo
,
&
pAggInfo
->
bufCapacity
,
pAggInfo
->
pExistBlock
->
info
.
rows
);
updateOutputBuf
(
&
pAggInfo
->
binfo
,
&
pAggInfo
->
bufCapacity
,
pAggInfo
->
pExistBlock
->
info
.
rows
,
pOperator
->
pRuntimeEnv
);
{
// reset output buffer
for
(
int32_t
j
=
0
;
j
<
pOperator
->
numOfOutput
;
++
j
)
{
...
...
@@ -954,7 +954,7 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
// not belongs to the same group, return the result of current group
setInputDataBlock
(
pOperator
,
pAggInfo
->
binfo
.
pCtx
,
pBlock
,
TSDB_ORDER_ASC
);
updateOutputBuf
(
&
pAggInfo
->
binfo
,
&
pAggInfo
->
bufCapacity
,
pBlock
->
info
.
rows
*
pAggInfo
->
resultRowFactor
);
updateOutputBuf
(
&
pAggInfo
->
binfo
,
&
pAggInfo
->
bufCapacity
,
pBlock
->
info
.
rows
*
pAggInfo
->
resultRowFactor
,
pOperator
->
pRuntimeEnv
);
doExecuteFinalMerge
(
pOperator
,
pOperator
->
numOfOutput
,
pBlock
);
savePrevOrderColumns
(
pAggInfo
->
currentGroupColData
,
pAggInfo
->
groupColumnList
,
pBlock
,
0
,
&
pAggInfo
->
hasGroupColData
);
...
...
src/query/inc/qExecutor.h
浏览文件 @
3d835e72
...
...
@@ -659,7 +659,7 @@ void* doDestroyFilterInfo(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFil
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
int32_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
finalizeQueryResult
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SResultRowInfo
*
pResultRowInfo
,
int32_t
*
rowCellInfoOffset
);
void
updateOutputBuf
(
SOptrBasicInfo
*
pBInfo
,
int32_t
*
bufCapacity
,
int32_t
numOfInputRows
);
void
updateOutputBuf
(
SOptrBasicInfo
*
pBInfo
,
int32_t
*
bufCapacity
,
int32_t
numOfInputRows
,
SQueryRuntimeEnv
*
runtimeEnv
);
void
clearOutputBuf
(
SOptrBasicInfo
*
pBInfo
,
int32_t
*
bufCapacity
);
void
copyTsColoum
(
SSDataBlock
*
pRes
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
...
...
src/query/src/qExecutor.c
浏览文件 @
3d835e72
...
...
@@ -1432,7 +1432,7 @@ static void doWindowBorderInterpolation(SOperatorInfo* pOperatorInfo, SSDataBloc
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQueryAttr
->
order
.
order
);
if
(
pBlock
->
pDataBlock
==
NULL
){
tsc
Error
(
"pBlock->pDataBlock == NULL"
);
q
Error
(
"pBlock->pDataBlock == NULL"
);
return
;
}
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
...
...
@@ -3586,7 +3586,7 @@ void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, i
initCtxOutputBuffer
(
pCtx
,
pDataBlock
->
info
.
numOfCols
);
}
void
updateOutputBuf
(
SOptrBasicInfo
*
pBInfo
,
int32_t
*
bufCapacity
,
int32_t
numOfInputRows
)
{
void
updateOutputBuf
(
SOptrBasicInfo
*
pBInfo
,
int32_t
*
bufCapacity
,
int32_t
numOfInputRows
,
SQueryRuntimeEnv
*
runtimeEnv
)
{
SSDataBlock
*
pDataBlock
=
pBInfo
->
pRes
;
int32_t
newSize
=
pDataBlock
->
info
.
rows
+
numOfInputRows
+
5
;
// extra output buffer
...
...
@@ -3602,7 +3602,9 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
pBInfo
->
pCtx
[
i
].
pOutput
=
pColInfo
->
pData
;
(
*
bufCapacity
)
=
newSize
;
}
else
{
// longjmp
size_t
allocateSize
=
newSize
*
pColInfo
->
info
.
bytes
;
qError
(
"can not allocate %zu bytes for output"
,
allocateSize
);
longjmp
(
runtimeEnv
->
env
,
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
}
}
...
...
@@ -5752,7 +5754,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pInfo
->
pCtx
,
pBlock
,
order
);
updateOutputBuf
(
&
pProjectInfo
->
binfo
,
&
pProjectInfo
->
bufCapacity
,
pBlock
->
info
.
rows
);
updateOutputBuf
(
&
pProjectInfo
->
binfo
,
&
pProjectInfo
->
bufCapacity
,
pBlock
->
info
.
rows
,
pOperator
->
pRuntimeEnv
);
projectApplyFunctions
(
pRuntimeEnv
,
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
if
(
pTableQueryInfo
!=
NULL
)
{
...
...
@@ -5818,7 +5820,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pInfo
->
pCtx
,
pBlock
,
order
);
updateOutputBuf
(
&
pProjectInfo
->
binfo
,
&
pProjectInfo
->
bufCapacity
,
pBlock
->
info
.
rows
);
updateOutputBuf
(
&
pProjectInfo
->
binfo
,
&
pProjectInfo
->
bufCapacity
,
pBlock
->
info
.
rows
,
pOperator
->
pRuntimeEnv
);
projectApplyFunctions
(
pRuntimeEnv
,
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
if
(
pTableQueryInfo
!=
NULL
)
{
...
...
@@ -6315,7 +6317,7 @@ static void doTimeEveryImpl(SOperatorInfo* pOperator, SQLFunctionCtx *pCtx, SSDa
break
;
}
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
,
pOperator
->
pRuntimeEnv
);
}
}
}
...
...
@@ -6335,7 +6337,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
pRes
->
info
.
rows
=
0
;
if
(
!
pEveryInfo
->
groupDone
)
{
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
,
pOperator
->
pRuntimeEnv
);
doTimeEveryImpl
(
pOperator
,
pInfo
->
pCtx
,
pEveryInfo
->
lastBlock
,
false
);
if
(
pRes
->
info
.
rows
>=
pRuntimeEnv
->
resultInfo
.
threshold
)
{
copyTsColoum
(
pRes
,
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
...
...
@@ -6371,7 +6373,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pInfo
->
pCtx
,
pBlock
,
order
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
pBlock
->
info
.
rows
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
pBlock
->
info
.
rows
,
pOperator
->
pRuntimeEnv
);
doTimeEveryImpl
(
pOperator
,
pInfo
->
pCtx
,
pBlock
,
*
newgroup
);
if
(
pEveryInfo
->
groupDone
&&
pOperator
->
upstream
[
0
]
->
notify
)
{
...
...
@@ -6397,7 +6399,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
if
(
!
pEveryInfo
->
groupDone
)
{
pEveryInfo
->
allDone
=
true
;
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
,
pOperator
->
pRuntimeEnv
);
doTimeEveryImpl
(
pOperator
,
pInfo
->
pCtx
,
NULL
,
false
);
if
(
pRes
->
info
.
rows
>=
pRuntimeEnv
->
resultInfo
.
threshold
)
{
break
;
...
...
@@ -6418,7 +6420,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
// Return result of the previous group in the firstly.
if
(
*
newgroup
)
{
if
(
!
pEveryInfo
->
groupDone
)
{
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
0
,
pOperator
->
pRuntimeEnv
);
doTimeEveryImpl
(
pOperator
,
pInfo
->
pCtx
,
NULL
,
false
);
if
(
pRes
->
info
.
rows
>=
pRuntimeEnv
->
resultInfo
.
threshold
)
{
pEveryInfo
->
existDataBlock
=
pBlock
;
...
...
@@ -6454,7 +6456,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pInfo
->
pCtx
,
pBlock
,
order
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
pBlock
->
info
.
rows
);
updateOutputBuf
(
&
pEveryInfo
->
binfo
,
&
pEveryInfo
->
bufCapacity
,
pBlock
->
info
.
rows
,
pOperator
->
pRuntimeEnv
);
pEveryInfo
->
groupDone
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录