Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
083de75a
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
083de75a
编写于
7月 13, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query):fix memory leak.
上级
dfb0511e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
20 deletion
+44
-20
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+0
-2
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+18
-7
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+16
-3
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+0
-6
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+10
-2
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
083de75a
...
@@ -1174,8 +1174,6 @@ int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows)
...
@@ -1174,8 +1174,6 @@ int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows)
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
)
{
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
// ASSERT(numOfRows > 0);
if
(
numOfRows
==
0
)
{
if
(
numOfRows
==
0
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
083de75a
...
@@ -234,6 +234,7 @@ static void destroyBlockScanInfo(SHashObj* pTableMap) {
...
@@ -234,6 +234,7 @@ static void destroyBlockScanInfo(SHashObj* pTableMap) {
}
}
taosArrayDestroy
(
p
->
delSkyline
);
taosArrayDestroy
(
p
->
delSkyline
);
taosArrayDestroy
(
p
->
pBlockList
);
p
->
delSkyline
=
NULL
;
p
->
delSkyline
=
NULL
;
}
}
...
@@ -302,9 +303,9 @@ static bool filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader) {
...
@@ -302,9 +303,9 @@ static bool filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader) {
STimeWindow
win
=
{
0
};
STimeWindow
win
=
{
0
};
while
(
1
)
{
while
(
1
)
{
//
if (pReader->pFileReader != NULL) {
if
(
pReader
->
pFileReader
!=
NULL
)
{
//
tsdbDataFReaderClose(&pReader->pFileReader);
tsdbDataFReaderClose
(
&
pReader
->
pFileReader
);
//
}
}
pReader
->
status
.
pCurrentFileset
=
(
SDFileSet
*
)
taosArrayGet
(
pIter
->
pFileList
,
pIter
->
index
);
pReader
->
status
.
pCurrentFileset
=
(
SDFileSet
*
)
taosArrayGet
(
pIter
->
pFileList
,
pIter
->
index
);
...
@@ -696,12 +697,14 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, uint32_
...
@@ -696,12 +697,14 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, uint32_
void
*
p
=
taosArrayPush
(
pScanInfo
->
pBlockList
,
&
block
);
void
*
p
=
taosArrayPush
(
pScanInfo
->
pBlockList
,
&
block
);
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
tMapDataClear
(
&
mapData
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
(
*
numOfBlocks
)
+=
1
;
(
*
numOfBlocks
)
+=
1
;
}
}
tMapDataClear
(
&
mapData
);
if
(
pScanInfo
->
pBlockList
!=
NULL
&&
taosArrayGetSize
(
pScanInfo
->
pBlockList
)
>
0
)
{
if
(
pScanInfo
->
pBlockList
!=
NULL
&&
taosArrayGetSize
(
pScanInfo
->
pBlockList
)
>
0
)
{
(
*
numOfValidTables
)
+=
1
;
(
*
numOfValidTables
)
+=
1
;
}
}
...
@@ -1308,6 +1311,8 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
...
@@ -1308,6 +1311,8 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
pReader
->
idStr
);
pReader
->
idStr
);
pBlockIter
->
index
=
asc
?
0
:
(
numOfBlocks
-
1
);
pBlockIter
->
index
=
asc
?
0
:
(
numOfBlocks
-
1
);
cleanupBlockOrderSupporter
(
&
sup
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1990,6 +1995,7 @@ static TSDBKEY getCurrentKeyInBuf(SDataBlockIter* pBlockIter, STsdbReader* pRead
...
@@ -1990,6 +1995,7 @@ static TSDBKEY getCurrentKeyInBuf(SDataBlockIter* pBlockIter, STsdbReader* pRead
static
int32_t
moveToNextFile
(
STsdbReader
*
pReader
,
int32_t
*
numOfBlocks
)
{
static
int32_t
moveToNextFile
(
STsdbReader
*
pReader
,
int32_t
*
numOfBlocks
)
{
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
SArray
*
pIndexList
=
taosArrayInit
(
4
,
sizeof
(
SBlockIdx
));
while
(
1
)
{
while
(
1
)
{
bool
hasNext
=
filesetIteratorNext
(
&
pStatus
->
fileIter
,
pReader
);
bool
hasNext
=
filesetIteratorNext
(
&
pStatus
->
fileIter
,
pReader
);
...
@@ -1997,9 +2003,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
...
@@ -1997,9 +2003,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
break
;
break
;
}
}
SArray
*
pIndexList
=
taosArrayInit
(
4
,
sizeof
(
SBlockIdx
)
);
taosArrayClear
(
pIndexList
);
int32_t
code
=
doLoadBlockIndex
(
pReader
,
pReader
->
pFileReader
,
pIndexList
);
int32_t
code
=
doLoadBlockIndex
(
pReader
,
pReader
->
pFileReader
,
pIndexList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
pIndexList
);
return
code
;
return
code
;
}
}
...
@@ -2007,6 +2014,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
...
@@ -2007,6 +2014,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
uint32_t
numOfValidTable
=
0
;
uint32_t
numOfValidTable
=
0
;
code
=
doLoadFileBlock
(
pReader
,
pIndexList
,
&
numOfValidTable
,
numOfBlocks
);
code
=
doLoadFileBlock
(
pReader
,
pIndexList
,
&
numOfValidTable
,
numOfBlocks
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
pIndexList
);
return
code
;
return
code
;
}
}
...
@@ -2014,10 +2022,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
...
@@ -2014,10 +2022,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
break
;
break
;
}
}
}
}
// no blocks in current file, try next files
// no blocks in current file, try next files
}
}
taosArrayDestroy
(
pIndexList
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -3081,10 +3089,13 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa
...
@@ -3081,10 +3089,13 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa
SDataBlockIter
*
pBlockIter
=
&
pStatus
->
blockIter
;
SDataBlockIter
*
pBlockIter
=
&
pStatus
->
blockIter
;
pTableBlockInfo
->
numOfFiles
+=
pStatus
->
fileIter
.
numOfFiles
;
pTableBlockInfo
->
numOfFiles
+=
pStatus
->
fileIter
.
numOfFiles
;
pTableBlockInfo
->
numOfBlocks
+=
pBlockIter
->
numOfBlocks
;
if
(
pBlockIter
->
numOfBlocks
>
0
)
{
pTableBlockInfo
->
numOfBlocks
+=
pBlockIter
->
numOfBlocks
;
}
pTableBlockInfo
->
numOfTables
=
numOfTables
;
pTableBlockInfo
->
numOfTables
=
numOfTables
;
bool
hasNext
=
true
;
bool
hasNext
=
(
pBlockIter
->
numOfBlocks
>
0
)
;
while
(
true
)
{
while
(
true
)
{
if
(
hasNext
)
{
if
(
hasNext
)
{
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
083de75a
...
@@ -3475,10 +3475,13 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
...
@@ -3475,10 +3475,13 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
static
void
destroyExprInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfExprs
)
{
static
void
destroyExprInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfExprs
)
{
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SExprInfo
*
pExprInfo
=
&
pExpr
[
i
];
SExprInfo
*
pExprInfo
=
&
pExpr
[
i
];
if
(
pExprInfo
->
pExpr
->
nodeType
==
QUERY_NODE_COLUMN
)
{
for
(
int32_t
j
=
0
;
j
<
pExprInfo
->
base
.
numOfParams
;
++
j
)
{
taosMemoryFree
(
pExprInfo
->
base
.
pParam
[
0
].
pCol
);
if
(
pExprInfo
->
base
.
pParam
[
j
].
type
==
FUNC_PARAM_TYPE_COLUMN
)
{
taosMemoryFreeClear
(
pExprInfo
->
base
.
pParam
[
j
].
pCol
);
}
taosMemoryFree
(
pExprInfo
->
base
.
pParam
);
}
}
taosMemoryFree
(
pExprInfo
->
base
.
pParam
);
taosMemoryFree
(
pExprInfo
->
pExpr
);
taosMemoryFree
(
pExprInfo
->
pExpr
);
}
}
}
}
...
@@ -3685,10 +3688,20 @@ void destroyBasicOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -3685,10 +3688,20 @@ void destroyBasicOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear
(
param
);
taosMemoryFreeClear
(
param
);
}
}
static
void
freeItem
(
void
*
pItem
)
{
void
**
p
=
pItem
;
if
(
*
p
!=
NULL
)
{
taosMemoryFreeClear
(
*
p
);
}
}
void
destroyAggOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
void
destroyAggOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SAggOperatorInfo
*
pInfo
=
(
SAggOperatorInfo
*
)
param
;
SAggOperatorInfo
*
pInfo
=
(
SAggOperatorInfo
*
)
param
;
cleanupBasicInfo
(
&
pInfo
->
binfo
);
cleanupBasicInfo
(
&
pInfo
->
binfo
);
cleanupAggSup
(
&
pInfo
->
aggSup
);
taosArrayDestroyEx
(
pInfo
->
groupResInfo
.
pRows
,
freeItem
);
taosMemoryFreeClear
(
param
);
taosMemoryFreeClear
(
param
);
}
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
083de75a
...
@@ -196,12 +196,6 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
...
@@ -196,12 +196,6 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
pBlockInfo
->
window
.
skey
,
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
pBlockInfo
->
window
.
skey
,
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
pCost
->
skipBlocks
+=
1
;
pCost
->
skipBlocks
+=
1
;
// clear all data in pBlock that are set when handing the previous block
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
);
++
i
)
{
SColumnInfoData
*
pcol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pcol
->
pData
=
NULL
;
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
*
status
==
FUNC_DATA_REQUIRED_STATIS_LOAD
)
{
}
else
if
(
*
status
==
FUNC_DATA_REQUIRED_STATIS_LOAD
)
{
pCost
->
loadBlockStatis
+=
1
;
pCost
->
loadBlockStatis
+=
1
;
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
083de75a
...
@@ -5559,6 +5559,10 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -5559,6 +5559,10 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
if
(
pData
->
totalRows
==
0
)
{
pData
->
minRows
=
0
;
}
int32_t
row
=
0
;
int32_t
row
=
0
;
char
st
[
256
]
=
{
0
};
char
st
[
256
]
=
{
0
};
double
totalRawSize
=
pData
->
totalRows
*
pData
->
rowSize
;
double
totalRawSize
=
pData
->
totalRows
*
pData
->
rowSize
;
...
@@ -5570,10 +5574,14 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -5570,10 +5574,14 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
varDataSetLen
(
st
,
len
);
varDataSetLen
(
st
,
len
);
colDataAppend
(
pColInfo
,
row
++
,
st
,
false
);
colDataAppend
(
pColInfo
,
row
++
,
st
,
false
);
int64_t
avgRows
=
0
;
if
(
pData
->
numOfBlocks
>
0
)
{
avgRows
=
pData
->
totalRows
/
pData
->
numOfBlocks
;
}
len
=
sprintf
(
st
+
VARSTR_HEADER_SIZE
,
len
=
sprintf
(
st
+
VARSTR_HEADER_SIZE
,
"Total_Rows=[%"
PRId64
"] Inmem_Rows=[%d] MinRows=[%d] MaxRows=[%d] Average_Rows=[%"
PRId64
"]"
,
"Total_Rows=[%"
PRId64
"] Inmem_Rows=[%d] MinRows=[%d] MaxRows=[%d] Average_Rows=[%"
PRId64
"]"
,
pData
->
totalRows
,
pData
->
numOfInmemRows
,
pData
->
minRows
,
pData
->
maxRows
,
pData
->
totalRows
,
pData
->
numOfInmemRows
,
pData
->
minRows
,
pData
->
maxRows
,
avgRows
);
pData
->
totalRows
/
pData
->
numOfBlocks
);
varDataSetLen
(
st
,
len
);
varDataSetLen
(
st
,
len
);
colDataAppend
(
pColInfo
,
row
++
,
st
,
false
);
colDataAppend
(
pColInfo
,
row
++
,
st
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录