Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e6af460b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
未验证
提交
e6af460b
编写于
9月 02, 2021
作者:
D
dapan1121
提交者:
GitHub
9月 02, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7754 from taosdata/hotfix/TD-6477-2
[td-6477]fix interval query crash issue
上级
f1845e1d
70fffcb6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
20 deletion
+38
-20
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+15
-9
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+23
-11
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
e6af460b
...
...
@@ -3525,7 +3525,7 @@ void copyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, int32_t threshold, SSDataBl
}
static
void
updateTableQueryInfoForReverseScan
(
STableQueryInfo
*
pTableQueryInfo
)
{
static
void
updateTableQueryInfoForReverseScan
(
STableQueryInfo
*
pTableQueryInfo
,
int64_t
qId
)
{
if
(
pTableQueryInfo
==
NULL
)
{
return
;
}
...
...
@@ -3536,6 +3536,9 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo *pTableQueryInfo)
SWITCH_ORDER
(
pTableQueryInfo
->
cur
.
order
);
pTableQueryInfo
->
cur
.
vgroupIndex
=
-
1
;
qDebug
(
"0x%"
PRIx64
" update query window for reverse scan, %"
PRId64
" - %"
PRId64
", lastKey:%"
PRId64
,
qId
,
pTableQueryInfo
->
win
.
skey
,
pTableQueryInfo
->
win
.
ekey
,
pTableQueryInfo
->
lastKey
);
// set the index to be the end slot of result rows array
SResultRowInfo
*
pResultRowInfo
=
&
pTableQueryInfo
->
resInfo
;
if
(
pResultRowInfo
->
size
>
0
)
{
...
...
@@ -3556,7 +3559,7 @@ static void setupQueryRangeForReverseScan(SQueryRuntimeEnv* pRuntimeEnv) {
size_t
t
=
taosArrayGetSize
(
group
);
for
(
int32_t
j
=
0
;
j
<
t
;
++
j
)
{
STableQueryInfo
*
pCheckInfo
=
taosArrayGetP
(
group
,
j
);
updateTableQueryInfoForReverseScan
(
pCheckInfo
);
updateTableQueryInfoForReverseScan
(
pCheckInfo
,
GET_QID
(
pRuntimeEnv
)
);
// update the last key in tableKeyInfo list, the tableKeyInfo is used to build the tsdbQueryHandle and decide
// the start check timestamp of tsdbQueryHandle
...
...
@@ -4096,7 +4099,7 @@ void setParamForStableStddevByColData(SQueryRuntimeEnv* pRuntimeEnv, SQLFunction
* merged during merge stage. In this case, we need the pTableQueryInfo->lastResRows to decide if there
* is a previous result generated or not.
*/
void
setIntervalQueryRange
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
TSKEY
key
)
{
void
setIntervalQueryRange
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
STimeWindow
*
winx
,
int32_t
tid
)
{
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
STableQueryInfo
*
pTableQueryInfo
=
pRuntimeEnv
->
current
;
SResultRowInfo
*
pResultRowInfo
=
&
pTableQueryInfo
->
resInfo
;
...
...
@@ -4105,9 +4108,14 @@ void setIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, TSKEY key) {
return
;
}
TSKEY
key
=
QUERY_IS_ASC_QUERY
(
pQueryAttr
)
?
winx
->
skey
:
winx
->
ekey
;
qDebug
(
"0x%"
PRIx64
" update query window, tid:%d, %"
PRId64
" - %"
PRId64
", old:%"
PRId64
" - %"
PRId64
,
GET_QID
(
pRuntimeEnv
),
tid
,
key
,
pTableQueryInfo
->
win
.
ekey
,
pTableQueryInfo
->
win
.
skey
,
pTableQueryInfo
->
win
.
ekey
);
pTableQueryInfo
->
win
.
skey
=
key
;
STimeWindow
win
=
{.
skey
=
key
,
.
ekey
=
pQueryAttr
->
window
.
ekey
};
/**
* In handling the both ascending and descending order super table query, we need to find the first qualified
* timestamp of this table, and then set the first qualified start timestamp.
...
...
@@ -6029,7 +6037,7 @@ static SSDataBlock* doSTableIntervalAgg(void* param, bool* newgroup) {
setTagValue
(
pOperator
,
pTableQueryInfo
->
pTable
,
pIntervalInfo
->
pCtx
,
pOperator
->
numOfOutput
);
setInputDataBlock
(
pOperator
,
pIntervalInfo
->
pCtx
,
pBlock
,
pQueryAttr
->
order
.
order
);
setIntervalQueryRange
(
pRuntimeEnv
,
pBlock
->
info
.
window
.
skey
);
setIntervalQueryRange
(
pRuntimeEnv
,
&
pBlock
->
info
.
window
,
pBlock
->
info
.
tid
);
hashIntervalAgg
(
pOperator
,
&
pTableQueryInfo
->
resInfo
,
pBlock
,
pTableQueryInfo
->
groupIndex
);
}
...
...
@@ -6084,7 +6092,8 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) {
setTagValue
(
pOperator
,
pTableQueryInfo
->
pTable
,
pIntervalInfo
->
pCtx
,
pOperator
->
numOfOutput
);
setInputDataBlock
(
pOperator
,
pIntervalInfo
->
pCtx
,
pBlock
,
pQueryAttr
->
order
.
order
);
setIntervalQueryRange
(
pRuntimeEnv
,
pBlock
->
info
.
window
.
skey
);
setIntervalQueryRange
(
pRuntimeEnv
,
&
pBlock
->
info
.
window
,
pBlock
->
info
.
tid
);
hashAllIntervalAgg
(
pOperator
,
&
pTableQueryInfo
->
resInfo
,
pBlock
,
pTableQueryInfo
->
groupIndex
);
}
...
...
@@ -6102,9 +6111,6 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) {
return
pIntervalInfo
->
pRes
;
}
static
void
doStateWindowAggImpl
(
SOperatorInfo
*
pOperator
,
SStateWindowOperatorInfo
*
pInfo
,
SSDataBlock
*
pSDataBlock
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
pOperator
->
pRuntimeEnv
;
STableQueryInfo
*
item
=
pRuntimeEnv
->
current
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
e6af460b
...
...
@@ -859,13 +859,25 @@ static TSKEY extractFirstTraverseKey(STableCheckInfo* pCheckInfo, int32_t order,
pCheckInfo
->
chosen
=
CHECKINFO_CHOSEN_BOTH
;
}
return
r1
;
}
else
if
(
r1
<
r2
&&
ASCENDING_TRAVERSE
(
order
))
{
pCheckInfo
->
chosen
=
CHECKINFO_CHOSEN_MEM
;
return
r1
;
}
else
{
pCheckInfo
->
chosen
=
CHECKINFO_CHOSEN_IMEM
;
return
r2
;
}
else
{
if
(
ASCENDING_TRAVERSE
(
order
))
{
if
(
r1
<
r2
)
{
pCheckInfo
->
chosen
=
CHECKINFO_CHOSEN_MEM
;
return
r1
;
}
else
{
pCheckInfo
->
chosen
=
CHECKINFO_CHOSEN_IMEM
;
return
r2
;
}
}
else
{
if
(
r1
<
r2
)
{
pCheckInfo
->
chosen
=
CHECKINFO_CHOSEN_IMEM
;
return
r2
;
}
else
{
pCheckInfo
->
chosen
=
CHECKINFO_CHOSEN_MEM
;
return
r1
;
}
}
}
}
...
...
@@ -1329,11 +1341,11 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
assert
(
cur
->
blockCompleted
);
if
(
cur
->
rows
==
binfo
.
rows
)
{
tsdbDebug
(
"%p whole file block qualified, brange:%"
PRId64
"-%"
PRId64
", rows:%d, lastKey:%"
PRId64
", %"
PRIx64
,
pQueryHandle
,
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
cur
->
rows
,
cur
->
lastKey
,
pQueryHandle
->
qId
);
tsdbDebug
(
"%p whole file block qualified, brange:%"
PRId64
"-%"
PRId64
", rows:%d, lastKey:%"
PRId64
",
tid:%d,
%"
PRIx64
,
pQueryHandle
,
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
cur
->
rows
,
cur
->
lastKey
,
binfo
.
tid
,
pQueryHandle
->
qId
);
}
else
{
tsdbDebug
(
"%p create data block from remain file block, brange:%"
PRId64
"-%"
PRId64
", rows:%d, total:%d, lastKey:%"
PRId64
", %"
PRIx64
,
pQueryHandle
,
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
cur
->
rows
,
binfo
.
rows
,
cur
->
lastKey
,
pQueryHandle
->
qId
);
tsdbDebug
(
"%p create data block from remain file block, brange:%"
PRId64
"-%"
PRId64
", rows:%d, total:%d, lastKey:%"
PRId64
",
tid:%d,
%"
PRIx64
,
pQueryHandle
,
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
cur
->
rows
,
binfo
.
rows
,
cur
->
lastKey
,
binfo
.
tid
,
pQueryHandle
->
qId
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录