Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7c7b2f1c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
7c7b2f1c
编写于
11月 22, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix memory leak.
上级
2da5a610
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
14 deletion
+26
-14
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+10
-5
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+5
-5
source/libs/executor/src/cachescanoperator.c
source/libs/executor/src/cachescanoperator.c
+8
-3
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+3
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
7c7b2f1c
...
...
@@ -287,12 +287,17 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
hasRes
=
true
;
p
->
ts
=
pColVal
->
ts
;
uint8_t
*
px
=
p
->
colVal
.
value
.
pData
;
p
->
colVal
=
pColVal
->
colVal
;
if
(
!
IS_VAR_DATA_TYPE
(
pColVal
->
colVal
.
type
))
{
p
->
colVal
=
pColVal
->
colVal
;
}
else
{
if
(
COL_VAL_IS_VALUE
(
&
pColVal
->
colVal
))
{
memcpy
(
p
->
colVal
.
value
.
pData
,
pColVal
->
colVal
.
value
.
pData
,
pColVal
->
colVal
.
value
.
nData
);
}
if
(
COL_VAL_IS_VALUE
(
&
pColVal
->
colVal
)
&&
IS_VAR_DATA_TYPE
(
pColVal
->
colVal
.
type
))
{
p
->
colVal
.
value
.
pData
=
px
;
memcpy
(
px
,
pColVal
->
colVal
.
value
.
pData
,
pColVal
->
colVal
.
value
.
nData
);
p
->
colVal
.
value
.
nData
=
pColVal
->
colVal
.
value
.
nData
;
p
->
colVal
.
type
=
pColVal
->
colVal
.
type
;
p
->
colVal
.
flag
=
pColVal
->
colVal
.
flag
;
p
->
colVal
.
cid
=
pColVal
->
colVal
.
cid
;
}
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
7c7b2f1c
...
...
@@ -305,7 +305,7 @@ static void* getPosInBlockInfoBuf(SBlockInfoBuf* pBuf, int32_t index) {
}
// NOTE: speedup the whole processing by preparing the buffer for STableBlockScanInfo in batch model
static
SHashObj
*
createDataBlockScanInfo
(
STsdbReader
*
pTsdbReader
,
const
STableKeyInfo
*
idList
,
int32_t
numOfTables
)
{
static
SHashObj
*
createDataBlockScanInfo
(
STsdbReader
*
pTsdbReader
,
SBlockInfoBuf
*
pBuf
,
const
STableKeyInfo
*
idList
,
int32_t
numOfTables
)
{
// allocate buffer in order to load data blocks from file
// todo use simple hash instead, optimize the memory consumption
SHashObj
*
pTableMap
=
...
...
@@ -315,10 +315,10 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
}
int64_t
st
=
taosGetTimestampUs
();
initBlockScanInfoBuf
(
&
pTsdbReader
->
blockInfo
Buf
,
numOfTables
);
initBlockScanInfoBuf
(
p
Buf
,
numOfTables
);
for
(
int32_t
j
=
0
;
j
<
numOfTables
;
++
j
)
{
STableBlockScanInfo
*
pScanInfo
=
getPosInBlockInfoBuf
(
&
pTsdbReader
->
blockInfo
Buf
,
j
);
STableBlockScanInfo
*
pScanInfo
=
getPosInBlockInfoBuf
(
p
Buf
,
j
);
pScanInfo
->
uid
=
idList
[
j
].
uid
;
if
(
ASCENDING_TRAVERSE
(
pTsdbReader
->
order
))
{
int64_t
skey
=
pTsdbReader
->
window
.
skey
;
...
...
@@ -3785,9 +3785,9 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
}
STsdbReader
*
p
=
(
pReader
->
innerReader
[
0
]
!=
NULL
)
?
pReader
->
innerReader
[
0
]
:
pReader
;
pReader
->
status
.
pTableMap
=
createDataBlockScanInfo
(
p
,
pTableList
,
numOfTables
);
pReader
->
status
.
pTableMap
=
createDataBlockScanInfo
(
p
,
&
pReader
->
blockInfoBuf
,
pTableList
,
numOfTables
);
if
(
pReader
->
status
.
pTableMap
==
NULL
)
{
tsdbReaderClose
(
p
Reader
);
tsdbReaderClose
(
p
);
*
ppReader
=
NULL
;
code
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
...
...
source/libs/executor/src/cachescanoperator.c
浏览文件 @
7c7b2f1c
...
...
@@ -157,9 +157,12 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
SColumnInfoData
*
pSrc
=
taosArrayGet
(
pInfo
->
pBufferredRes
->
pDataBlock
,
slotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pRes
->
pDataBlock
,
slotId
);
char
*
p
=
colDataGetData
(
pSrc
,
pInfo
->
indexOfBufferedRes
);
bool
isNull
=
colDataIsNull_s
(
pSrc
,
pInfo
->
indexOfBufferedRes
);
colDataAppend
(
pDst
,
0
,
p
,
isNull
);
if
(
colDataIsNull_s
(
pSrc
,
pInfo
->
indexOfBufferedRes
))
{
colDataAppendNULL
(
pDst
,
0
);
}
else
{
char
*
p
=
colDataGetData
(
pSrc
,
pInfo
->
indexOfBufferedRes
);
colDataAppend
(
pDst
,
0
,
p
,
false
);
}
}
pRes
->
info
.
uid
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pInfo
->
pUidList
,
pInfo
->
indexOfBufferedRes
);
...
...
@@ -226,6 +229,8 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
pInfo
->
pLastrowReader
=
tsdbCacherowsReaderClose
(
pInfo
->
pLastrowReader
);
return
pInfo
->
pRes
;
}
else
{
pInfo
->
pLastrowReader
=
tsdbCacherowsReaderClose
(
pInfo
->
pLastrowReader
);
}
}
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
7c7b2f1c
...
...
@@ -6568,7 +6568,9 @@ int32_t cachedLastRowFunction(SqlFunctionCtx* pCtx) {
for
(
int32_t
i
=
pInput
->
numOfRows
+
pInput
->
startRowIndex
-
1
;
i
>=
pInput
->
startRowIndex
;
--
i
)
{
numOfElems
++
;
char
*
data
=
colDataGetData
(
pInputCol
,
i
);
bool
isNull
=
colDataIsNull
(
pInputCol
,
pInput
->
numOfRows
,
i
,
NULL
);
char
*
data
=
isNull
?
NULL
:
colDataGetData
(
pInputCol
,
i
);
TSKEY
cts
=
getRowPTs
(
pInput
->
pPTS
,
i
);
if
(
pResInfo
->
numOfRes
==
0
||
pInfo
->
ts
<
cts
)
{
doSaveLastrow
(
pCtx
,
data
,
i
,
cts
,
pInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录