Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
925693c8
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看板
未验证
提交
925693c8
编写于
3月 16, 2023
作者:
S
Shengliang Guan
提交者:
GitHub
3月 16, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20493 from taosdata/fix/TD-23172
ehn(tsdb/cache): load necessary columns only
上级
345b4676
b1949b55
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
56 addition
and
9 deletion
+56
-9
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+56
-9
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
925693c8
...
...
@@ -745,6 +745,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
int
nCols
)
{
SFSNextRowIter
*
state
=
(
SFSNextRowIter
*
)
iter
;
int32_t
code
=
0
;
bool
checkRemainingRow
=
true
;
switch
(
state
->
state
)
{
case
SFSNEXTROW_FS
:
...
...
@@ -853,17 +854,60 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
*
pIgnoreEarlierTs
=
false
;
tBlockDataReset
(
state
->
pBlockData
);
TABLEID
tid
=
{.
suid
=
state
->
suid
,
.
uid
=
state
->
uid
};
code
=
tBlockDataInit
(
state
->
pBlockData
,
&
tid
,
state
->
pTSchema
,
NULL
,
0
);
code
=
tBlockDataInit
(
state
->
pBlockData
,
&
tid
,
state
->
pTSchema
,
aCols
,
nCols
);
if
(
code
)
goto
_err
;
code
=
tsdbReadDataBlock
(
*
state
->
pDataFReader
,
&
block
,
state
->
pBlockData
);
if
(
code
)
goto
_err
;
for
(
int
colIndex
=
0
;
colIndex
<
state
->
pBlockData
->
nColData
;
++
colIndex
)
{
SColData
*
pColData
=
&
state
->
pBlockData
->
aColData
[
colIndex
];
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
skipBlock
=
false
;
break
;
}
else
if
(
pColData
->
flag
&
(
HAS_VALUE
|
HAS_NULL
))
{
skipBlock
=
false
;
break
;
}
}
if
(
skipBlock
)
{
if
(
--
state
->
iBlock
<
0
)
{
tsdbDataFReaderClose
(
state
->
pDataFReader
);
*
state
->
pDataFReader
=
NULL
;
// resetLastBlockLoadInfo(state->pLoadInfo);
if
(
state
->
aBlockIdx
)
{
// taosArrayDestroy(state->aBlockIdx);
tsdbBICacheRelease
(
state
->
pTsdb
->
biCache
,
state
->
aBlockIdxHandle
);
state
->
aBlockIdxHandle
=
NULL
;
state
->
aBlockIdx
=
NULL
;
}
state
->
state
=
SFSNEXTROW_FILESET
;
goto
_next_fileset
;
}
else
{
goto
_next_datablock
;
}
}
state
->
nRow
=
state
->
blockData
.
nRow
;
state
->
iRow
=
state
->
nRow
-
1
;
state
->
state
=
SFSNEXTROW_BLOCKROW
;
checkRemainingRow
=
false
;
}
case
SFSNEXTROW_BLOCKROW
:
{
if
(
checkRemainingRow
)
{
bool
skipBlock
=
true
;
int
inputColIndex
=
0
;
for
(
int
colIndex
=
0
;
colIndex
<
state
->
pBlockData
->
nColData
;
++
colIndex
)
{
SColData
*
pColData
=
&
state
->
pBlockData
->
aColData
[
colIndex
];
int16_t
cid
=
pColData
->
cid
;
if
(
inputColIndex
<
nCols
&&
cid
==
aCols
[
inputColIndex
++
])
{
if
(
inputColIndex
<
nCols
&&
cid
==
aCols
[
inputColIndex
])
{
if
(
isLast
&&
pColData
->
numOfValue
!=
0
)
{
skipBlock
=
false
;
break
;
...
...
@@ -871,6 +915,8 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
skipBlock
=
false
;
break
;
}
++
inputColIndex
;
}
}
...
...
@@ -894,13 +940,8 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
goto
_next_datablock
;
}
}
state
->
nRow
=
state
->
blockData
.
nRow
;
state
->
iRow
=
state
->
nRow
-
1
;
state
->
state
=
SFSNEXTROW_BLOCKROW
;
}
case
SFSNEXTROW_BLOCKROW
:
if
(
state
->
iRow
>=
0
)
{
state
->
row
=
tsdbRowFromBlockData
(
state
->
pBlockData
,
state
->
iRow
);
*
ppRow
=
&
state
->
row
;
...
...
@@ -926,6 +967,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
}
return
code
;
}
default:
ASSERT
(
0
);
break
;
...
...
@@ -1545,6 +1587,9 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
return
TSDB_CODE_OUT_OF_MEMORY
;
}
for
(
int
i
=
1
;
i
<
pTSchema
->
numOfCols
;
++
i
)
{
taosArrayPush
(
aColArray
,
&
pTSchema
->
columns
[
i
].
colId
);
}
TSKEY
lastRowTs
=
TSKEY_MAX
;
...
...
@@ -1600,11 +1645,13 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
}
if
(
!
COL_VAL_IS_VALUE
(
pColVal
))
{
taosArrayPush
(
aColArray
,
&
pColVal
->
cid
);
if
(
!
setNoneCol
)
{
noneCol
=
iCol
;
setNoneCol
=
true
;
}
}
else
{
int32_t
aColIndex
=
taosArraySearchIdx
(
aColArray
,
&
pColVal
->
cid
,
compareInt16Val
,
TD_EQ
);
taosArrayRemove
(
aColArray
,
aColIndex
);
}
}
if
(
!
setNoneCol
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录