Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
af3bd5bc
T
TDengine
项目概览
taosdata
/
TDengine
11 个月 前同步成功
通知
1179
Star
22014
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,发现更多精彩内容 >>
未验证
提交
af3bd5bc
编写于
12月 04, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
12月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18670 from taosdata/fix/liao_cov
enh(query): avoid repeatly load del file.
上级
df4e9661
0d687a53
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
33 deletion
+44
-33
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+43
-31
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+1
-2
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
af3bd5bc
...
...
@@ -170,7 +170,9 @@ struct STsdbReader {
SIOCostSummary
cost
;
STSchema
*
pSchema
;
// the newest version schema
STSchema
*
pMemSchema
;
// the previous schema for in-memory data, to avoid load schema too many times
SDataFReader
*
pFileReader
;
SDataFReader
*
pFileReader
;
// the file reader
SDelFReader
*
pDelFReader
;
// the del file reader
SArray
*
pDelIdx
;
// del file block index;
SVersionRange
verRange
;
SBlockInfoBuf
blockInfoBuf
;
int32_t
step
;
...
...
@@ -2531,42 +2533,18 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
}
int32_t
code
=
0
;
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
SArray
*
pDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
ASSERT
(
pReader
->
pReadSnap
!=
NULL
);
SDelFile
*
pDelFile
=
pReader
->
pReadSnap
->
fs
.
pDelFile
;
if
(
pDelFile
)
{
SDelFReader
*
pDelFReader
=
NULL
;
code
=
tsdbDelFReaderOpen
(
&
pDelFReader
,
pDelFile
,
pTsdb
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
SArray
*
aDelIdx
=
taosArrayInit
(
4
,
sizeof
(
SDelIdx
));
if
(
aDelIdx
==
NULL
)
{
tsdbDelFReaderClose
(
&
pDelFReader
);
goto
_err
;
}
// TODO: opt the perf of read del index
code
=
tsdbReadDelIdx
(
pDelFReader
,
aDelIdx
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
aDelIdx
);
tsdbDelFReaderClose
(
&
pDelFReader
);
goto
_err
;
}
if
(
pDelFile
&&
taosArrayGetSize
(
pReader
->
pDelIdx
)
>
0
)
{
SDelIdx
idx
=
{.
suid
=
pReader
->
suid
,
.
uid
=
pBlockScanInfo
->
uid
};
SDelIdx
*
pIdx
=
taosArraySearch
(
a
DelIdx
,
&
idx
,
tCmprDelIdx
,
TD_EQ
);
SDelIdx
*
pIdx
=
taosArraySearch
(
pReader
->
p
DelIdx
,
&
idx
,
tCmprDelIdx
,
TD_EQ
);
if
(
pIdx
!=
NULL
)
{
code
=
tsdbReadDelData
(
pDelFReader
,
pIdx
,
pDelData
);
code
=
tsdbReadDelData
(
p
Reader
->
p
DelFReader
,
pIdx
,
pDelData
);
}
taosArrayDestroy
(
aDelIdx
);
tsdbDelFReaderClose
(
&
pDelFReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
...
...
@@ -2662,6 +2640,30 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
}
taosArrayDestroy
(
pIndexList
);
if
(
pReader
->
pReadSnap
!=
NULL
)
{
SDelFile
*
pDelFile
=
pReader
->
pReadSnap
->
fs
.
pDelFile
;
if
(
pReader
->
pDelFReader
==
NULL
&&
pDelFile
!=
NULL
)
{
int32_t
code
=
tsdbDelFReaderOpen
(
&
pReader
->
pDelFReader
,
pDelFile
,
pReader
->
pTsdb
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pReader
->
pDelIdx
=
taosArrayInit
(
4
,
sizeof
(
SDelIdx
));
if
(
pReader
->
pDelIdx
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
}
code
=
tsdbReadDelIdx
(
pReader
->
pDelFReader
,
pReader
->
pDelIdx
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
pReader
->
pDelIdx
);
return
code
;
}
}
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -3912,6 +3914,15 @@ void tsdbReaderClose(STsdbReader* pReader) {
tsdbDataFReaderClose
(
&
pReader
->
pFileReader
);
}
if
(
pReader
->
pDelFReader
!=
NULL
)
{
tsdbDelFReaderClose
(
&
pReader
->
pDelFReader
);
}
if
(
pReader
->
pDelIdx
!=
NULL
)
{
taosArrayDestroy
(
pReader
->
pDelIdx
);
pReader
->
pDelIdx
=
NULL
;
}
tsdbUntakeReadSnap
(
pReader
->
pTsdb
,
pReader
->
pReadSnap
,
pReader
->
idStr
);
taosMemoryFree
(
pReader
->
status
.
uidCheckInfo
.
tableUidList
);
...
...
@@ -3953,6 +3964,9 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
blockDataCleanup
(
pBlock
);
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
if
(
taosHashGetSize
(
pStatus
->
pTableMap
)
==
0
){
return
false
;
}
if
(
pStatus
->
loadFromFile
)
{
int32_t
code
=
buildBlockFromFiles
(
pReader
);
...
...
@@ -3970,8 +3984,6 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
buildBlockFromBufferSequentially
(
pReader
);
return
pBlock
->
info
.
rows
>
0
;
}
return
false
;
}
bool
tsdbNextDataBlock
(
STsdbReader
*
pReader
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
af3bd5bc
...
...
@@ -1477,9 +1477,8 @@ int32_t tsdbDelFReaderClose(SDelFReader **ppReader) {
}
taosMemoryFree
(
pReader
);
}
*
ppReader
=
NULL
;
_exit:
*
ppReader
=
NULL
;
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录