Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
94f4d746
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看板
提交
94f4d746
编写于
9月 01, 2022
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tsdbCache: support multi-last data reading
上级
39215ec1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
103 deletion
+18
-103
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+18
-103
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
94f4d746
...
...
@@ -418,31 +418,16 @@ typedef enum {
}
SFSLASTNEXTROWSTATES
;
typedef
struct
{
SFSLASTNEXTROWSTATES
state
;
// [input]
STsdb
*
pTsdb
;
// [input]
SBlockIdx
*
pBlockIdxExp
;
// [input]
STSchema
*
pTSchema
;
// [input]
tb_uid_t
suid
;
SFSLASTNEXTROWSTATES
state
;
// [input]
STsdb
*
pTsdb
;
// [input]
tb_uid_t
uid
;
int32_t
nFileSet
;
int32_t
iFileSet
;
SArray
*
aDFileSet
;
SDataFReader
*
pDataFReader
;
SArray
*
aBlockL
;
SBlockL
*
pBlockL
;
SBlockData
*
pBlockDataL
;
SBlockData
blockDataL
;
int32_t
nRow
;
int32_t
iRow
;
TSDBROW
row
;
/*
SArray *aBlockIdx;
SBlockIdx *pBlockIdx;
SMapData blockMap;
int32_t nBlock;
int32_t iBlock;
SBlock block;
*/
SMergeTree
mergeTree
;
}
SFSLastNextRowIter
;
static
int32_t
getNextRowFromFSLast
(
void
*
iter
,
TSDBROW
**
ppRow
)
{
...
...
@@ -451,22 +436,16 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) {
switch
(
state
->
state
)
{
case
SFSLASTNEXTROW_FS
:
// state->aDFileSet = state->pTsdb->pFS->cState->aDFileSet;
state
->
nFileSet
=
taosArrayGetSize
(
state
->
aDFileSet
);
state
->
iFileSet
=
state
->
nFileSet
;
state
->
pBlockDataL
=
NULL
;
case
SFSLASTNEXTROW_FILESET
:
{
SDFileSet
*
pFileSet
=
NULL
;
_next_fileset:
if
(
--
state
->
iFileSet
>=
0
)
{
pFileSet
=
(
SDFileSet
*
)
taosArrayGet
(
state
->
aDFileSet
,
state
->
iFileSet
);
}
else
{
if
(
state
->
pBlockDataL
)
{
tBlockDataDestroy
(
state
->
pBlockDataL
,
1
);
state
->
pBlockDataL
=
NULL
;
}
// tMergeTreeClose(&state->mergeTree);
*
ppRow
=
NULL
;
return
code
;
...
...
@@ -475,68 +454,24 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) {
code
=
tsdbDataFReaderOpen
(
&
state
->
pDataFReader
,
state
->
pTsdb
,
pFileSet
);
if
(
code
)
goto
_err
;
if
(
!
state
->
aBlockL
)
{
state
->
aBlockL
=
taosArrayInit
(
0
,
sizeof
(
SBlockL
));
}
else
{
taosArrayClear
(
state
->
aBlockL
);
}
code
=
tsdbReadBlockL
(
state
->
pDataFReader
,
0
,
state
->
aBlockL
);
if
(
code
)
goto
_err
;
// SBlockL *pBlockL = (SBlockL *)taosArrayGet(state->aBlockL, state->iBlockL);
state
->
pBlockL
=
taosArraySearch
(
state
->
aBlockL
,
state
->
pBlockIdxExp
,
tCmprBlockL
,
TD_EQ
);
if
(
!
state
->
pBlockL
)
{
tMergeTreeOpen
(
&
state
->
mergeTree
,
1
,
state
->
pDataFReader
,
state
->
uid
,
&
(
STimeWindow
){.
skey
=
TSKEY_MIN
,
.
ekey
=
TSKEY_MAX
},
&
(
SVersionRange
){.
minVer
=
0
,
.
maxVer
=
UINT64_MAX
});
bool
hasVal
=
tMergeTreeNext
(
&
state
->
mergeTree
);
if
(
!
hasVal
)
{
state
->
state
=
SFSLASTNEXTROW_FILESET
;
// tMergeTreeClose(&state->mergeTree);
goto
_next_fileset
;
}
int64_t
suid
=
state
->
pBlockL
->
suid
;
int64_t
uid
=
state
->
pBlockL
->
maxUid
;
if
(
!
state
->
pBlockDataL
)
{
state
->
pBlockDataL
=
&
state
->
blockDataL
;
tBlockDataCreate
(
state
->
pBlockDataL
);
}
code
=
tBlockDataInit
(
state
->
pBlockDataL
,
suid
,
suid
?
0
:
uid
,
state
->
pTSchema
);
if
(
code
)
goto
_err
;
}
case
SFSLASTNEXTROW_BLOCKDATA
:
code
=
tsdbReadLastBlock
(
state
->
pDataFReader
,
0
,
state
->
pBlockL
,
state
->
pBlockDataL
);
if
(
code
)
goto
_err
;
state
->
nRow
=
state
->
blockDataL
.
nRow
;
state
->
iRow
=
state
->
nRow
-
1
;
if
(
!
state
->
pBlockDataL
->
uid
)
{
while
(
state
->
pBlockIdxExp
->
uid
!=
state
->
pBlockDataL
->
aUid
[
state
->
iRow
])
{
--
state
->
iRow
;
}
}
state
->
state
=
SFSLASTNEXTROW_BLOCKROW
;
}
case
SFSLASTNEXTROW_BLOCKROW
:
if
(
state
->
pBlockDataL
->
uid
)
{
if
(
state
->
iRow
>=
0
)
{
state
->
row
=
tsdbRowFromBlockData
(
state
->
pBlockDataL
,
state
->
iRow
);
*
ppRow
=
&
state
->
row
;
if
(
--
state
->
iRow
<
0
)
{
state
->
state
=
SFSLASTNEXTROW_FILESET
;
}
}
}
else
{
if
(
state
->
iRow
>=
0
&&
state
->
pBlockIdxExp
->
uid
==
state
->
pBlockDataL
->
aUid
[
state
->
iRow
])
{
state
->
row
=
tsdbRowFromBlockData
(
state
->
pBlockDataL
,
state
->
iRow
);
*
ppRow
=
&
state
->
row
;
if
(
--
state
->
iRow
<
0
||
state
->
pBlockIdxExp
->
uid
!=
state
->
pBlockDataL
->
aUid
[
state
->
iRow
])
{
state
->
state
=
SFSLASTNEXTROW_FILESET
;
}
}
state
->
row
=
tMergeTreeGetRow
(
&
state
->
mergeTree
);
*
ppRow
=
&
state
->
row
;
bool
hasVal
=
tMergeTreeNext
(
&
state
->
mergeTree
);
if
(
!
hasVal
)
{
state
->
state
=
SFSLASTNEXTROW_FILESET
;
}
return
code
;
default:
ASSERT
(
0
);
...
...
@@ -548,15 +483,6 @@ _err:
tsdbDataFReaderClose
(
&
state
->
pDataFReader
);
state
->
pDataFReader
=
NULL
;
}
if
(
state
->
aBlockL
)
{
taosArrayDestroy
(
state
->
aBlockL
);
state
->
aBlockL
=
NULL
;
}
if
(
state
->
pBlockDataL
)
{
tBlockDataDestroy
(
state
->
pBlockDataL
,
1
);
state
->
pBlockDataL
=
NULL
;
}
*
ppRow
=
NULL
;
return
code
;
...
...
@@ -574,14 +500,6 @@ int32_t clearNextRowFromFSLast(void *iter) {
tsdbDataFReaderClose
(
&
state
->
pDataFReader
);
state
->
pDataFReader
=
NULL
;
}
if
(
state
->
aBlockL
)
{
taosArrayDestroy
(
state
->
aBlockL
);
state
->
aBlockL
=
NULL
;
}
if
(
state
->
pBlockDataL
)
{
tBlockDataDestroy
(
state
->
pBlockDataL
,
1
);
state
->
pBlockDataL
=
NULL
;
}
return
code
;
}
...
...
@@ -972,9 +890,6 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs
pIter
->
fsLastState
.
state
=
(
SFSLASTNEXTROWSTATES
)
SFSNEXTROW_FS
;
pIter
->
fsLastState
.
pTsdb
=
pTsdb
;
pIter
->
fsLastState
.
aDFileSet
=
pIter
->
pReadSnap
->
fs
.
aDFileSet
;
pIter
->
fsLastState
.
pBlockIdxExp
=
&
pIter
->
idx
;
pIter
->
fsLastState
.
pTSchema
=
pTSchema
;
pIter
->
fsLastState
.
suid
=
suid
;
pIter
->
fsLastState
.
uid
=
uid
;
pIter
->
fsState
.
state
=
SFSNEXTROW_FS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录