Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
04b6576a
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看板
未验证
提交
04b6576a
编写于
2月 01, 2023
作者:
H
Haojun Liao
提交者:
GitHub
2月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19728 from taosdata/fix/nodisk
fix(query): reset the del file index when beginning last file check.
上级
a3a2af4b
c4531512
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
16 deletion
+62
-16
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+28
-16
tests/script/tsim/parser/regressiontest.sim
tests/script/tsim/parser/regressiontest.sim
+34
-0
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
04b6576a
...
...
@@ -215,6 +215,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader);
static
TSDBKEY
getCurrentKeyInBuf
(
STableBlockScanInfo
*
pScanInfo
,
STsdbReader
*
pReader
);
static
bool
hasDataInFileBlock
(
const
SBlockData
*
pBlockData
,
const
SFileBlockDumpInfo
*
pDumpInfo
);
static
void
initBlockDumpInfo
(
STsdbReader
*
pReader
,
SDataBlockIter
*
pBlockIter
);
static
int32_t
getInitialDelIndex
(
const
SArray
*
pDelSkyline
,
int32_t
order
);
static
bool
outOfTimeWindow
(
int64_t
ts
,
STimeWindow
*
pWindow
)
{
return
(
ts
>
pWindow
->
ekey
)
||
(
ts
<
pWindow
->
skey
);
}
...
...
@@ -2526,6 +2527,14 @@ _end:
void
setComposedBlockFlag
(
STsdbReader
*
pReader
,
bool
composed
)
{
pReader
->
status
.
composedDataBlock
=
composed
;
}
int32_t
getInitialDelIndex
(
const
SArray
*
pDelSkyline
,
int32_t
order
)
{
if
(
pDelSkyline
==
NULL
)
{
return
0
;
}
return
ASCENDING_TRAVERSE
(
order
)
?
0
:
taosArrayGetSize
(
pDelSkyline
)
-
1
;
}
int32_t
initDelSkylineIterator
(
STableBlockScanInfo
*
pBlockScanInfo
,
STsdbReader
*
pReader
,
STbData
*
pMemTbData
,
STbData
*
piMemTbData
)
{
if
(
pBlockScanInfo
->
delSkyline
!=
NULL
)
{
...
...
@@ -2543,7 +2552,6 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
if
(
pIdx
!=
NULL
)
{
code
=
tsdbReadDelData
(
pReader
->
pDelFReader
,
pIdx
,
pDelData
);
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
...
...
@@ -2572,11 +2580,13 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
}
taosArrayDestroy
(
pDelData
);
pBlockScanInfo
->
iter
.
index
=
ASCENDING_TRAVERSE
(
pReader
->
order
)
?
0
:
taosArrayGetSize
(
pBlockScanInfo
->
delSkyline
)
-
1
;
pBlockScanInfo
->
iiter
.
index
=
pBlockScanInfo
->
iter
.
index
;
pBlockScanInfo
->
fileDelIndex
=
pBlockScanInfo
->
iter
.
index
;
pBlockScanInfo
->
lastBlockDelIndex
=
pBlockScanInfo
->
iter
.
index
;
int32_t
index
=
getInitialDelIndex
(
pBlockScanInfo
->
delSkyline
,
pReader
->
order
);
pBlockScanInfo
->
iter
.
index
=
index
;
pBlockScanInfo
->
iiter
.
index
=
index
;
pBlockScanInfo
->
fileDelIndex
=
index
;
pBlockScanInfo
->
lastBlockDelIndex
=
index
;
return
code
;
_err:
...
...
@@ -2676,13 +2686,17 @@ static int32_t uidComparFunc(const void* p1, const void* p2) {
}
}
static
void
extractOrderedTableUidList
(
SUidOrderCheckInfo
*
pOrderCheckInfo
,
SReaderStatus
*
pStatus
)
{
static
void
extractOrderedTableUidList
(
SUidOrderCheckInfo
*
pOrderCheckInfo
,
SReaderStatus
*
pStatus
,
int32_t
order
)
{
int32_t
index
=
0
;
int32_t
total
=
taosHashGetSize
(
pStatus
->
pTableMap
);
void
*
p
=
taosHashIterate
(
pStatus
->
pTableMap
,
NULL
);
while
(
p
!=
NULL
)
{
STableBlockScanInfo
*
pScanInfo
=
*
(
STableBlockScanInfo
**
)
p
;
// reset the last del file index
pScanInfo
->
lastBlockDelIndex
=
getInitialDelIndex
(
pScanInfo
->
delSkyline
,
order
);
pOrderCheckInfo
->
tableUidList
[
index
++
]
=
pScanInfo
->
uid
;
p
=
taosHashIterate
(
pStatus
->
pTableMap
,
p
);
}
...
...
@@ -2690,7 +2704,9 @@ static void extractOrderedTableUidList(SUidOrderCheckInfo* pOrderCheckInfo, SRea
taosSort
(
pOrderCheckInfo
->
tableUidList
,
total
,
sizeof
(
uint64_t
),
uidComparFunc
);
}
static
int32_t
initOrderCheckInfo
(
SUidOrderCheckInfo
*
pOrderCheckInfo
,
SReaderStatus
*
pStatus
)
{
static
int32_t
initOrderCheckInfo
(
SUidOrderCheckInfo
*
pOrderCheckInfo
,
STsdbReader
*
pReader
)
{
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
int32_t
total
=
taosHashGetSize
(
pStatus
->
pTableMap
);
if
(
total
==
0
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -2703,7 +2719,7 @@ static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, SReaderSt
return
TSDB_CODE_OUT_OF_MEMORY
;
}
extractOrderedTableUidList
(
pOrderCheckInfo
,
pStatus
);
extractOrderedTableUidList
(
pOrderCheckInfo
,
pStatus
,
pReader
->
order
);
uint64_t
uid
=
pOrderCheckInfo
->
tableUidList
[
0
];
pStatus
->
pTableIter
=
taosHashGet
(
pStatus
->
pTableMap
,
&
uid
,
sizeof
(
uid
));
}
else
{
...
...
@@ -2720,7 +2736,7 @@ static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, SReaderSt
}
pOrderCheckInfo
->
tableUidList
=
p
;
extractOrderedTableUidList
(
pOrderCheckInfo
,
pStatus
);
extractOrderedTableUidList
(
pOrderCheckInfo
,
pStatus
,
pReader
->
order
);
uid
=
pOrderCheckInfo
->
tableUidList
[
0
];
pStatus
->
pTableIter
=
taosHashGet
(
pStatus
->
pTableMap
,
&
uid
,
sizeof
(
uid
));
...
...
@@ -2740,11 +2756,7 @@ static bool moveToNextTable(SUidOrderCheckInfo* pOrderedCheckInfo, SReaderStatus
uint64_t
uid
=
pOrderedCheckInfo
->
tableUidList
[
pOrderedCheckInfo
->
currentIndex
];
pStatus
->
pTableIter
=
taosHashGet
(
pStatus
->
pTableMap
,
&
uid
,
sizeof
(
uid
));
if
(
pStatus
->
pTableIter
==
NULL
)
{
return
false
;
}
return
true
;
return
(
pStatus
->
pTableIter
!=
NULL
);
}
static
int32_t
doLoadLastBlockSequentially
(
STsdbReader
*
pReader
)
{
...
...
@@ -2752,7 +2764,7 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
SLastBlockReader
*
pLastBlockReader
=
pStatus
->
fileIter
.
pLastBlockReader
;
SUidOrderCheckInfo
*
pOrderedCheckInfo
=
&
pStatus
->
uidCheckInfo
;
int32_t
code
=
initOrderCheckInfo
(
pOrderedCheckInfo
,
p
Status
);
int32_t
code
=
initOrderCheckInfo
(
pOrderedCheckInfo
,
p
Reader
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
(
taosHashGetSize
(
pStatus
->
pTableMap
)
==
0
))
{
return
code
;
}
...
...
tests/script/tsim/parser/regressiontest.sim
浏览文件 @
04b6576a
...
...
@@ -63,4 +63,38 @@ if $rows != 8198 then
return -1
endi
print ===========================> TD-22077 && TD-21877
sql drop database if exists $db -x step1
sql create database $db vgroups 1;
sql use $db
sql create stable st1 (ts timestamp, c int) tags(a int);
sql create table t1 using st1 tags(1);
sql create table t2 using st1 tags(2);
$i = 0
$ts = 1674977959000
$rowNum = 200
$x = 0
while $x < $rowNum
$xs = $x * $delta
$ts = $ts0 + $xs
sql insert into t1 values ( $ts , $x )
sql insert into t2 values ( $ts + 1000a, $x )
$x = $x + 1
$ts = $ts + 1000
endw
sql flush database $db
sql insert into t1 values('2018-09-17 09:00:26', 26);
sql insert into t2 values('2018-09-17 09:00:25', 25);
sql insert into t2 values('2018-09-17 09:00:30', 30);
sql flush database reg_db0;
sql delete from st1 where ts<='2018-9-17 09:00:26';
sql select * from st1;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录