Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
afadf24a
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看板
提交
afadf24a
编写于
9月 25, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue #560
上级
137c4cf1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
15 deletion
+44
-15
src/system/src/vnodeQueryImpl.c
src/system/src/vnodeQueryImpl.c
+44
-15
未找到文件。
src/system/src/vnodeQueryImpl.c
浏览文件 @
afadf24a
...
...
@@ -5862,25 +5862,54 @@ static void validateResultBuf(SMeterQuerySupportObj *pSupporter, SMeterQueryInfo
}
}
void
saveResult
(
SMeterQuerySupportObj
*
pSupporter
,
SMeterQueryInfo
*
sqi
nfo
,
int32_t
numOfResult
)
{
void
saveResult
(
SMeterQuerySupportObj
*
pSupporter
,
SMeterQueryInfo
*
pMeterQueryI
nfo
,
int32_t
numOfResult
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pSupporter
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
if
(
numOfResult
<=
0
)
{
return
;
if
(
IS_MASTER_SCAN
(
pRuntimeEnv
))
{
return
;
}
else
{
/*
* There is a case that no result generated during the the supplement scan, and during the main
* scan also no result generated. The index can be backwards moved.
*
* However, if during the main scan, there is a result generated, such as applies count to timestamp, which
* always generates a result, but applies last query to a NULL column may fail to generate no results during the
* supplement scan.
*
* NOTE:
* nStartQueryTimestamp is the actually timestamp of current interval, if the actually interval timestamp
* equals to the recorded timestamp that is acquired during the master scan, backwards one step even
* there is no results during the supplementary scan.
*/
TSKEY
ts
=
*
(
TSKEY
*
)
pRuntimeEnv
->
pCtx
[
0
].
aOutputBuf
;
if
(
ts
==
pRuntimeEnv
->
pCtx
[
0
].
nStartQueryTimestamp
&&
pMeterQueryInfo
->
reverseIndex
>
0
)
{
assert
(
pMeterQueryInfo
->
numOfRes
>=
0
&&
pMeterQueryInfo
->
reverseIndex
>
0
&&
pMeterQueryInfo
->
reverseIndex
<=
pMeterQueryInfo
->
numOfRes
);
// backward one step from the previous position, the start position is (pMeterQueryInfo->numOfRows-1);
pMeterQueryInfo
->
reverseIndex
-=
1
;
setCtxOutputPointerForSupplementScan
(
pSupporter
,
pMeterQueryInfo
);
}
return
;
}
}
assert
(
sqi
nfo
->
lastResRows
==
1
);
assert
(
pMeterQueryI
nfo
->
lastResRows
==
1
);
numOfResult
=
1
;
sqinfo
->
lastResRows
=
0
;
if
(
IS_SUPPLEMENT_SCAN
(
pRuntimeEnv
)
&&
sqinfo
->
reverseFillRes
==
1
)
{
assert
(
sqinfo
->
numOfRes
>
0
&&
sqinfo
->
reverseIndex
>
0
&&
sqinfo
->
reverseIndex
<=
sqinfo
->
numOfRes
);
// backward one step from the previous position, the start position is (sqinfo->numOfRows-1);
sqinfo
->
reverseIndex
-=
1
;
setCtxOutputPointerForSupplementScan
(
pSupporter
,
sqinfo
);
pMeterQueryInfo
->
lastResRows
=
0
;
if
(
IS_SUPPLEMENT_SCAN
(
pRuntimeEnv
)
&&
pMeterQueryInfo
->
reverseFillRes
==
1
)
{
assert
(
pMeterQueryInfo
->
numOfRes
>
0
&&
pMeterQueryInfo
->
reverseIndex
>
0
&&
pMeterQueryInfo
->
reverseIndex
<=
pMeterQueryInfo
->
numOfRes
);
// backward one step from the previous position, the start position is (pMeterQueryInfo->numOfRows-1);
pMeterQueryInfo
->
reverseIndex
-=
1
;
setCtxOutputPointerForSupplementScan
(
pSupporter
,
pMeterQueryInfo
);
}
else
{
int32_t
pageId
=
sqinfo
->
pageList
[
sqi
nfo
->
numOfPages
-
1
];
int32_t
pageId
=
pMeterQueryInfo
->
pageList
[
pMeterQueryI
nfo
->
numOfPages
-
1
];
tFilePage
*
pData
=
getFilePage
(
pSupporter
,
pageId
);
// in handling records occuring around '1970-01-01', the aligned start
...
...
@@ -5890,15 +5919,15 @@ void saveResult(SMeterQuerySupportObj *pSupporter, SMeterQueryInfo *sqinfo, int3
SMeterObj
*
pMeterObj
=
pRuntimeEnv
->
pMeterObj
;
qTrace
(
"QInfo:%p vid:%d sid:%d id:%s, save results, ts:%lld, total:%d"
,
GET_QINFO_ADDR
(
pQuery
),
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
ts
,
sqi
nfo
->
numOfRes
+
1
);
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
ts
,
pMeterQueryI
nfo
->
numOfRes
+
1
);
pData
->
numOfElems
+=
numOfResult
;
sqi
nfo
->
numOfRes
+=
numOfResult
;
pMeterQueryI
nfo
->
numOfRes
+=
numOfResult
;
assert
(
pData
->
numOfElems
<=
pRuntimeEnv
->
numOfRowsPerPage
);
setOutputBufferForIntervalQuery
(
pSupporter
,
sqi
nfo
);
setOutputBufferForIntervalQuery
(
pSupporter
,
pMeterQueryI
nfo
);
validateResultBuf
(
pSupporter
,
sqi
nfo
);
validateResultBuf
(
pSupporter
,
pMeterQueryI
nfo
);
initCtxOutputBuf
(
pRuntimeEnv
);
#if 0
SSchema sc[TSDB_MAX_COLUMNS] = {0};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录