Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
62f14916
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
62f14916
编写于
2月 03, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor some codes
上级
f4e29425
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
108 addition
and
2 deletion
+108
-2
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+108
-2
未找到文件。
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
62f14916
...
...
@@ -2237,7 +2237,7 @@ static int32_t applyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SBlockInfo *
// no qualified data in current block, do not update the lastKey value
assert
(
pQuery
->
ekey
<
pPrimaryColumn
[
pQuery
->
pos
]);
}
else
{
pQuery
->
lastKey
=
pPrimaryColumn
[
pQuery
->
pos
+
(
forwardStep
-
1
)]
+
step
;
pQuery
->
lastKey
=
p
Query
->
ekey
+
step
;
//p
PrimaryColumn[pQuery->pos + (forwardStep - 1)] + step;
}
}
else
{
...
...
@@ -2255,7 +2255,7 @@ static int32_t applyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SBlockInfo *
// no qualified data in current block, do not update the lastKey value
assert
(
pQuery
->
ekey
>
pPrimaryColumn
[
pQuery
->
pos
]);
}
else
{
pQuery
->
lastKey
=
pPrimaryColumn
[
pQuery
->
pos
-
(
forwardStep
-
1
)]
+
step
;
pQuery
->
lastKey
=
p
Query
->
ekey
+
step
;
//p
PrimaryColumn[pQuery->pos - (forwardStep - 1)] + step;
}
}
else
{
forwardStep
=
pQuery
->
pos
+
1
;
...
...
@@ -7175,6 +7175,112 @@ static void doApplyIntervalQueryOnBlock(SMeterQuerySupportObj *pSupporter, SMete
}
}
static
void
doApplyIntervalQueryOnBlock_rv
(
SMeterQuerySupportObj
*
pSupporter
,
SMeterQueryInfo
*
pInfo
,
SBlockInfo
*
pBlockInfo
,
int64_t
*
pPrimaryCol
,
SField
*
pFields
,
__block_search_fn_t
searchFn
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pSupporter
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
int32_t
factor
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
int64_t
nextKey
=
-
1
;
bool
completed
=
false
;
while
(
1
)
{
int32_t
numOfRes
=
0
;
int32_t
steps
=
applyFunctionsOnBlock
(
pRuntimeEnv
,
pBlockInfo
,
pPrimaryCol
,
pFields
,
searchFn
,
&
numOfRes
);
assert
(
steps
>
0
);
// NOTE: in case of stable query, only ONE(or ZERO) row of result generated for each query range
if
(
pInfo
->
lastResRows
==
0
)
{
pInfo
->
lastResRows
=
numOfRes
;
}
else
{
assert
(
pInfo
->
lastResRows
==
1
);
}
int32_t
pos
=
pQuery
->
pos
+
steps
*
factor
;
// query does not reach the end of current block
if
((
pos
<
pBlockInfo
->
size
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
pos
>=
0
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)))
{
nextKey
=
pPrimaryCol
[
pos
];
}
else
{
assert
((
pQuery
->
lastKey
>
pBlockInfo
->
keyLast
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
pQuery
->
lastKey
<
pBlockInfo
->
keyFirst
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)));
}
// all data satisfy current query are checked, query completed
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
completed
=
(
pQuery
->
lastKey
>
pQuery
->
ekey
);
}
else
{
completed
=
(
pQuery
->
lastKey
<
pQuery
->
ekey
);
}
/*
* 1. there may be more date that satisfy current query interval, other than
* current block, we need to try next data blocks
* 2. query completed, since reaches the upper bound of the main query range
*/
if
(
!
completed
)
{
/*
* Data that satisfy current query range may locate in current block and blocks that are directly right
* next to current block. Therefore, we need to keep the query range(interval) unchanged until reaching
* the direct next data block, while only forwards the pQuery->lastKey.
*
* With the information of the directly next data block, whether locates in cache or disk,
* current interval query being completed or not can be decided.
*/
saveIntervalQueryRange
(
pRuntimeEnv
,
pInfo
);
if
(
QUERY_IS_ASC_QUERY
(
pQuery
))
{
assert
(
pQuery
->
lastKey
>
pBlockInfo
->
keyLast
&&
pQuery
->
lastKey
<=
pQuery
->
ekey
);
}
else
{
assert
(
pQuery
->
lastKey
<
pBlockInfo
->
keyFirst
&&
pQuery
->
lastKey
>=
pQuery
->
ekey
);
}
break
;
}
assert
(
completed
);
if
(
pQuery
->
ekey
==
pSupporter
->
rawEKey
)
{
/* whole query completed, save result and abort */
saveResult
(
pSupporter
,
pInfo
,
pInfo
->
lastResRows
);
// save the pQuery->lastKey for retrieve data in cache, actually, there will be no qualified data in cache.
saveIntervalQueryRange
(
pRuntimeEnv
,
pInfo
);
return
;
}
else
if
((
QUERY_IS_ASC_QUERY
(
pQuery
)
&&
pQuery
->
ekey
==
pBlockInfo
->
keyLast
)
||
(
QUERY_IS_ASC_QUERY
(
pQuery
)
&&
pQuery
->
ekey
==
pBlockInfo
->
keyFirst
))
{
// /* current interval query is completed, set the next query range on other data blocks if exist */
// int64_t prevEKey = pQuery->ekey;
//
// getAlignedIntervalQueryRange(pRuntimeEnv, pQuery->lastKey, pSupporter->rawSKey, pSupporter->rawEKey);
saveIntervalQueryRange
(
pRuntimeEnv
,
pInfo
);
//
// assert(prevEKey < pQuery->skey);
// if (pInfo->lastResRows > 0) {
// saveResult(pSupporter, pInfo, pInfo->lastResRows);
// }
//
return
;
}
saveResult
(
pSupporter
,
pInfo
,
pInfo
->
lastResRows
);
assert
((
nextKey
>=
pQuery
->
lastKey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
nextKey
<=
pQuery
->
lastKey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)));
/* still in the same block to query */
getAlignedIntervalQueryRange
(
pRuntimeEnv
,
nextKey
,
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
);
saveIntervalQueryRange
(
pRuntimeEnv
,
pInfo
);
int32_t
newPos
=
searchFn
((
char
*
)
pPrimaryCol
,
pBlockInfo
->
size
,
pQuery
->
skey
,
pQuery
->
order
.
order
);
assert
(
newPos
==
pQuery
->
pos
+
steps
*
factor
);
pQuery
->
pos
=
newPos
;
}
}
int64_t
getNextAccessedKeyInData
(
SQuery
*
pQuery
,
int64_t
*
pPrimaryCol
,
SBlockInfo
*
pBlockInfo
,
int32_t
blockStatus
)
{
assert
(
pQuery
->
pos
>=
0
&&
pQuery
->
pos
<=
pBlockInfo
->
size
-
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录