Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a0a6c9e9
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,发现更多精彩内容 >>
提交
a0a6c9e9
编写于
9月 07, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix bug caused by refactor.
上级
74260ebd
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
9 deletion
+29
-9
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+20
-8
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+9
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
a0a6c9e9
...
...
@@ -121,10 +121,10 @@ static SBlockData* loadBlockIfMissing(SLDataIter *pIter) {
}
// find the earliest block that contains the required records
static
FORCE_INLINE
int32_t
findEarliestIndex
(
int32_t
index
,
uint64_t
uid
,
const
SSttBlk
*
pBlockList
,
int32_t
backward
)
{
static
FORCE_INLINE
int32_t
findEarliestIndex
(
int32_t
index
,
uint64_t
uid
,
const
SSttBlk
*
pBlockList
,
int32_t
num
,
int32_t
backward
)
{
int32_t
i
=
index
;
int32_t
step
=
backward
?
1
:-
1
;
while
(
uid
>=
pBlockList
[
i
].
minUid
&&
uid
<=
pBlockList
[
i
].
maxUid
&&
i
>=
0
)
{
while
(
uid
>=
pBlockList
[
i
].
minUid
&&
uid
<=
pBlockList
[
i
].
maxUid
&&
i
>=
0
&&
i
<
num
)
{
i
+=
step
;
}
return
i
-
step
;
...
...
@@ -146,7 +146,7 @@ static int32_t binarySearchForStartBlock(SSttBlk*pBlockList, int32_t num, uint64
while
(
1
)
{
if
(
uid
>=
pBlockList
[
firstPos
].
minUid
&&
uid
<=
pBlockList
[
firstPos
].
maxUid
)
{
return
findEarliestIndex
(
firstPos
,
uid
,
pBlockList
,
backward
);
return
findEarliestIndex
(
firstPos
,
uid
,
pBlockList
,
num
,
backward
);
}
if
(
uid
>
pBlockList
[
lastPos
].
maxUid
||
uid
<
pBlockList
[
firstPos
].
minUid
)
{
...
...
@@ -161,15 +161,15 @@ static int32_t binarySearchForStartBlock(SSttBlk*pBlockList, int32_t num, uint64
}
else
if
(
uid
>
pBlockList
[
midPos
].
maxUid
)
{
firstPos
=
midPos
+
1
;
}
else
{
return
findEarliestIndex
(
midPos
,
uid
,
pBlockList
,
backward
);
return
findEarliestIndex
(
midPos
,
uid
,
pBlockList
,
num
,
backward
);
}
}
}
static
FORCE_INLINE
int32_t
findEarliestRow
(
int32_t
index
,
uint64_t
uid
,
const
uint64_t
*
uidList
,
int32_t
backward
)
{
static
FORCE_INLINE
int32_t
findEarliestRow
(
int32_t
index
,
uint64_t
uid
,
const
uint64_t
*
uidList
,
int32_t
num
,
int32_t
backward
)
{
int32_t
i
=
index
;
int32_t
step
=
backward
?
1
:-
1
;
while
(
uid
==
uidList
[
i
]
&&
i
>=
0
)
{
while
(
uid
==
uidList
[
i
]
&&
i
>=
0
&&
i
<
num
)
{
i
+=
step
;
}
return
i
-
step
;
...
...
@@ -186,7 +186,7 @@ static int32_t binarySearchForStartRowIndex(uint64_t* uidList, int32_t num, uint
while
(
1
)
{
if
(
uid
==
uidList
[
firstPos
])
{
return
findEarliestRow
(
firstPos
,
uid
,
uidList
,
backward
);
return
findEarliestRow
(
firstPos
,
uid
,
uidList
,
num
,
backward
);
}
if
(
uid
>
uidList
[
lastPos
]
||
uid
<
uidList
[
firstPos
])
{
...
...
@@ -201,7 +201,7 @@ static int32_t binarySearchForStartRowIndex(uint64_t* uidList, int32_t num, uint
}
else
if
(
uid
>
uidList
[
midPos
])
{
firstPos
=
midPos
+
1
;
}
else
{
return
findEarliestRow
(
midPos
,
uid
,
uidList
,
backward
);
return
findEarliestRow
(
midPos
,
uid
,
uidList
,
num
,
backward
);
}
}
}
...
...
@@ -227,6 +227,18 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
code
=
tsdbReadSttBlk
(
pReader
,
iStt
,
pBlockLoadInfo
->
aSttBlk
);
if
(
code
)
{
goto
_exit
;
}
else
{
size_t
size
=
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
);
SArray
*
pTmp
=
taosArrayInit
(
size
,
sizeof
(
SSttBlk
));
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SSttBlk
*
p
=
taosArrayGet
(
pBlockLoadInfo
->
aSttBlk
,
i
);
if
(
p
->
suid
==
suid
)
{
taosArrayPush
(
pTmp
,
p
);
}
}
taosArrayDestroy
(
pBlockLoadInfo
->
aSttBlk
);
pBlockLoadInfo
->
aSttBlk
=
pTmp
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
a0a6c9e9
...
...
@@ -1429,6 +1429,9 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
return
TSDB_CODE_SUCCESS
;
}
else
{
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
tRowMerge
(
&
merge
,
&
fRow1
);
doMergeRowsInLastBlock
(
pLastBlockReader
,
pBlockScanInfo
,
tsLastBlock
,
&
merge
);
// merge with block data if ts == key
...
...
@@ -3122,11 +3125,16 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S
SColumnInfoData
*
pCol
=
taosArrayGet
(
pResBlock
->
pDataBlock
,
i
);
SColData
*
pData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
j
);
if
(
pData
->
cid
<
pCol
->
info
.
colId
)
{
j
+=
1
;
continue
;
}
if
(
pData
->
cid
==
pCol
->
info
.
colId
)
{
tColDataGetValue
(
pData
,
rowIndex
,
&
cv
);
doCopyColVal
(
pCol
,
outputRowIndex
,
i
,
&
cv
,
pSupInfo
);
j
+=
1
;
}
else
{
// the specified column does not exist in file block, fill with null data
}
else
if
(
pData
->
cid
>
pCol
->
info
.
colId
)
{
// the specified column does not exist in file block, fill with null data
colDataAppendNULL
(
pCol
,
outputRowIndex
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录