Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
edcad56d
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
edcad56d
编写于
9月 04, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the issue #439
上级
920edd13
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
36 deletion
+54
-36
src/system/src/vnodeQueryImpl.c
src/system/src/vnodeQueryImpl.c
+33
-30
src/system/src/vnodeQueryProcess.c
src/system/src/vnodeQueryProcess.c
+21
-6
未找到文件。
src/system/src/vnodeQueryImpl.c
浏览文件 @
edcad56d
...
...
@@ -2694,35 +2694,17 @@ static void vnodeOpenAllFiles(SQInfo *pQInfo, int32_t vnodeId) {
static
void
updateOffsetVal
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SBlockInfo
*
pBlockInfo
,
void
*
pBlock
)
{
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
int32_t
newPos
=
pQuery
->
pos
;
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
if
(
newPos
+
pQuery
->
limit
.
offset
>
pBlockInfo
->
size
)
{
newPos
=
pBlockInfo
->
size
-
1
;
}
else
{
newPos
+=
pQuery
->
limit
.
offset
;
}
}
else
{
if
(
newPos
<
pQuery
->
limit
.
offset
)
{
newPos
=
0
;
}
else
{
newPos
-=
pQuery
->
limit
.
offset
;
}
}
TSKEY
newKey
=
0
;
if
(
IS_DISK_DATA_BLOCK
(
pQuery
))
{
newKey
=
getTimestampInDiskBlock
(
pRuntimeEnv
,
newPos
);
}
else
{
newKey
=
getTimestampInCacheBlock
(
pBlock
,
newPos
);
}
/*
* The actually qualified points that can be skipped needs to be calculated if query is
* done in current data block
*/
if
((
newKey
>
pQuery
->
ekey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
newKey
<
pQuery
->
ekey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)))
{
setQueryStatus
(
pQuery
,
QUERY_COMPLETED
);
if
((
pQuery
->
ekey
<=
pBlockInfo
->
keyLast
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
pQuery
->
ekey
>=
pBlockInfo
->
keyFirst
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)))
{
// force load timestamp data blocks
if
(
IS_DISK_DATA_BLOCK
(
pQuery
))
{
getTimestampInDiskBlock
(
pRuntimeEnv
,
0
);
}
// update the pQuery->limit.offset value, and pQuery->pos value
TSKEY
*
keys
=
NULL
;
...
...
@@ -2741,6 +2723,7 @@ static void updateOffsetVal(SQueryRuntimeEnv *pRuntimeEnv, SBlockInfo* pBlockInf
break
;
}
}
}
else
{
for
(
i
=
pQuery
->
pos
;
i
>=
0
&&
pQuery
->
limit
.
offset
>
0
;
--
i
)
{
if
(
keys
[
i
]
>=
pQuery
->
ekey
)
{
...
...
@@ -2751,14 +2734,31 @@ static void updateOffsetVal(SQueryRuntimeEnv *pRuntimeEnv, SBlockInfo* pBlockInf
}
}
pQuery
->
pos
=
i
;
if
(((
i
==
pBlockInfo
->
size
||
keys
[
i
]
>
pQuery
->
ekey
)
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
((
i
<
0
||
keys
[
i
]
<
pQuery
->
ekey
)
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)))
{
setQueryStatus
(
pQuery
,
QUERY_COMPLETED
);
pQuery
->
pos
=
-
1
;
}
else
{
pQuery
->
pos
=
i
;
}
}
else
{
pQuery
->
skey
=
newKey
;
pQuery
->
lastKey
=
pQuery
->
skey
;
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
pQuery
->
pos
+=
pQuery
->
limit
.
offset
;
}
else
{
pQuery
->
pos
-=
pQuery
->
limit
.
offset
;
}
assert
(
pQuery
->
pos
>=
0
&&
pQuery
->
pos
<=
pBlockInfo
->
size
-
1
);
if
(
IS_DISK_DATA_BLOCK
(
pQuery
))
{
pQuery
->
skey
=
getTimestampInDiskBlock
(
pRuntimeEnv
,
pQuery
->
pos
);
}
else
{
pQuery
->
skey
=
getTimestampInCacheBlock
(
pBlock
,
pQuery
->
pos
);
}
// update the offset value
pQuery
->
l
imit
.
offset
-=
abs
(
newPos
-
pQuery
->
pos
)
;
pQuery
->
pos
=
newPos
;
pQuery
->
l
astKey
=
pQuery
->
skey
;
pQuery
->
limit
.
offset
=
0
;
}
}
...
...
@@ -4565,6 +4565,9 @@ void doSkipResults(SQueryRuntimeEnv *pRuntimeEnv) {
pQuery
->
pointsOffset
=
pQuery
->
pointsToRead
;
// clear all data in result buffer
resetCtxOutputBuf
(
pRuntimeEnv
);
// clear the buffer is full flag if exists
pQuery
->
over
&=
(
~
QUERY_RESBUF_FULL
);
}
else
{
int32_t
numOfSkip
=
(
int32_t
)
pQuery
->
limit
.
offset
;
int32_t
size
=
pQuery
->
pointsRead
;
...
...
src/system/src/vnodeQueryProcess.c
浏览文件 @
edcad56d
...
...
@@ -550,7 +550,9 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
assert
(
pSids
->
numOfSubSet
==
1
&&
start
==
0
&&
end
==
pSids
->
numOfSids
-
1
&&
pSupporter
->
meterIdx
>=
start
&&
pSupporter
->
meterIdx
<=
end
);
for
(
int32_t
k
=
pSupporter
->
meterIdx
;
k
<=
end
;
++
k
,
++
pSupporter
->
meterIdx
)
{
while
(
pSupporter
->
meterIdx
<
pSupporter
->
numOfMeters
)
{
int32_t
k
=
pSupporter
->
meterIdx
;
if
(
isQueryKilled
(
pQuery
))
{
setQueryStatus
(
pQuery
,
QUERY_NO_DATA_TO_CHECK
);
return
;
...
...
@@ -561,6 +563,8 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
if
(
!
multimeterMultioutputHelper
(
pQInfo
,
&
dataInDisk
,
&
dataInCache
,
k
,
start
))
{
pQuery
->
skey
=
pSupporter
->
rawSKey
;
pQuery
->
ekey
=
pSupporter
->
rawEKey
;
pSupporter
->
meterIdx
++
;
continue
;
}
...
...
@@ -573,6 +577,8 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
if
(
normalizedFirstQueryRange
(
dataInDisk
,
dataInCache
,
pSupporter
,
&
pointInterpSupporter
)
==
false
)
{
pQuery
->
skey
=
pSupporter
->
rawSKey
;
pQuery
->
ekey
=
pSupporter
->
rawEKey
;
pSupporter
->
meterIdx
++
;
continue
;
}
...
...
@@ -582,6 +588,8 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
if
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_NO_DATA_TO_CHECK
|
QUERY_COMPLETED
))
{
pQuery
->
skey
=
pSupporter
->
rawSKey
;
pQuery
->
ekey
=
pSupporter
->
rawEKey
;
pSupporter
->
meterIdx
++
;
continue
;
}
}
...
...
@@ -595,7 +603,7 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
pQuery
->
pointsRead
=
getNumOfResult
(
pRuntimeEnv
);
doSkipResults
(
pRuntimeEnv
);
//
set
query completed
//
the limitation of output result is reached, set the
query completed
if
(
doRevisedResultsByLimit
(
pQInfo
))
{
pSupporter
->
meterIdx
=
pSupporter
->
pSidSet
->
numOfSids
;
break
;
...
...
@@ -610,17 +618,24 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
*/
pQuery
->
skey
=
pSupporter
->
rawSKey
;
pQuery
->
ekey
=
pSupporter
->
rawEKey
;
pSupporter
->
meterIdx
++
;
if
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_RESBUF_FULL
))
{
pSupporter
->
meterIdx
++
;
break
;
}
}
else
{
assert
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_RESBUF_FULL
));
// forward query range
pQuery
->
skey
=
pQuery
->
lastKey
;
break
;
// all data in the result buffer are skipped due to the offset, continue to retrieve data from current meter
if
(
pQuery
->
pointsRead
==
0
)
{
assert
(
!
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_RESBUF_FULL
));
continue
;
}
else
{
//buffer is full, wait for the next round to retrieve data from current meter
assert
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_RESBUF_FULL
));
break
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录