Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
67dde162
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
67dde162
编写于
3月 25, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-14285] fix the taosd crash when both interval and sliding exist.
上级
b5d01190
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
20 deletion
+7
-20
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+1
-1
source/common/src/ttime.c
source/common/src/ttime.c
+1
-2
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+5
-17
未找到文件。
source/client/test/clientTests.cpp
浏览文件 @
67dde162
...
...
@@ -661,7 +661,7 @@ TEST(testCase, agg_query_tables) {
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"select
k from tm0
"
);
pRes
=
taos_query
(
pConn
,
"select
count(*) from tu
"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to select from table, reason:%s
\n
"
,
taos_errstr
(
pRes
));
taos_free_result
(
pRes
);
...
...
source/common/src/ttime.c
浏览文件 @
67dde162
...
...
@@ -562,8 +562,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
// not enough time range
if
(
start
<
0
||
INT64_MAX
-
start
>
pInterval
->
interval
-
1
)
{
end
=
start
+
pInterval
->
interval
-
1
;
end
=
taosTimeAdd
(
start
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
while
(
end
<
t
&&
((
start
+
pInterval
->
sliding
)
<=
INT64_MAX
))
{
// move forward to the correct time window
start
+=
pInterval
->
sliding
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
67dde162
...
...
@@ -674,12 +674,7 @@ static void getInitialStartTimeWindow(SInterval* pInterval, int32_t precision, T
int64_t
key
=
w
->
skey
;
while
(
key
<
ts
)
{
// moving towards end
if
(
pInterval
->
intervalUnit
==
'n'
||
pInterval
->
intervalUnit
==
'y'
)
{
key
=
taosTimeAdd
(
key
,
pInterval
->
sliding
,
pInterval
->
slidingUnit
,
precision
);
}
else
{
key
+=
pInterval
->
sliding
;
}
key
=
taosTimeAdd
(
key
,
pInterval
->
sliding
,
pInterval
->
slidingUnit
,
precision
);
if
(
key
>=
ts
)
{
break
;
}
...
...
@@ -695,12 +690,7 @@ static STimeWindow getActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t
if
(
pResultRowInfo
->
curPos
==
-
1
)
{
// the first window, from the previous stored value
getInitialStartTimeWindow
(
pInterval
,
precision
,
ts
,
&
w
,
win
->
ekey
,
true
);
if
(
pInterval
->
intervalUnit
==
'n'
||
pInterval
->
intervalUnit
==
'y'
)
{
w
.
ekey
=
taosTimeAdd
(
w
.
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
}
else
{
w
.
ekey
=
w
.
skey
+
pInterval
->
interval
-
1
;
}
w
.
ekey
=
taosTimeAdd
(
w
.
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
}
else
{
w
=
getResultRow
(
pResultRowInfo
,
pResultRowInfo
->
curPos
)
->
win
;
}
...
...
@@ -722,7 +712,7 @@ static STimeWindow getActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t
}
w
.
skey
=
st
;
w
.
ekey
=
w
.
skey
+
pInterval
->
interval
-
1
;
w
.
ekey
=
taosTimeAdd
(
w
.
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
}
}
return
w
;
...
...
@@ -2407,7 +2397,7 @@ static bool isCachedLastQuery(STaskAttr *pQueryAttr) {
/////////////////////////////////////////////////////////////////////////////////////////////
//todo refactor : return window
void
getAlignQueryTimeWindow
(
SInterval
*
pInterval
,
int32_t
precision
,
int64_t
key
,
int64_t
keyFirst
,
int64_t
keyLast
,
STimeWindow
*
win
)
{
assert
(
key
>=
keyFirst
&&
key
<=
keyLast
&&
pInterval
->
sliding
<=
pInterval
->
interval
);
ASSERT
(
key
>=
keyFirst
&&
key
<=
keyLast
);
win
->
skey
=
taosTimeTruncate
(
key
,
pInterval
,
precision
);
/*
...
...
@@ -2417,10 +2407,8 @@ void getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t ke
if
(
keyFirst
>
(
INT64_MAX
-
pInterval
->
interval
))
{
assert
(
keyLast
-
keyFirst
<
pInterval
->
interval
);
win
->
ekey
=
INT64_MAX
;
}
else
if
(
pInterval
->
intervalUnit
==
'n'
||
pInterval
->
intervalUnit
==
'y'
)
{
win
->
ekey
=
taosTimeAdd
(
win
->
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
}
else
{
win
->
ekey
=
win
->
skey
+
pInterval
->
interval
-
1
;
win
->
ekey
=
taosTimeAdd
(
win
->
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录