Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0b6e531d
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,发现更多精彩内容 >>
提交
0b6e531d
编写于
4月 25, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
81e54541
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
29 deletion
+26
-29
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+26
-29
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
0b6e531d
...
...
@@ -221,7 +221,7 @@ static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader,
static
int32_t
doAppendRowFromFileBlock
(
SSDataBlock
*
pResBlock
,
STsdbReader
*
pReader
,
SBlockData
*
pBlockData
,
int32_t
rowIndex
);
static
void
setComposedBlockFlag
(
STsdbReader
*
pReader
,
bool
composed
);
static
bool
hasBeenDropped
(
const
SArray
*
pDelList
,
int32_t
*
index
,
TSDBKEY
*
pKey
,
int32_t
order
,
static
bool
hasBeenDropped
(
const
SArray
*
pDelList
,
int32_t
*
index
,
int64_t
key
,
int64_t
ver
,
int32_t
order
,
SVersionRange
*
pVerRange
);
static
int32_t
doMergeMemTableMultiRows
(
TSDBROW
*
pRow
,
uint64_t
uid
,
SIterInfo
*
pIter
,
SArray
*
pDelList
,
...
...
@@ -1871,11 +1871,13 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc
}
TSDBROW
*
pRow
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
TSDBKEY
k
=
{.
version
=
pRow
->
version
,
.
ts
=
pRow
->
pBlockData
->
aTSKEY
[
pRow
->
iRow
]};
pLastBlockReader
->
currentKey
=
k
.
ts
;
pScanInfo
->
lastKeyInStt
=
k
.
ts
;
int64_t
key
=
pRow
->
pBlockData
->
aTSKEY
[
pRow
->
iRow
];
int64_t
ver
=
pRow
->
version
;
if
(
!
hasBeenDropped
(
pScanInfo
->
delSkyline
,
&
pScanInfo
->
lastBlockDelIndex
,
&
k
,
pLastBlockReader
->
order
,
pVerRange
))
{
pLastBlockReader
->
currentKey
=
key
;
pScanInfo
->
lastKeyInStt
=
ver
;
if
(
!
hasBeenDropped
(
pScanInfo
->
delSkyline
,
&
pScanInfo
->
lastBlockDelIndex
,
key
,
ver
,
pLastBlockReader
->
order
,
pVerRange
))
{
// the qualifed ts may equal to k.ts, only a greater version one.
// here we need to fallback one step.
return
true
;
...
...
@@ -2543,8 +2545,7 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDum
return
false
;
}
TSDBKEY
k
=
{.
ts
=
ts
,
.
version
=
ver
};
if
(
hasBeenDropped
(
pBlockScanInfo
->
delSkyline
,
&
pBlockScanInfo
->
fileDelIndex
,
&
k
,
pReader
->
order
,
if
(
hasBeenDropped
(
pBlockScanInfo
->
delSkyline
,
&
pBlockScanInfo
->
fileDelIndex
,
ts
,
ver
,
pReader
->
order
,
&
pReader
->
verRange
))
{
return
false
;
}
...
...
@@ -2584,10 +2585,6 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
return
nextRowFromLastBlocks
(
pLBlockReader
,
pScanInfo
,
&
pReader
->
verRange
);
}
//static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader) {
// return pLastBlockReader->currentKey;
//}
static
bool
hasDataInLastBlock
(
SLastBlockReader
*
pLastBlockReader
)
{
return
pLastBlockReader
->
mergeTree
.
pIter
!=
NULL
;
}
bool
hasDataInFileBlock
(
const
SBlockData
*
pBlockData
,
const
SFileBlockDumpInfo
*
pDumpInfo
)
{
...
...
@@ -3562,7 +3559,7 @@ SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond, int8_
return
(
SVersionRange
){.
minVer
=
startVer
,
.
maxVer
=
endVer
};
}
bool
hasBeenDropped
(
const
SArray
*
pDelList
,
int32_t
*
index
,
TSDBKEY
*
pKey
,
int32_t
order
,
SVersionRange
*
pVerRange
)
{
bool
hasBeenDropped
(
const
SArray
*
pDelList
,
int32_t
*
index
,
int64_t
key
,
int64_t
ver
,
int32_t
order
,
SVersionRange
*
pVerRange
)
{
if
(
pDelList
==
NULL
)
{
return
false
;
}
...
...
@@ -3574,29 +3571,29 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32
if
(
asc
)
{
if
(
*
index
>=
num
-
1
)
{
TSDBKEY
*
last
=
taosArrayGetLast
(
pDelList
);
ASSERT
(
pKey
->
ts
>=
last
->
ts
);
ASSERT
(
key
>=
last
->
ts
);
if
(
pKey
->
ts
>
last
->
ts
)
{
if
(
key
>
last
->
ts
)
{
return
false
;
}
else
if
(
pKey
->
ts
==
last
->
ts
)
{
}
else
if
(
key
==
last
->
ts
)
{
TSDBKEY
*
prev
=
taosArrayGet
(
pDelList
,
num
-
2
);
return
(
prev
->
version
>=
pKey
->
version
&&
prev
->
version
<=
pVerRange
->
maxVer
&&
return
(
prev
->
version
>=
ver
&&
prev
->
version
<=
pVerRange
->
maxVer
&&
prev
->
version
>=
pVerRange
->
minVer
);
}
}
else
{
TSDBKEY
*
pCurrent
=
taosArrayGet
(
pDelList
,
*
index
);
TSDBKEY
*
pNext
=
taosArrayGet
(
pDelList
,
(
*
index
)
+
1
);
if
(
pKey
->
ts
<
pCurrent
->
ts
)
{
if
(
key
<
pCurrent
->
ts
)
{
return
false
;
}
if
(
pCurrent
->
ts
<=
pKey
->
ts
&&
pNext
->
ts
>=
pKey
->
ts
&&
pCurrent
->
version
>=
pKey
->
version
&&
if
(
pCurrent
->
ts
<=
key
&&
pNext
->
ts
>=
key
&&
pCurrent
->
version
>=
ver
&&
pVerRange
->
maxVer
>=
pCurrent
->
version
)
{
return
true
;
}
while
(
pNext
->
ts
<=
pKey
->
ts
&&
(
*
index
)
<
num
-
1
)
{
while
(
pNext
->
ts
<=
key
&&
(
*
index
)
<
num
-
1
)
{
(
*
index
)
+=
1
;
if
((
*
index
)
<
num
-
1
)
{
...
...
@@ -3608,7 +3605,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32
continue
;
}
if
(
pCurrent
->
ts
<=
pKey
->
ts
&&
pNext
->
ts
>=
pKey
->
ts
&&
pCurrent
->
version
>=
pKey
->
version
&&
if
(
pCurrent
->
ts
<=
key
&&
pNext
->
ts
>=
key
&&
pCurrent
->
version
>=
ver
&&
pVerRange
->
maxVer
>=
pCurrent
->
version
)
{
return
true
;
}
...
...
@@ -3621,10 +3618,10 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32
if
(
*
index
<=
0
)
{
TSDBKEY
*
pFirst
=
taosArrayGet
(
pDelList
,
0
);
if
(
pKey
->
ts
<
pFirst
->
ts
)
{
if
(
key
<
pFirst
->
ts
)
{
return
false
;
}
else
if
(
pKey
->
ts
==
pFirst
->
ts
)
{
return
pFirst
->
version
>=
pKey
->
version
;
}
else
if
(
key
==
pFirst
->
ts
)
{
return
pFirst
->
version
>=
ver
;
}
else
{
ASSERT
(
0
);
}
...
...
@@ -3632,15 +3629,15 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32
TSDBKEY
*
pCurrent
=
taosArrayGet
(
pDelList
,
*
index
);
TSDBKEY
*
pPrev
=
taosArrayGet
(
pDelList
,
(
*
index
)
-
1
);
if
(
pKey
->
ts
>
pCurrent
->
ts
)
{
if
(
key
>
pCurrent
->
ts
)
{
return
false
;
}
if
(
pPrev
->
ts
<=
pKey
->
ts
&&
pCurrent
->
ts
>=
pKey
->
ts
&&
pPrev
->
version
>=
pKey
->
version
)
{
if
(
pPrev
->
ts
<=
key
&&
pCurrent
->
ts
>=
key
&&
pPrev
->
version
>=
ver
)
{
return
true
;
}
while
(
pPrev
->
ts
>=
pKey
->
ts
&&
(
*
index
)
>
1
)
{
while
(
pPrev
->
ts
>=
key
&&
(
*
index
)
>
1
)
{
(
*
index
)
+=
step
;
if
((
*
index
)
>=
1
)
{
...
...
@@ -3652,7 +3649,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32
continue
;
}
if
(
pPrev
->
ts
<=
pKey
->
ts
&&
pCurrent
->
ts
>=
pKey
->
ts
&&
pPrev
->
version
>=
pKey
->
version
)
{
if
(
pPrev
->
ts
<=
key
&&
pCurrent
->
ts
>=
key
&&
pPrev
->
version
>=
ver
)
{
return
true
;
}
}
...
...
@@ -3680,7 +3677,7 @@ TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* p
// it is a valid data version
if
((
key
.
version
<=
pReader
->
verRange
.
maxVer
&&
key
.
version
>=
pReader
->
verRange
.
minVer
)
&&
(
!
hasBeenDropped
(
pDelList
,
&
pIter
->
index
,
&
key
,
pReader
->
order
,
&
pReader
->
verRange
)))
{
(
!
hasBeenDropped
(
pDelList
,
&
pIter
->
index
,
key
.
ts
,
key
.
version
,
pReader
->
order
,
&
pReader
->
verRange
)))
{
return
pRow
;
}
...
...
@@ -3699,7 +3696,7 @@ TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* p
}
if
(
key
.
version
<=
pReader
->
verRange
.
maxVer
&&
key
.
version
>=
pReader
->
verRange
.
minVer
&&
(
!
hasBeenDropped
(
pDelList
,
&
pIter
->
index
,
&
key
,
pReader
->
order
,
&
pReader
->
verRange
)))
{
(
!
hasBeenDropped
(
pDelList
,
&
pIter
->
index
,
key
.
ts
,
key
.
version
,
pReader
->
order
,
&
pReader
->
verRange
)))
{
return
pRow
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录