Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
17c6b9f8
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
17c6b9f8
编写于
6月 29, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(tsdb): fix error in set file reader.
上级
eee80077
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
42 deletion
+54
-42
source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead2.c
source/dnode/vnode/src/tsdb/tsdbRead2.c
+53
-41
未找到文件。
source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
浏览文件 @
17c6b9f8
...
@@ -946,7 +946,7 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const TS
...
@@ -946,7 +946,7 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const TS
}
else
{
}
else
{
SBrinRecord
record
[
1
];
SBrinRecord
record
[
1
];
tBrinBlockGet
(
writer
->
ctx
->
brinBlock
,
writer
->
ctx
->
brinBlockIdx
,
record
);
tBrinBlockGet
(
writer
->
ctx
->
brinBlock
,
writer
->
ctx
->
brinBlockIdx
,
record
);
if
(
key
->
ts
>
record
->
lastKey
||
(
key
->
ts
==
record
->
lastKey
&&
key
->
version
>
record
->
lastKey
Ver
))
{
if
(
key
->
ts
>
record
->
lastKey
||
(
key
->
ts
==
record
->
lastKey
&&
key
->
version
>
record
->
max
Ver
))
{
if
(
writer
->
blockData
->
nRow
>
0
)
{
if
(
writer
->
blockData
->
nRow
>
0
)
{
code
=
tsdbDataFileDoWriteBlockData
(
writer
,
writer
->
blockData
);
code
=
tsdbDataFileDoWriteBlockData
(
writer
,
writer
->
blockData
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead2.c
浏览文件 @
17c6b9f8
...
@@ -613,19 +613,24 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
...
@@ -613,19 +613,24 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
pReader
->
status
.
pCurrentFileset
=
pIter
->
pFilesetList
->
data
[
pIter
->
index
];
pReader
->
status
.
pCurrentFileset
=
pIter
->
pFilesetList
->
data
[
pIter
->
index
];
STFileObj
**
pFileObj
=
pReader
->
status
.
pCurrentFileset
->
farr
;
STFileObj
**
pFileObj
=
pReader
->
status
.
pCurrentFileset
->
farr
;
if
(
pFileObj
[
0
]
!=
NULL
)
{
if
(
pFileObj
[
0
]
!=
NULL
||
pFileObj
[
3
]
!=
NULL
)
{
SDataFileReaderConfig
conf
=
{.
tsdb
=
pReader
->
pTsdb
,
.
szPage
=
pReader
->
pTsdb
->
pVnode
->
config
.
szPage
};
SDataFileReaderConfig
conf
=
{.
tsdb
=
pReader
->
pTsdb
,
.
szPage
=
pReader
->
pTsdb
->
pVnode
->
config
.
szPage
};
conf
.
files
[
0
].
file
=
*
pFileObj
[
0
]
->
f
;
const
char
*
filesName
[
4
]
=
{
0
};
conf
.
files
[
0
].
exist
=
true
;
conf
.
files
[
1
].
file
=
*
pFileObj
[
1
]
->
f
;
if
(
pFileObj
[
0
]
!=
NULL
)
{
conf
.
files
[
1
].
exist
=
true
;
conf
.
files
[
0
].
file
=
*
pFileObj
[
0
]
->
f
;
conf
.
files
[
0
].
exist
=
true
;
filesName
[
0
]
=
pFileObj
[
0
]
->
fname
;
conf
.
files
[
2
].
file
=
*
pFileObj
[
2
]
->
f
;
conf
.
files
[
1
].
file
=
*
pFileObj
[
1
]
->
f
;
conf
.
files
[
2
].
exist
=
true
;
conf
.
files
[
1
].
exist
=
true
;
filesName
[
1
]
=
pFileObj
[
1
]
->
fname
;
const
char
*
filesName
[
4
]
=
{
pFileObj
[
0
]
->
fname
,
pFileObj
[
1
]
->
fname
,
pFileObj
[
2
]
->
fname
};
conf
.
files
[
2
].
file
=
*
pFileObj
[
2
]
->
f
;
conf
.
files
[
2
].
exist
=
true
;
filesName
[
2
]
=
pFileObj
[
2
]
->
fname
;
}
if
(
pFileObj
[
3
]
!=
NULL
)
{
if
(
pFileObj
[
3
]
!=
NULL
)
{
conf
.
files
[
3
].
exist
=
true
;
conf
.
files
[
3
].
exist
=
true
;
...
@@ -1092,7 +1097,7 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
...
@@ -1092,7 +1097,7 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
}
}
// 2. version range check
// 2. version range check
if
(
pRecord
->
firstKeyVer
>
pReader
->
verRange
.
maxVer
||
pRecord
->
lastKey
Ver
<
pReader
->
verRange
.
minVer
)
{
if
(
pRecord
->
minVer
>
pReader
->
verRange
.
maxVer
||
pRecord
->
max
Ver
<
pReader
->
verRange
.
minVer
)
{
continue
;
continue
;
}
}
...
@@ -1236,8 +1241,8 @@ static int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData
...
@@ -1236,8 +1241,8 @@ static int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData
endPos
=
doBinarySearchKey
(
pBlockData
->
aTSKEY
,
pRecord
->
numRow
,
pos
,
key
,
pReader
->
order
);
endPos
=
doBinarySearchKey
(
pBlockData
->
aTSKEY
,
pRecord
->
numRow
,
pos
,
key
,
pReader
->
order
);
}
}
if
((
pReader
->
verRange
.
maxVer
>=
pRecord
->
firstKeyVer
&&
pReader
->
verRange
.
maxVer
<
pRecord
->
lastKey
Ver
)
||
if
((
pReader
->
verRange
.
maxVer
>=
pRecord
->
minVer
&&
pReader
->
verRange
.
maxVer
<
pRecord
->
max
Ver
)
||
(
pReader
->
verRange
.
minVer
<=
pRecord
->
lastKeyVer
&&
pReader
->
verRange
.
minVer
>
pRecord
->
firstKey
Ver
))
{
(
pReader
->
verRange
.
minVer
<=
pRecord
->
maxVer
&&
pReader
->
verRange
.
minVer
>
pRecord
->
min
Ver
))
{
int32_t
i
=
endPos
;
int32_t
i
=
endPos
;
if
(
asc
)
{
if
(
asc
)
{
...
@@ -1399,9 +1404,9 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
...
@@ -1399,9 +1404,9 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
// row index of dump info remain the initial position, let's find the appropriate start position.
// row index of dump info remain the initial position, let's find the appropriate start position.
if
((
pDumpInfo
->
rowIndex
==
0
&&
asc
)
||
(
pDumpInfo
->
rowIndex
==
pRecord
->
numRow
-
1
&&
(
!
asc
)))
{
if
((
pDumpInfo
->
rowIndex
==
0
&&
asc
)
||
(
pDumpInfo
->
rowIndex
==
pRecord
->
numRow
-
1
&&
(
!
asc
)))
{
if
(
asc
&&
pReader
->
window
.
skey
<=
pRecord
->
firstKey
&&
pReader
->
verRange
.
minVer
<=
pRecord
->
firstKey
Ver
)
{
if
(
asc
&&
pReader
->
window
.
skey
<=
pRecord
->
firstKey
&&
pReader
->
verRange
.
minVer
<=
pRecord
->
min
Ver
)
{
// pDumpInfo->rowIndex = 0;
// pDumpInfo->rowIndex = 0;
}
else
if
(
!
asc
&&
pReader
->
window
.
ekey
>=
pRecord
->
lastKey
&&
pReader
->
verRange
.
maxVer
>=
pRecord
->
lastKey
Ver
)
{
}
else
if
(
!
asc
&&
pReader
->
window
.
ekey
>=
pRecord
->
lastKey
&&
pReader
->
verRange
.
maxVer
>=
pRecord
->
max
Ver
)
{
// pDumpInfo->rowIndex = pRecord->numRow - 1;
// pDumpInfo->rowIndex = pRecord->numRow - 1;
}
else
{
// find the appropriate the start position in current block, and set it to be the current rowIndex
}
else
{
// find the appropriate the start position in current block, and set it to be the current rowIndex
int32_t
pos
=
asc
?
pRecord
->
numRow
-
1
:
0
;
int32_t
pos
=
asc
?
pRecord
->
numRow
-
1
:
0
;
...
@@ -1413,16 +1418,16 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
...
@@ -1413,16 +1418,16 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
tsdbError
(
tsdbError
(
"%p failed to locate the start position in current block, global index:%d, table index:%d, brange:%"
PRId64
"%p failed to locate the start position in current block, global index:%d, table index:%d, brange:%"
PRId64
"-%"
PRId64
", minVer:%"
PRId64
", maxVer:%"
PRId64
" %s"
,
"-%"
PRId64
", minVer:%"
PRId64
", maxVer:%"
PRId64
" %s"
,
pReader
,
pBlockIter
->
index
,
pBlockInfo
->
tbBlockIdx
,
pRecord
->
firstKey
,
pRecord
->
lastKey
,
pRecord
->
firstKey
Ver
,
pReader
,
pBlockIter
->
index
,
pBlockInfo
->
tbBlockIdx
,
pRecord
->
firstKey
,
pRecord
->
lastKey
,
pRecord
->
min
Ver
,
pRecord
->
lastKey
Ver
,
pReader
->
idStr
);
pRecord
->
max
Ver
,
pReader
->
idStr
);
return
TSDB_CODE_INVALID_PARA
;
return
TSDB_CODE_INVALID_PARA
;
}
}
ASSERT
(
pReader
->
verRange
.
minVer
<=
pRecord
->
lastKeyVer
&&
pReader
->
verRange
.
maxVer
>=
pRecord
->
firstKey
Ver
);
ASSERT
(
pReader
->
verRange
.
minVer
<=
pRecord
->
maxVer
&&
pReader
->
verRange
.
maxVer
>=
pRecord
->
min
Ver
);
// find the appropriate start position that satisfies the version requirement.
// find the appropriate start position that satisfies the version requirement.
if
((
pReader
->
verRange
.
maxVer
>=
pRecord
->
firstKeyVer
&&
pReader
->
verRange
.
maxVer
<
pRecord
->
lastKey
Ver
)
||
if
((
pReader
->
verRange
.
maxVer
>=
pRecord
->
minVer
&&
pReader
->
verRange
.
maxVer
<
pRecord
->
max
Ver
)
||
(
pReader
->
verRange
.
minVer
<=
pRecord
->
lastKeyVer
&&
pReader
->
verRange
.
minVer
>
pRecord
->
firstKey
Ver
))
{
(
pReader
->
verRange
.
minVer
<=
pRecord
->
maxVer
&&
pReader
->
verRange
.
minVer
>
pRecord
->
min
Ver
))
{
int32_t
i
=
pDumpInfo
->
rowIndex
;
int32_t
i
=
pDumpInfo
->
rowIndex
;
if
(
asc
)
{
if
(
asc
)
{
for
(;
i
<
pRecord
->
numRow
;
++
i
)
{
for
(;
i
<
pRecord
->
numRow
;
++
i
)
{
...
@@ -1533,7 +1538,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
...
@@ -1533,7 +1538,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
tsdbDebug
(
"%p copy file block to sdatablock, global index:%d, table index:%d, brange:%"
PRId64
"-%"
PRId64
tsdbDebug
(
"%p copy file block to sdatablock, global index:%d, table index:%d, brange:%"
PRId64
"-%"
PRId64
", rows:%d, remain:%d, minVer:%"
PRId64
", maxVer:%"
PRId64
", uid:%"
PRIu64
" elapsed time:%.2f ms, %s"
,
", rows:%d, remain:%d, minVer:%"
PRId64
", maxVer:%"
PRId64
", uid:%"
PRIu64
" elapsed time:%.2f ms, %s"
,
pReader
,
pBlockIter
->
index
,
pBlockInfo
->
tbBlockIdx
,
pRecord
->
firstKey
,
pRecord
->
lastKey
,
dumpedRows
,
pReader
,
pBlockIter
->
index
,
pBlockInfo
->
tbBlockIdx
,
pRecord
->
firstKey
,
pRecord
->
lastKey
,
dumpedRows
,
unDumpedRows
,
pRecord
->
firstKeyVer
,
pRecord
->
lastKey
Ver
,
pBlockInfo
->
uid
,
elapsedTime
,
pReader
->
idStr
);
unDumpedRows
,
pRecord
->
minVer
,
pRecord
->
max
Ver
,
pBlockInfo
->
uid
,
elapsedTime
,
pReader
->
idStr
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1583,9 +1588,10 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
...
@@ -1583,9 +1588,10 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
SFileDataBlockInfo
*
pBlockInfo
=
getCurrentBlockInfo
(
pBlockIter
);
SFileDataBlockInfo
*
pBlockInfo
=
getCurrentBlockInfo
(
pBlockIter
);
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SBrinRecord
*
pRecord
=
&
pBlockInfo
->
record
;
SBrinRecord
*
pRecord
=
&
pBlockInfo
->
record
;
code
=
tsdbDataFileReadBlockData
(
pReader
->
pFileReader
,
pRecord
,
pBlockData
);
code
=
tsdbDataFileReadBlockData
(
pReader
->
pFileReader
,
pRecord
,
pBlockData
);
// code = tsdbDataFileReadBlockDataByColumn(pReader->pFileReader, pRecord, pBlockData, pReader->pSchema, pSup->colId, pSup->numOfCols);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"%p error occurs in loading file block, global index:%d, table index:%d, brange:%"
PRId64
"-%"
PRId64
tsdbError
(
"%p error occurs in loading file block, global index:%d, table index:%d, brange:%"
PRId64
"-%"
PRId64
", rows:%d, code:%s %s"
,
", rows:%d, code:%s %s"
,
...
@@ -1599,7 +1605,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
...
@@ -1599,7 +1605,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI
tsdbDebug
(
"%p load file block into buffer, global index:%d, index in table block list:%d, brange:%"
PRId64
"-%"
PRId64
tsdbDebug
(
"%p load file block into buffer, global index:%d, index in table block list:%d, brange:%"
PRId64
"-%"
PRId64
", rows:%d, minVer:%"
PRId64
", maxVer:%"
PRId64
", elapsed time:%.2f ms, %s"
,
", rows:%d, minVer:%"
PRId64
", maxVer:%"
PRId64
", elapsed time:%.2f ms, %s"
,
pReader
,
pBlockIter
->
index
,
pBlockInfo
->
tbBlockIdx
,
pRecord
->
firstKey
,
pRecord
->
lastKey
,
pRecord
->
numRow
,
pReader
,
pBlockIter
->
index
,
pBlockInfo
->
tbBlockIdx
,
pRecord
->
firstKey
,
pRecord
->
lastKey
,
pRecord
->
numRow
,
pRecord
->
firstKeyVer
,
pRecord
->
lastKey
Ver
,
elapsedTime
,
pReader
->
idStr
);
pRecord
->
minVer
,
pRecord
->
max
Ver
,
elapsedTime
,
pReader
->
idStr
);
pReader
->
cost
.
blockLoadTime
+=
elapsedTime
;
pReader
->
cost
.
blockLoadTime
+=
elapsedTime
;
pDumpInfo
->
allDumped
=
false
;
pDumpInfo
->
allDumped
=
false
;
...
@@ -1807,8 +1813,8 @@ static bool blockIteratorNext(SDataBlockIter* pBlockIter, const char* idStr) {
...
@@ -1807,8 +1813,8 @@ static bool blockIteratorNext(SDataBlockIter* pBlockIter, const char* idStr) {
static
int32_t
dataBlockPartiallyRequired
(
STimeWindow
*
pWindow
,
SVersionRange
*
pVerRange
,
SFileDataBlockInfo
*
pBlock
)
{
static
int32_t
dataBlockPartiallyRequired
(
STimeWindow
*
pWindow
,
SVersionRange
*
pVerRange
,
SFileDataBlockInfo
*
pBlock
)
{
return
(
pWindow
->
ekey
<
pBlock
->
record
.
lastKey
&&
pWindow
->
ekey
>=
pBlock
->
record
.
firstKey
)
||
return
(
pWindow
->
ekey
<
pBlock
->
record
.
lastKey
&&
pWindow
->
ekey
>=
pBlock
->
record
.
firstKey
)
||
(
pWindow
->
skey
>
pBlock
->
record
.
firstKey
&&
pWindow
->
skey
<=
pBlock
->
record
.
lastKey
)
||
(
pWindow
->
skey
>
pBlock
->
record
.
firstKey
&&
pWindow
->
skey
<=
pBlock
->
record
.
lastKey
)
||
(
pVerRange
->
minVer
>
pBlock
->
record
.
firstKeyVer
&&
pVerRange
->
minVer
<=
pBlock
->
record
.
lastKey
Ver
)
||
(
pVerRange
->
minVer
>
pBlock
->
record
.
minVer
&&
pVerRange
->
minVer
<=
pBlock
->
record
.
max
Ver
)
||
(
pVerRange
->
maxVer
<
pBlock
->
record
.
lastKeyVer
&&
pVerRange
->
maxVer
>=
pBlock
->
record
.
firstKey
Ver
);
(
pVerRange
->
maxVer
<
pBlock
->
record
.
maxVer
&&
pVerRange
->
maxVer
>=
pBlock
->
record
.
min
Ver
);
}
}
static
bool
getNeighborBlockOfSameTable
(
SFileDataBlockInfo
*
pBlockInfo
,
STableBlockScanInfo
*
pTableBlockScanInfo
,
static
bool
getNeighborBlockOfSameTable
(
SFileDataBlockInfo
*
pBlockInfo
,
STableBlockScanInfo
*
pTableBlockScanInfo
,
...
@@ -1896,24 +1902,24 @@ static bool bufferDataInFileBlockGap(int32_t order, TSDBKEY key, SFileDataBlockI
...
@@ -1896,24 +1902,24 @@ static bool bufferDataInFileBlockGap(int32_t order, TSDBKEY key, SFileDataBlockI
static
bool
keyOverlapFileBlock
(
TSDBKEY
key
,
SFileDataBlockInfo
*
pBlock
,
SVersionRange
*
pVerRange
)
{
static
bool
keyOverlapFileBlock
(
TSDBKEY
key
,
SFileDataBlockInfo
*
pBlock
,
SVersionRange
*
pVerRange
)
{
return
(
key
.
ts
>=
pBlock
->
record
.
firstKey
&&
key
.
ts
<=
pBlock
->
record
.
lastKey
)
&&
return
(
key
.
ts
>=
pBlock
->
record
.
firstKey
&&
key
.
ts
<=
pBlock
->
record
.
lastKey
)
&&
(
pBlock
->
record
.
lastKeyVer
>=
pVerRange
->
minVer
)
&&
(
pBlock
->
record
.
firstKey
Ver
<=
pVerRange
->
maxVer
);
(
pBlock
->
record
.
maxVer
>=
pVerRange
->
minVer
)
&&
(
pBlock
->
record
.
min
Ver
<=
pVerRange
->
maxVer
);
}
}
static
bool
doCheckforDatablockOverlap
(
STableBlockScanInfo
*
pBlockScanInfo
,
const
S
DataBlk
*
pBlock
,
static
bool
doCheckforDatablockOverlap
(
STableBlockScanInfo
*
pBlockScanInfo
,
const
S
BrinRecord
*
pRecord
,
int32_t
startIndex
)
{
int32_t
startIndex
)
{
size_t
num
=
taosArrayGetSize
(
pBlockScanInfo
->
delSkyline
);
size_t
num
=
taosArrayGetSize
(
pBlockScanInfo
->
delSkyline
);
for
(
int32_t
i
=
startIndex
;
i
<
num
;
i
+=
1
)
{
for
(
int32_t
i
=
startIndex
;
i
<
num
;
i
+=
1
)
{
TSDBKEY
*
p
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
i
);
TSDBKEY
*
p
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
i
);
if
(
p
->
ts
>=
p
Block
->
minKey
.
ts
&&
p
->
ts
<=
pBlock
->
maxKey
.
ts
)
{
if
(
p
->
ts
>=
p
Record
->
firstKey
&&
p
->
ts
<=
pRecord
->
lastKey
)
{
if
(
p
->
version
>=
p
Block
->
minVer
)
{
if
(
p
->
version
>=
p
Record
->
minVer
)
{
return
true
;
return
true
;
}
}
}
else
if
(
p
->
ts
<
p
Block
->
minKey
.
ts
)
{
// p->ts < pBlock->minKey.ts
}
else
if
(
p
->
ts
<
p
Record
->
firstKey
)
{
// p->ts < pBlock->minKey.ts
if
(
p
->
version
>=
p
Block
->
minVer
)
{
if
(
p
->
version
>=
p
Record
->
minVer
)
{
if
(
i
<
num
-
1
)
{
if
(
i
<
num
-
1
)
{
TSDBKEY
*
pnext
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
i
+
1
);
TSDBKEY
*
pnext
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
i
+
1
);
if
(
pnext
->
ts
>=
p
Block
->
minKey
.
ts
)
{
if
(
pnext
->
ts
>=
p
Record
->
firstKey
)
{
return
true
;
return
true
;
}
}
}
else
{
// it must be the last point
}
else
{
// it must be the last point
...
@@ -1928,7 +1934,7 @@ static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, cons
...
@@ -1928,7 +1934,7 @@ static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, cons
return
false
;
return
false
;
}
}
static
bool
overlapWithDelSkyline
(
STableBlockScanInfo
*
pBlockScanInfo
,
const
S
DataBlk
*
pBlock
,
int32_t
order
)
{
static
bool
overlapWithDelSkyline
(
STableBlockScanInfo
*
pBlockScanInfo
,
const
S
BrinRecord
*
pRecord
,
int32_t
order
)
{
if
(
pBlockScanInfo
->
delSkyline
==
NULL
)
{
if
(
pBlockScanInfo
->
delSkyline
==
NULL
)
{
return
false
;
return
false
;
}
}
...
@@ -1936,28 +1942,28 @@ static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SDa
...
@@ -1936,28 +1942,28 @@ static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SDa
// ts is not overlap
// ts is not overlap
TSDBKEY
*
pFirst
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
0
);
TSDBKEY
*
pFirst
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
0
);
TSDBKEY
*
pLast
=
taosArrayGetLast
(
pBlockScanInfo
->
delSkyline
);
TSDBKEY
*
pLast
=
taosArrayGetLast
(
pBlockScanInfo
->
delSkyline
);
if
(
p
Block
->
minKey
.
ts
>
pLast
->
ts
||
pBlock
->
maxKey
.
ts
<
pFirst
->
ts
)
{
if
(
p
Record
->
firstKey
>
pLast
->
ts
||
pRecord
->
lastKey
<
pFirst
->
ts
)
{
return
false
;
return
false
;
}
}
// version is not overlap
// version is not overlap
if
(
ASCENDING_TRAVERSE
(
order
))
{
if
(
ASCENDING_TRAVERSE
(
order
))
{
return
doCheckforDatablockOverlap
(
pBlockScanInfo
,
p
Block
,
pBlockScanInfo
->
fileDelIndex
);
return
doCheckforDatablockOverlap
(
pBlockScanInfo
,
p
Record
,
pBlockScanInfo
->
fileDelIndex
);
}
else
{
}
else
{
int32_t
index
=
pBlockScanInfo
->
fileDelIndex
;
int32_t
index
=
pBlockScanInfo
->
fileDelIndex
;
while
(
1
)
{
while
(
1
)
{
TSDBKEY
*
p
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
index
);
TSDBKEY
*
p
=
taosArrayGet
(
pBlockScanInfo
->
delSkyline
,
index
);
if
(
p
->
ts
>
p
Block
->
minKey
.
ts
&&
index
>
0
)
{
if
(
p
->
ts
>
p
Record
->
firstKey
&&
index
>
0
)
{
index
-=
1
;
index
-=
1
;
}
else
{
// find the first point that is smaller than the minKey.ts of dataBlock.
}
else
{
// find the first point that is smaller than the minKey.ts of dataBlock.
if
(
p
->
ts
==
p
Block
->
minKey
.
ts
&&
p
->
version
<
pBlock
->
maxVer
&&
index
>
0
)
{
if
(
p
->
ts
==
p
Record
->
firstKey
&&
p
->
version
<
pRecord
->
maxVer
&&
index
>
0
)
{
index
-=
1
;
index
-=
1
;
}
}
break
;
break
;
}
}
}
}
return
doCheckforDatablockOverlap
(
pBlockScanInfo
,
p
Block
,
index
);
return
doCheckforDatablockOverlap
(
pBlockScanInfo
,
p
Record
,
index
);
}
}
}
}
...
@@ -1981,14 +1987,12 @@ static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo*
...
@@ -1981,14 +1987,12 @@ static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo*
// overlap with neighbor
// overlap with neighbor
if
(
hasNeighbor
)
{
if
(
hasNeighbor
)
{
// pInfo->overlapWithNeighborBlock = overlapWithNeighborBlock(pBlock, &bIndex, pReader->order);
pInfo
->
overlapWithNeighborBlock
=
overlapWithNeighborBlock2
(
pBlockInfo
,
&
rec
,
pReader
->
order
);
pInfo
->
overlapWithNeighborBlock
=
overlapWithNeighborBlock2
(
pBlockInfo
,
&
rec
,
pReader
->
order
);
}
}
// todo:
// has duplicated ts of different version in this block
// has duplicated ts of different version in this block
pInfo
->
hasDupTs
=
0
;
//(pBlock->nSubBlock == 1) ? pBlock->hasDup : true
;
pInfo
->
hasDupTs
=
(
pBlockInfo
->
record
.
numRow
>
pBlockInfo
->
record
.
count
)
;
pInfo
->
overlapWithDelInfo
=
false
;
//overlapWithDelSkyline(pScanInfo, pBlockInfo
, pReader->order);
pInfo
->
overlapWithDelInfo
=
overlapWithDelSkyline
(
pScanInfo
,
&
pBlockInfo
->
record
,
pReader
->
order
);
if
(
hasDataInLastBlock
(
pLastBlockReader
))
{
if
(
hasDataInLastBlock
(
pLastBlockReader
))
{
int64_t
tsLast
=
getCurrentKeyInLastBlock
(
pLastBlockReader
);
int64_t
tsLast
=
getCurrentKeyInLastBlock
(
pLastBlockReader
);
...
@@ -3307,9 +3311,11 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
...
@@ -3307,9 +3311,11 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
if
(
pReader
->
status
.
pCurrentFileset
!=
NULL
)
{
if
(
pReader
->
status
.
pCurrentFileset
!=
NULL
)
{
STFileObj
*
pTombFileObj
=
pReader
->
status
.
pCurrentFileset
->
farr
[
3
];
STFileObj
*
pTombFileObj
=
pReader
->
status
.
pCurrentFileset
->
farr
[
3
];
if
(
pTombFileObj
!=
NULL
)
{
if
(
pTombFileObj
!=
NULL
)
{
const
TTombBlkArray
*
pBlkArray
=
NULL
;
const
TTombBlkArray
*
pBlkArray
=
NULL
;
int32_t
code
=
tsdbDataFileReadTombBlk
(
pReader
->
pFileReader
,
&
pBlkArray
);
int32_t
code
=
tsdbDataFileReadTombBlk
(
pReader
->
pFileReader
,
&
pBlkArray
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
return
code
;
}
}
...
@@ -3327,6 +3333,9 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
...
@@ -3327,6 +3333,9 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
uint64_t
uid
=
pReader
->
status
.
uidList
.
tableUidList
[
j
];
uint64_t
uid
=
pReader
->
status
.
uidList
.
tableUidList
[
j
];
STableBlockScanInfo
*
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
uid
,
pReader
->
idStr
);
STableBlockScanInfo
*
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
uid
,
pReader
->
idStr
);
if
(
pScanInfo
->
pDelData
==
NULL
)
{
pScanInfo
->
pDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
}
STombRecord
record
=
{
0
};
STombRecord
record
=
{
0
};
for
(
int32_t
k
=
0
;
k
<
block
.
suid
->
size
;
++
k
)
{
for
(
int32_t
k
=
0
;
k
<
block
.
suid
->
size
;
++
k
)
{
...
@@ -3337,6 +3346,9 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
...
@@ -3337,6 +3346,9 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
j
+=
1
;
j
+=
1
;
uid
=
pReader
->
status
.
uidList
.
tableUidList
[
j
];
uid
=
pReader
->
status
.
uidList
.
tableUidList
[
j
];
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
uid
,
pReader
->
idStr
);
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
uid
,
pReader
->
idStr
);
if
(
pScanInfo
->
pDelData
==
NULL
)
{
pScanInfo
->
pDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
}
}
}
if
(
record
.
uid
<
uid
)
{
if
(
record
.
uid
<
uid
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录