Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
424dd400
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看板
提交
424dd400
编写于
7月 24, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tsdb/cache: reuse pDataFileReader for same fileset
上级
968cfd9e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
36 deletion
+60
-36
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-0
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+59
-36
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
424dd400
...
@@ -877,6 +877,7 @@ typedef struct SCacheRowsReader {
...
@@ -877,6 +877,7 @@ typedef struct SCacheRowsReader {
SSHashObj
*
pTableMap
;
SSHashObj
*
pTableMap
;
SArray
*
pLDataIterArray
;
SArray
*
pLDataIterArray
;
struct
SDataFileReader
*
pFileReader
;
struct
SDataFileReader
*
pFileReader
;
STFileSet
*
pCurFileSet
;
STsdbReadSnap
*
pReadSnap
;
STsdbReadSnap
*
pReadSnap
;
char
*
idstr
;
char
*
idstr
;
int64_t
lastTs
;
int64_t
lastTs
;
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
424dd400
...
@@ -1949,35 +1949,39 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
...
@@ -1949,35 +1949,39 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
STFileObj
**
pFileObj
=
state
->
pFileSet
->
farr
;
STFileObj
**
pFileObj
=
state
->
pFileSet
->
farr
;
if
(
pFileObj
[
0
]
!=
NULL
||
pFileObj
[
3
]
!=
NULL
)
{
if
(
pFileObj
[
0
]
!=
NULL
||
pFileObj
[
3
]
!=
NULL
)
{
SDataFileReaderConfig
conf
=
{.
tsdb
=
state
->
pTsdb
,
.
szPage
=
state
->
pTsdb
->
pVnode
->
config
.
szPage
};
if
(
state
->
pFileSet
!=
state
->
pr
->
pCurFileSet
)
{
const
char
*
filesName
[
4
]
=
{
0
};
SDataFileReaderConfig
conf
=
{.
tsdb
=
state
->
pTsdb
,
.
szPage
=
state
->
pTsdb
->
pVnode
->
config
.
szPage
};
if
(
pFileObj
[
0
]
!=
NULL
)
{
const
char
*
filesName
[
4
]
=
{
0
};
conf
.
files
[
0
].
file
=
*
pFileObj
[
0
]
->
f
;
if
(
pFileObj
[
0
]
!=
NULL
)
{
conf
.
files
[
0
].
exist
=
true
;
conf
.
files
[
0
].
file
=
*
pFileObj
[
0
]
->
f
;
filesName
[
0
]
=
pFileObj
[
0
]
->
fname
;
conf
.
files
[
0
].
exist
=
true
;
filesName
[
0
]
=
pFileObj
[
0
]
->
fname
;
conf
.
files
[
1
].
file
=
*
pFileObj
[
1
]
->
f
;
conf
.
files
[
1
].
exist
=
true
;
filesName
[
1
]
=
pFileObj
[
1
]
->
fname
;
conf
.
files
[
2
].
file
=
*
pFileObj
[
2
]
->
f
;
conf
.
files
[
2
].
exist
=
true
;
filesName
[
2
]
=
pFileObj
[
2
]
->
fname
;
}
conf
.
files
[
1
].
file
=
*
pFileObj
[
1
]
->
f
;
if
(
pFileObj
[
3
]
!=
NULL
)
{
conf
.
files
[
1
].
exist
=
true
;
conf
.
files
[
3
].
exist
=
true
;
filesName
[
1
]
=
pFileObj
[
1
]
->
fname
;
conf
.
files
[
3
].
file
=
*
pFileObj
[
3
]
->
f
;
filesName
[
3
]
=
pFileObj
[
3
]
->
fname
;
}
co
nf
.
files
[
2
].
file
=
*
pFileObj
[
2
]
->
f
;
co
de
=
tsdbDataFileReaderOpen
(
filesName
,
&
conf
,
&
state
->
pr
->
pFileReader
)
;
conf
.
files
[
2
].
exist
=
true
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
filesName
[
2
]
=
pFileObj
[
2
]
->
fname
;
goto
_err
;
}
}
if
(
pFileObj
[
3
]
!=
NULL
)
{
loadDataTomb
(
state
->
pr
,
state
->
pr
->
pFileReader
);
conf
.
files
[
3
].
exist
=
true
;
conf
.
files
[
3
].
file
=
*
pFileObj
[
3
]
->
f
;
filesName
[
3
]
=
pFileObj
[
3
]
->
fname
;
}
code
=
tsdbDataFileReaderOpen
(
filesName
,
&
conf
,
&
state
->
pr
->
pFileReader
);
state
->
pr
->
pCurFileSet
=
state
->
pFileSet
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
}
loadDataTomb
(
state
->
pr
,
state
->
pr
->
pFileReader
);
if
(
!
state
->
pIndexList
)
{
if
(
!
state
->
pIndexList
)
{
state
->
pIndexList
=
taosArrayInit
(
1
,
sizeof
(
SBrinBlk
));
state
->
pIndexList
=
taosArrayInit
(
1
,
sizeof
(
SBrinBlk
));
}
else
{
}
else
{
...
@@ -2218,19 +2222,6 @@ _err:
...
@@ -2218,19 +2222,6 @@ _err:
return
code
;
return
code
;
}
}
int32_t
clearNextRowFromFS
(
void
*
iter
)
{
int32_t
code
=
0
;
SFSNextRowIter
*
state
=
(
SFSNextRowIter
*
)
iter
;
if
(
!
state
)
{
return
code
;
}
clearLastFileSet
(
state
);
return
code
;
}
typedef
enum
SMEMNEXTROWSTATES
{
typedef
enum
SMEMNEXTROWSTATES
{
SMEMNEXTROW_ENTER
,
SMEMNEXTROW_ENTER
,
SMEMNEXTROW_NEXT
,
SMEMNEXTROW_NEXT
,
...
@@ -2350,6 +2341,36 @@ typedef struct CacheNextRowIter {
...
@@ -2350,6 +2341,36 @@ typedef struct CacheNextRowIter {
STsdb
*
pTsdb
;
STsdb
*
pTsdb
;
}
CacheNextRowIter
;
}
CacheNextRowIter
;
int32_t
clearNextRowFromFS
(
void
*
iter
)
{
int32_t
code
=
0
;
SFSNextRowIter
*
state
=
(
SFSNextRowIter
*
)
iter
;
if
(
!
state
)
{
return
code
;
}
if
(
state
->
pLastIter
)
{
lastIterClose
(
&
state
->
pLastIter
);
}
if
(
state
->
pBlockData
)
{
tBlockDataDestroy
(
state
->
pBlockData
);
state
->
pBlockData
=
NULL
;
}
if
(
state
->
pTSRow
)
{
taosMemoryFree
(
state
->
pTSRow
);
state
->
pTSRow
=
NULL
;
}
if
(
state
->
pRowIter
->
pSkyline
)
{
taosArrayDestroy
(
state
->
pRowIter
->
pSkyline
);
state
->
pRowIter
->
pSkyline
=
NULL
;
}
return
code
;
}
static
void
clearLastFileSet
(
SFSNextRowIter
*
state
)
{
static
void
clearLastFileSet
(
SFSNextRowIter
*
state
)
{
if
(
state
->
pLastIter
)
{
if
(
state
->
pLastIter
)
{
lastIterClose
(
&
state
->
pLastIter
);
lastIterClose
(
&
state
->
pLastIter
);
...
@@ -2363,6 +2384,8 @@ static void clearLastFileSet(SFSNextRowIter *state) {
...
@@ -2363,6 +2384,8 @@ static void clearLastFileSet(SFSNextRowIter *state) {
if
(
state
->
pr
->
pFileReader
)
{
if
(
state
->
pr
->
pFileReader
)
{
tsdbDataFileReaderClose
(
&
state
->
pr
->
pFileReader
);
tsdbDataFileReaderClose
(
&
state
->
pr
->
pFileReader
);
state
->
pr
->
pFileReader
=
NULL
;
state
->
pr
->
pFileReader
=
NULL
;
state
->
pr
->
pCurFileSet
=
NULL
;
}
}
if
(
state
->
pTSRow
)
{
if
(
state
->
pTSRow
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录