Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
08854f86
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
08854f86
编写于
2月 15, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor codes of super table query in handling the sliding query.
上级
d6529943
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
395 addition
and
607 deletion
+395
-607
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+1
-1
src/system/detail/inc/vnodeQueryImpl.h
src/system/detail/inc/vnodeQueryImpl.h
+11
-9
src/system/detail/inc/vnodeRead.h
src/system/detail/inc/vnodeRead.h
+1
-2
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+375
-569
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+6
-25
src/system/detail/src/vnodeRead.c
src/system/detail/src/vnodeRead.c
+1
-1
未找到文件。
src/client/src/tscFunctionImpl.c
浏览文件 @
08854f86
...
@@ -2162,7 +2162,7 @@ static STopBotInfo *getTopBotOutputInfo(SQLFunctionCtx *pCtx) {
...
@@ -2162,7 +2162,7 @@ static STopBotInfo *getTopBotOutputInfo(SQLFunctionCtx *pCtx) {
// only the first_stage_merge is directly written data into final output buffer
// only the first_stage_merge is directly written data into final output buffer
if
(
pResInfo
->
superTableQ
&&
pCtx
->
currentStage
!=
SECONDARY_STAGE_MERGE
)
{
if
(
pResInfo
->
superTableQ
&&
pCtx
->
currentStage
!=
SECONDARY_STAGE_MERGE
)
{
return
(
STopBotInfo
*
)
pCtx
->
aOutputBuf
;
return
(
STopBotInfo
*
)
pCtx
->
aOutputBuf
;
}
else
{
//
for
normal table query and super table at the secondary_stage, result is written to intermediate buffer
}
else
{
//
during
normal table query and super table at the secondary_stage, result is written to intermediate buffer
return
pResInfo
->
interResultBuf
;
return
pResInfo
->
interResultBuf
;
}
}
}
}
...
...
src/system/detail/inc/vnodeQueryImpl.h
浏览文件 @
08854f86
...
@@ -175,8 +175,7 @@ void copyFromGroupBuf(SQInfo* pQInfo, SWindowResult* result);
...
@@ -175,8 +175,7 @@ void copyFromGroupBuf(SQInfo* pQInfo, SWindowResult* result);
SBlockInfo
getBlockBasicInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
void
*
pBlock
,
int32_t
blockType
);
SBlockInfo
getBlockBasicInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
void
*
pBlock
,
int32_t
blockType
);
SCacheBlock
*
getCacheDataBlock
(
SMeterObj
*
pMeterObj
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
slot
);
SCacheBlock
*
getCacheDataBlock
(
SMeterObj
*
pMeterObj
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
slot
);
void
queryOnBlock
(
SMeterQuerySupportObj
*
pSupporter
,
int64_t
*
primaryKeys
,
int32_t
blockStatus
,
void
queryOnBlock
(
SMeterQuerySupportObj
*
pSupporter
,
int32_t
blockStatus
,
SBlockInfo
*
pBlockBasicInfo
,
SMeterDataInfo
*
pDataHeadInfoEx
,
SField
*
pFields
,
SBlockInfo
*
pBlockBasicInfo
,
SMeterDataInfo
*
pDataHeadInfoEx
,
SField
*
pFields
,
__block_search_fn_t
searchFn
);
__block_search_fn_t
searchFn
);
int32_t
vnodeFilterQualifiedMeters
(
SQInfo
*
pQInfo
,
int32_t
vid
,
tSidSet
*
pSidSet
,
SMeterDataInfo
*
pMeterDataInfo
,
int32_t
vnodeFilterQualifiedMeters
(
SQInfo
*
pQInfo
,
int32_t
vid
,
tSidSet
*
pSidSet
,
SMeterDataInfo
*
pMeterDataInfo
,
...
@@ -278,14 +277,17 @@ void displayInterResult(SData** pdata, SQuery* pQuery, int32_t numOfRows);
...
@@ -278,14 +277,17 @@ void displayInterResult(SData** pdata, SQuery* pQuery, int32_t numOfRows);
void
vnodePrintQueryStatistics
(
SMeterQuerySupportObj
*
pSupporter
);
void
vnodePrintQueryStatistics
(
SMeterQuerySupportObj
*
pSupporter
);
void
clear
GroupResult
Buf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
pOneOutputRes
);
void
clear
TimeWindowRes
Buf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
pOneOutputRes
);
void
copy
GroupResult
Buf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
dst
,
const
SWindowResult
*
src
);
void
copy
TimeWindowRes
Buf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
dst
,
const
SWindowResult
*
src
);
void
resetSlidingWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
);
void
clearClosedSlidingWindows
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
int32_t
numOfClosedSlidingWindow
(
SWindowResInfo
*
pWindowResInfo
);
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
closeSlidingWindow
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
void
resetTimeWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
void
closeAllSlidingWindow
(
SWindowResInfo
*
pWindowResInfo
);
void
clearClosedTimeWindow
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
int32_t
numOfClosedTimeWindow
(
SWindowResInfo
*
pWindowResInfo
);
void
closeTimeWindow
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
void
closeAllTimeWindow
(
SWindowResInfo
*
pWindowResInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/system/detail/inc/vnodeRead.h
浏览文件 @
08854f86
...
@@ -197,7 +197,6 @@ typedef struct SMeterQueryInfo {
...
@@ -197,7 +197,6 @@ typedef struct SMeterQueryInfo {
int16_t
lastResRows
;
int16_t
lastResRows
;
int64_t
tag
;
int64_t
tag
;
STSCursor
cur
;
STSCursor
cur
;
SWindowResult
*
pWindowRes
;
int32_t
sid
;
// for retrieve the page id list
int32_t
sid
;
// for retrieve the page id list
SWindowResInfo
windowResInfo
;
SWindowResInfo
windowResInfo
;
...
@@ -279,7 +278,7 @@ typedef struct _qinfo {
...
@@ -279,7 +278,7 @@ typedef struct _qinfo {
int
(
*
fp
)(
SMeterObj
*
,
SQuery
*
);
int
(
*
fp
)(
SMeterObj
*
,
SQuery
*
);
}
SQInfo
;
}
SQInfo
;
int32_t
vnodeQuerySingle
Meter
Prepare
(
SQInfo
*
pQInfo
,
SMeterObj
*
pMeterObj
,
SMeterQuerySupportObj
*
pSMultiMeterObj
,
int32_t
vnodeQuerySingle
Table
Prepare
(
SQInfo
*
pQInfo
,
SMeterObj
*
pMeterObj
,
SMeterQuerySupportObj
*
pSMultiMeterObj
,
void
*
param
);
void
*
param
);
void
vnodeQueryFreeQInfoEx
(
SQInfo
*
pQInfo
);
void
vnodeQueryFreeQInfoEx
(
SQInfo
*
pQInfo
);
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
08854f86
此差异已折叠。
点击以展开。
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
08854f86
...
@@ -241,7 +241,7 @@ static void queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMeterInfo) {
...
@@ -241,7 +241,7 @@ static void queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMeterInfo) {
pRuntimeEnv
->
blockStatus
);
pRuntimeEnv
->
blockStatus
);
totalBlocks
++
;
totalBlocks
++
;
queryOnBlock
(
pSupporter
,
p
rimaryKeys
,
p
RuntimeEnv
->
blockStatus
,
&
binfo
,
&
pMeterInfo
[
k
],
NULL
,
searchFn
);
queryOnBlock
(
pSupporter
,
pRuntimeEnv
->
blockStatus
,
&
binfo
,
&
pMeterInfo
[
k
],
NULL
,
searchFn
);
if
(
ALL_CACHE_BLOCKS_CHECKED
(
pQuery
))
{
if
(
ALL_CACHE_BLOCKS_CHECKED
(
pQuery
))
{
break
;
break
;
...
@@ -447,24 +447,8 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
...
@@ -447,24 +447,8 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
(
pBlock
->
keyFirst
>=
pQuery
->
ekey
&&
pBlock
->
keyLast
<=
pQuery
->
lastKey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)));
(
pBlock
->
keyFirst
>=
pQuery
->
ekey
&&
pBlock
->
keyLast
<=
pQuery
->
lastKey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)));
}
}
if
(
pQuery
->
intervalTime
>
0
&&
pQuery
->
slidingTime
>
0
)
{
if
(
pQuery
->
intervalTime
>
0
&&
pQuery
->
slidingTime
>
0
)
{
assert
(
pMeterQueryInfo
->
lastKey
<=
nextKey
&&
QUERY_IS_ASC_QUERY
(
pQuery
));
setIntervalQueryRange
(
pMeterQueryInfo
,
pSupporter
,
nextKey
);
pMeterQueryInfo
->
lastKey
=
nextKey
;
pQuery
->
lastKey
=
nextKey
;
if
(
pMeterQueryInfo
->
windowResInfo
.
prevSKey
==
0
)
{
// normalize the window prev time window
TSKEY
skey1
,
ekey1
;
TSKEY
windowSKey
=
0
,
windowEKey
=
0
;
TSKEY
skey2
=
MIN
(
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
);
TSKEY
ekey2
=
MAX
(
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
);
doGetAlignedIntervalQueryRangeImpl
(
pQuery
,
nextKey
,
skey2
,
ekey2
,
&
skey1
,
&
ekey1
,
&
windowSKey
,
&
windowEKey
);
pMeterQueryInfo
->
windowResInfo
.
prevSKey
=
windowSKey
;
}
ret
=
setIntervalQueryExecutionContext
(
pSupporter
,
pOneMeterDataInfo
->
meterOrderIdx
,
pMeterQueryInfo
);
ret
=
setIntervalQueryExecutionContext
(
pSupporter
,
pOneMeterDataInfo
->
meterOrderIdx
,
pMeterQueryInfo
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -474,8 +458,7 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
...
@@ -474,8 +458,7 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
}
}
}
}
queryOnBlock
(
pSupporter
,
primaryKeys
,
pRuntimeEnv
->
blockStatus
,
&
binfo
,
pOneMeterDataInfo
,
pInfoEx
->
pBlock
.
fields
,
queryOnBlock
(
pSupporter
,
pRuntimeEnv
->
blockStatus
,
&
binfo
,
pOneMeterDataInfo
,
pInfoEx
->
pBlock
.
fields
,
searchFn
);
searchFn
);
}
}
tfree
(
pReqMeterDataInfo
);
tfree
(
pReqMeterDataInfo
);
...
@@ -711,7 +694,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
...
@@ -711,7 +694,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
}
}
resetCtxOutputBuf
(
pRuntimeEnv
);
resetCtxOutputBuf
(
pRuntimeEnv
);
reset
Sliding
WindowInfo
(
pRuntimeEnv
,
&
pRuntimeEnv
->
windowResInfo
);
reset
Time
WindowInfo
(
pRuntimeEnv
,
&
pRuntimeEnv
->
windowResInfo
);
while
(
pSupporter
->
meterIdx
<
pSupporter
->
numOfMeters
)
{
while
(
pSupporter
->
meterIdx
<
pSupporter
->
numOfMeters
)
{
int32_t
k
=
pSupporter
->
meterIdx
;
int32_t
k
=
pSupporter
->
meterIdx
;
...
@@ -1115,7 +1098,7 @@ static void vnodeSingleMeterIntervalMainLooper(SMeterQuerySupportObj *pSupporter
...
@@ -1115,7 +1098,7 @@ static void vnodeSingleMeterIntervalMainLooper(SMeterQuerySupportObj *pSupporter
while
(
1
)
{
while
(
1
)
{
initCtxOutputBuf
(
pRuntimeEnv
);
initCtxOutputBuf
(
pRuntimeEnv
);
clearClosed
SlidingWindows
(
pRuntimeEnv
);
clearClosed
TimeWindow
(
pRuntimeEnv
);
vnodeScanAllData
(
pRuntimeEnv
);
vnodeScanAllData
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQuery
))
{
if
(
isQueryKilled
(
pQuery
))
{
...
@@ -1124,8 +1107,6 @@ static void vnodeSingleMeterIntervalMainLooper(SMeterQuerySupportObj *pSupporter
...
@@ -1124,8 +1107,6 @@ static void vnodeSingleMeterIntervalMainLooper(SMeterQuerySupportObj *pSupporter
assert
(
!
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_NOT_COMPLETED
));
assert
(
!
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_NOT_COMPLETED
));
// clear tag, used to decide if the whole interval query is completed or not
pQuery
->
over
&=
(
~
QUERY_COMPLETED
);
doFinalizeResult
(
pRuntimeEnv
);
doFinalizeResult
(
pRuntimeEnv
);
int64_t
maxOutput
=
getNumOfResult
(
pRuntimeEnv
);
int64_t
maxOutput
=
getNumOfResult
(
pRuntimeEnv
);
...
@@ -1143,7 +1124,7 @@ static void vnodeSingleMeterIntervalMainLooper(SMeterQuerySupportObj *pSupporter
...
@@ -1143,7 +1124,7 @@ static void vnodeSingleMeterIntervalMainLooper(SMeterQuerySupportObj *pSupporter
// forwardCtxOutputBuf(pRuntimeEnv, maxOutput);
// forwardCtxOutputBuf(pRuntimeEnv, maxOutput);
}
}
if
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_NO_DATA_TO_CHECK
))
{
if
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_NO_DATA_TO_CHECK
|
QUERY_COMPLETED
))
{
break
;
break
;
}
}
...
...
src/system/detail/src/vnodeRead.c
浏览文件 @
08854f86
...
@@ -670,7 +670,7 @@ void *vnodeQueryOnSingleTable(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
...
@@ -670,7 +670,7 @@ void *vnodeQueryOnSingleTable(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
tsBufNextPos
(
pTSBuf
);
tsBufNextPos
(
pTSBuf
);
}
}
if
(((
*
code
)
=
vnodeQuerySingle
Meter
Prepare
(
pQInfo
,
pQInfo
->
pObj
,
pSupporter
,
pTSBuf
))
!=
TSDB_CODE_SUCCESS
)
{
if
(((
*
code
)
=
vnodeQuerySingle
Table
Prepare
(
pQInfo
,
pQInfo
->
pObj
,
pSupporter
,
pTSBuf
))
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录