Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9b0b4061
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
9b0b4061
编写于
7月 17, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tsdb/cache: relayout cache row reader
上级
8263c49c
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
161 addition
and
130 deletion
+161
-130
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+18
-2
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+61
-39
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+81
-73
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
+0
-15
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
9b0b4061
...
...
@@ -833,9 +833,25 @@ void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo);
void
*
destroySttBlockReader
(
SArray
*
pLDataIterArray
,
int64_t
*
blocks
,
double
*
el
);
// tsdbCache ==============================================================================================
typedef
enum
{
READ_MODE_COUNT_ONLY
=
0x1
,
READ_MODE_ALL
,
}
EReadMode
;
typedef
struct
STsdbReaderInfo
{
uint64_t
suid
;
STSchema
*
pSchema
;
EReadMode
readMode
;
uint64_t
rowsNum
;
STimeWindow
window
;
SVersionRange
verRange
;
int16_t
order
;
}
STsdbReaderInfo
;
typedef
struct
SCacheRowsReader
{
STsdb
*
pTsdb
;
SVersionRange
verRange
;
STsdb
*
pTsdb
;
STsdbReaderInfo
info
;
// SVersionRange verRange;
TdThreadMutex
readerMutex
;
SVnode
*
pVnode
;
STSchema
*
pSchema
;
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
9b0b4061
...
...
@@ -1720,6 +1720,42 @@ typedef struct {
SMergeTree
*
pMergeTree
;
}
SFSLastIter
;
static
int32_t
lastIterOpen
(
SFSLastIter
*
iter
,
STFileSet
*
pFileSet
,
STsdb
*
pTsdb
,
STSchema
*
pTSchema
,
tb_uid_t
suid
,
tb_uid_t
uid
,
SCacheRowsReader
*
pr
,
int64_t
lastTs
,
int16_t
*
aCols
,
int
nCols
)
{
int32_t
code
=
0
;
int64_t
loadBlocks
=
0
;
double
elapse
=
0
;
pr
->
pLDataIterArray
=
destroySttBlockReader
(
pr
->
pLDataIterArray
,
&
loadBlocks
,
&
elapse
);
pr
->
pLDataIterArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
SMergeTreeConf
conf
=
{
.
uid
=
uid
,
.
suid
=
suid
,
.
pTsdb
=
pTsdb
,
.
timewindow
=
(
STimeWindow
){.
skey
=
lastTs
,
.
ekey
=
TSKEY_MAX
},
.
verRange
=
(
SVersionRange
){.
minVer
=
0
,
.
maxVer
=
UINT64_MAX
},
.
strictTimeRange
=
false
,
.
pSchema
=
pTSchema
,
.
pCurrentFileset
=
pFileSet
,
.
backward
=
1
,
.
pSttFileBlockIterArray
=
pr
->
pLDataIterArray
,
.
pCols
=
aCols
,
.
numOfCols
=
nCols
,
.
pReader
=
pr
,
.
idstr
=
pr
->
idstr
,
};
code
=
tMergeTreeOpen2
(
&
iter
->
mergeTree
,
&
conf
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
-
1
;
}
iter
->
pMergeTree
=
&
iter
->
mergeTree
;
return
code
;
}
static
int32_t
lastIterClose
(
SFSLastIter
**
iter
)
{
int32_t
code
=
0
;
...
...
@@ -1733,43 +1769,9 @@ static int32_t lastIterClose(SFSLastIter **iter) {
return
code
;
}
static
int32_t
lastIterNext
(
SFSLastIter
*
iter
,
TSDBROW
**
ppRow
,
STsdb
*
pTsdb
,
STSchema
*
pTSchema
,
tb_uid_t
suid
,
tb_uid_t
uid
,
SCacheRowsReader
*
pr
,
int64_t
lastTs
,
STFileSet
*
pFileSet
,
int16_t
*
aCols
,
int
nCols
)
{
static
int32_t
lastIterNext
(
SFSLastIter
*
iter
,
TSDBROW
**
ppRow
)
{
int32_t
code
=
0
;
if
(
!
iter
->
pMergeTree
)
{
int64_t
loadBlocks
=
0
;
double
elapse
=
0
;
pr
->
pLDataIterArray
=
destroySttBlockReader
(
pr
->
pLDataIterArray
,
&
loadBlocks
,
&
elapse
);
pr
->
pLDataIterArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
SMergeTreeConf
conf
=
{
.
uid
=
uid
,
.
suid
=
suid
,
.
pTsdb
=
pTsdb
,
.
timewindow
=
(
STimeWindow
){.
skey
=
lastTs
,
.
ekey
=
TSKEY_MAX
},
.
verRange
=
(
SVersionRange
){.
minVer
=
0
,
.
maxVer
=
UINT64_MAX
},
.
strictTimeRange
=
false
,
.
pSchema
=
pTSchema
,
.
pCurrentFileset
=
pFileSet
,
.
backward
=
1
,
.
pSttFileBlockIterArray
=
pr
->
pLDataIterArray
,
.
pCols
=
aCols
,
.
numOfCols
=
nCols
,
.
pReader
=
pr
,
.
idstr
=
pr
->
idstr
,
};
code
=
tMergeTreeOpen2
(
&
iter
->
mergeTree
,
&
conf
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
-
1
;
}
iter
->
pMergeTree
=
&
iter
->
mergeTree
;
}
// retrieve next row
bool
hasVal
=
tMergeTreeNext
(
iter
->
pMergeTree
);
if
(
!
hasVal
)
{
*
ppRow
=
NULL
;
...
...
@@ -1823,6 +1825,17 @@ typedef struct SFSNextRowIter {
struct
CacheNextRowIter
*
pRowIter
;
}
SFSNextRowIter
;
static
void
clearLastFileSet
(
SFSNextRowIter
*
state
)
{
if
(
state
->
pLastIter
)
{
lastIterClose
(
&
state
->
pLastIter
);
}
if
(
state
->
pBlockData
)
{
tBlockDataDestroy
(
state
->
pBlockData
);
state
->
pBlockData
=
NULL
;
}
}
static
int32_t
getNextRowFromFS
(
void
*
iter
,
TSDBROW
**
ppRow
,
bool
*
pIgnoreEarlierTs
,
bool
isLast
,
int16_t
*
aCols
,
int
nCols
)
{
SFSNextRowIter
*
state
=
(
SFSNextRowIter
*
)
iter
;
...
...
@@ -1837,8 +1850,11 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
SFSNEXTROW_FILESET
==
state
->
state
)
{
_next_fileset:
if
(
--
state
->
iFileSet
<
0
)
{
// no fileset left, cleanup and return NULL row
if
(
--
state
->
iFileSet
<
0
)
{
clearLastFileSet
(
state
);
*
ppRow
=
NULL
;
return
code
;
}
else
{
state
->
pFileSet
=
TARRAY2_GET
(
state
->
aDFileSet
,
state
->
iFileSet
);
}
...
...
@@ -1872,9 +1888,16 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
goto
_err
;
}
// TODO: load tomb data from data and sttt
code
=
lastIterOpen
(
&
state
->
lastIter
,
state
->
pFileSet
,
state
->
pTsdb
,
state
->
pTSchema
,
state
->
suid
,
state
->
uid
,
state
->
pr
,
state
->
lastTs
,
aCols
,
nCols
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
state
->
pLastIter
=
&
state
->
lastIter
;
// TODO: load tomb data from data and stt
if
(
!
state
->
pIndexList
)
{
state
->
pIndexList
=
taosArrayInit
(
1
,
sizeof
(
SBrinBlk
));
}
else
{
...
...
@@ -1990,8 +2013,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
!
state
->
pLastRow
)
{
// get next row from fslast and process with fs row, --state->Row if select fs row
code
=
lastIterNext
(
&
state
->
lastIter
,
&
state
->
pLastRow
,
state
->
pTsdb
,
state
->
pTSchema
,
state
->
suid
,
state
->
uid
,
state
->
pr
,
state
->
lastTs
,
state
->
pFileSet
,
aCols
,
nCols
);
code
=
lastIterNext
(
&
state
->
lastIter
,
&
state
->
pLastRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
9b0b4061
...
...
@@ -143,7 +143,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
p
->
type
=
type
;
p
->
pVnode
=
pVnode
;
p
->
pTsdb
=
p
->
pVnode
->
pTsdb
;
p
->
verRange
=
(
SVersionRange
){.
minVer
=
0
,
.
maxVer
=
UINT64_MAX
};
p
->
info
.
verRange
=
(
SVersionRange
){.
minVer
=
0
,
.
maxVer
=
UINT64_MAX
};
p
->
numOfCols
=
numOfCols
;
p
->
pCidList
=
pCidList
;
p
->
pSlotIds
=
pSlotIds
;
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
9b0b4061
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
浏览文件 @
9b0b4061
...
...
@@ -30,11 +30,6 @@ typedef enum {
READER_STATUS_NORMAL
=
0x2
,
}
EReaderStatus
;
typedef
enum
{
READ_MODE_COUNT_ONLY
=
0x1
,
READ_MODE_ALL
,
}
EReadMode
;
typedef
enum
{
EXTERNAL_ROWS_PREV
=
0x1
,
EXTERNAL_ROWS_MAIN
=
0x2
,
...
...
@@ -69,16 +64,6 @@ typedef struct STableBlockScanInfo {
bool
iterInit
;
// whether to initialize the in-memory skip list iterator or not
}
STableBlockScanInfo
;
typedef
struct
STsdbReaderInfo
{
uint64_t
suid
;
STSchema
*
pSchema
;
EReadMode
readMode
;
uint64_t
rowsNum
;
STimeWindow
window
;
SVersionRange
verRange
;
int16_t
order
;
}
STsdbReaderInfo
;
typedef
struct
SResultBlockInfo
{
SSDataBlock
*
pResBlock
;
bool
freeBlock
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录