Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c59478ec
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看板
提交
c59478ec
编写于
7月 11, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: tsma/rsma code optimization
上级
126b7282
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
12 deletion
+29
-12
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+12
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+6
-6
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+9
-2
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+2
-2
未找到文件。
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
c59478ec
...
...
@@ -527,10 +527,20 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
streamObj
.
version
=
1
;
streamObj
.
sql
=
pCreate
->
sql
;
streamObj
.
smaId
=
smaObj
.
uid
;
streamObj
.
watermark
=
0
;
streamObj
.
trigger
=
STREAM_TRIGGER_AT_ONCE
;
streamObj
.
watermark
=
pCreate
->
watermark
;
streamObj
.
trigger
=
STREAM_TRIGGER_WINDOW_CLOSE
;
streamObj
.
triggerParam
=
pCreate
->
maxDelay
;
streamObj
.
ast
=
strdup
(
smaObj
.
ast
);
// check the maxDelay
if
(
streamObj
.
triggerParam
<
TSDB_MIN_ROLLUP_MAX_DELAY
)
{
int64_t
msInterval
=
convertTimeFromPrecisionToUnit
(
pCreate
->
interval
,
pDb
->
cfg
.
precision
,
TIME_UNIT_MILLISECOND
);
streamObj
.
triggerParam
=
msInterval
>
TSDB_MIN_ROLLUP_MAX_DELAY
?
msInterval
:
TSDB_MIN_ROLLUP_MAX_DELAY
;
}
if
(
streamObj
.
triggerParam
>
TSDB_MAX_ROLLUP_MAX_DELAY
)
{
streamObj
.
triggerParam
=
TSDB_MAX_ROLLUP_MAX_DELAY
;
}
if
(
mndAllocSmaVgroup
(
pMnode
,
pDb
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
{
mError
(
"sma:%s, failed to create since %s"
,
smaObj
.
name
,
terrstr
());
return
-
1
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
c59478ec
...
...
@@ -1134,12 +1134,6 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
pInfo
->
pRes
->
info
.
type
=
STREAM_NORMAL
;
pInfo
->
pRes
->
info
.
capacity
=
pBlock
->
info
.
rows
;
// for generating rollup SMA result, each time is an independent time serie.
// TODO temporarily used, when the statement of "partition by tbname" is ready, remove this
if
(
pInfo
->
assignBlockUid
)
{
pInfo
->
pRes
->
info
.
groupId
=
pBlock
->
info
.
uid
;
}
uint64_t
*
groupIdPre
=
taosHashGet
(
pOperator
->
pTaskInfo
->
tableqinfoList
.
map
,
&
pBlock
->
info
.
uid
,
sizeof
(
int64_t
));
if
(
groupIdPre
)
{
pInfo
->
pRes
->
info
.
groupId
=
*
groupIdPre
;
...
...
@@ -1147,6 +1141,12 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
pInfo
->
pRes
->
info
.
groupId
=
0
;
}
// for generating rollup SMA result, each time is an independent time serie.
// TODO temporarily used, when the statement of "partition by tbname" is ready, remove this
if
(
pInfo
->
assignBlockUid
)
{
pInfo
->
pRes
->
info
.
groupId
=
pBlock
->
info
.
uid
;
}
// todo extract method
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
pColMatchInfo
);
++
i
)
{
SColMatchInfo
*
pColMatchInfo
=
taosArrayGet
(
pInfo
->
pColMatchInfo
,
i
);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
c59478ec
...
...
@@ -4017,8 +4017,15 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
(
NULL
!=
pStmt
->
pOptions
->
pSliding
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)
->
unit
:
pReq
->
intervalUnit
);
if
(
NULL
!=
pStmt
->
pOptions
->
pStreamOptions
)
{
SStreamOptions
*
pStreamOpt
=
(
SStreamOptions
*
)
pStmt
->
pOptions
->
pStreamOptions
;
pReq
->
maxDelay
=
(
NULL
!=
pStreamOpt
->
pDelay
?
((
SValueNode
*
)
pStreamOpt
->
pDelay
)
->
datum
.
i
:
0
);
pReq
->
watermark
=
(
NULL
!=
pStreamOpt
->
pWatermark
?
((
SValueNode
*
)
pStreamOpt
->
pWatermark
)
->
datum
.
i
:
0
);
pReq
->
maxDelay
=
(
NULL
!=
pStreamOpt
->
pDelay
?
((
SValueNode
*
)
pStreamOpt
->
pDelay
)
->
datum
.
i
:
-
1
);
pReq
->
watermark
=
(
NULL
!=
pStreamOpt
->
pWatermark
?
((
SValueNode
*
)
pStreamOpt
->
pWatermark
)
->
datum
.
i
:
TSDB_DEFAULT_ROLLUP_WATERMARK
);
if
(
pReq
->
watermark
<
TSDB_MIN_ROLLUP_WATERMARK
)
{
pReq
->
watermark
=
TSDB_MIN_ROLLUP_WATERMARK
;
}
if
(
pReq
->
watermark
>
TSDB_MAX_ROLLUP_WATERMARK
)
{
pReq
->
watermark
=
TSDB_MAX_ROLLUP_WATERMARK
;
}
}
int32_t
code
=
getSmaIndexDstVgId
(
pCxt
,
pStmt
->
tableName
,
&
pReq
->
dstVgId
);
...
...
tests/script/jenkins/basic.txt
浏览文件 @
c59478ec
...
...
@@ -164,8 +164,8 @@
# --- sma
./test.sh -f tsim/sma/drop_sma.sim
./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim
#
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
#
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
# --- valgrind
./test.sh -f tsim/valgrind/checkError1.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录