Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fbf9cb70
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看板
提交
fbf9cb70
编写于
6月 14, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: tsma code refactor
上级
7a6f94a8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
18 deletion
+24
-18
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+15
-17
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-1
tests/script/tsim/sma/tsmaCreateInsertData.sim
tests/script/tsim/sma/tsmaCreateInsertData.sim
+8
-0
未找到文件。
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
fbf9cb70
...
@@ -44,6 +44,7 @@ static int32_t mndProcessGetSmaReq(SRpcMsg *pReq);
...
@@ -44,6 +44,7 @@ static int32_t mndProcessGetSmaReq(SRpcMsg *pReq);
static
int32_t
mndProcessGetTbSmaReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessGetTbSmaReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndRetrieveSma
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveSma
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndDestroySmaObj
(
SSmaObj
*
pSmaObj
);
int32_t
mndInitSma
(
SMnode
*
pMnode
)
{
int32_t
mndInitSma
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{
SSdbTable
table
=
{
...
@@ -390,7 +391,9 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
...
@@ -390,7 +391,9 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
taosRLockLatch
(
&
pStb
->
lock
);
taosRLockLatch
(
&
pStb
->
lock
);
memcpy
(
&
stbObj
,
pStb
,
sizeof
(
SStbObj
));
memcpy
(
&
stbObj
,
pStb
,
sizeof
(
SStbObj
));
taosRUnLockLatch
(
&
pStb
->
lock
);
taosRUnLockLatch
(
&
pStb
->
lock
);
stbObj
.
numOfColumns
=
0
;
stbObj
.
pColumns
=
NULL
;
stbObj
.
pColumns
=
NULL
;
stbObj
.
numOfTags
=
0
;
stbObj
.
pTags
=
NULL
;
stbObj
.
pTags
=
NULL
;
stbObj
.
updateTime
=
taosGetTimestampMs
();
stbObj
.
updateTime
=
taosGetTimestampMs
();
stbObj
.
lock
=
0
;
stbObj
.
lock
=
0
;
...
@@ -501,6 +504,13 @@ static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans,
...
@@ -501,6 +504,13 @@ static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans,
return
0
;
return
0
;
}
}
static
void
mndDestroySmaObj
(
SSmaObj
*
pSmaObj
)
{
if
(
pSmaObj
)
{
taosMemoryFreeClear
(
pSmaObj
->
schemaRow
.
pSchema
);
taosMemoryFreeClear
(
pSmaObj
->
schemaTag
.
pSchema
);
}
}
static
int32_t
mndCreateSma
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SMCreateSmaReq
*
pCreate
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
static
int32_t
mndCreateSma
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SMCreateSmaReq
*
pCreate
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
SSmaObj
smaObj
=
{
0
};
SSmaObj
smaObj
=
{
0
};
memcpy
(
smaObj
.
name
,
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
memcpy
(
smaObj
.
name
,
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
...
@@ -524,29 +534,17 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -524,29 +534,17 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
smaObj
.
tagsFilterLen
=
pCreate
->
tagsFilterLen
;
smaObj
.
tagsFilterLen
=
pCreate
->
tagsFilterLen
;
smaObj
.
sqlLen
=
pCreate
->
sqlLen
;
smaObj
.
sqlLen
=
pCreate
->
sqlLen
;
smaObj
.
astLen
=
pCreate
->
astLen
;
smaObj
.
astLen
=
pCreate
->
astLen
;
if
(
smaObj
.
exprLen
>
0
)
{
if
(
smaObj
.
exprLen
>
0
)
{
smaObj
.
expr
=
taosMemoryMalloc
(
smaObj
.
exprLen
);
smaObj
.
expr
=
pCreate
->
expr
;
if
(
smaObj
.
expr
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
expr
,
pCreate
->
expr
,
smaObj
.
exprLen
);
}
}
if
(
smaObj
.
tagsFilterLen
>
0
)
{
if
(
smaObj
.
tagsFilterLen
>
0
)
{
smaObj
.
tagsFilter
=
taosMemoryMalloc
(
smaObj
.
tagsFilterLen
);
smaObj
.
tagsFilter
=
pCreate
->
tagsFilter
;
if
(
smaObj
.
tagsFilter
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
tagsFilter
,
pCreate
->
tagsFilter
,
smaObj
.
tagsFilterLen
);
}
}
if
(
smaObj
.
sqlLen
>
0
)
{
if
(
smaObj
.
sqlLen
>
0
)
{
smaObj
.
sql
=
taosMemoryMalloc
(
smaObj
.
sqlLen
);
smaObj
.
sql
=
pCreate
->
sql
;
if
(
smaObj
.
sql
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
sql
,
pCreate
->
sql
,
smaObj
.
sqlLen
);
}
}
if
(
smaObj
.
astLen
>
0
)
{
if
(
smaObj
.
astLen
>
0
)
{
smaObj
.
ast
=
taosMemoryMalloc
(
smaObj
.
astLen
);
smaObj
.
ast
=
pCreate
->
ast
;
if
(
smaObj
.
ast
==
NULL
)
goto
_OVER
;
memcpy
(
smaObj
.
ast
,
pCreate
->
ast
,
smaObj
.
astLen
);
}
}
SStreamObj
streamObj
=
{
0
};
SStreamObj
streamObj
=
{
0
};
...
@@ -589,6 +587,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -589,6 +587,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
code
=
0
;
code
=
0
;
_OVER:
_OVER:
mndDestroySmaObj
(
&
smaObj
);
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
code
;
return
code
;
}
}
...
@@ -1012,7 +1011,6 @@ int32_t mndGetTableSma(SMnode *pMnode, char *tbFName, STableIndexRsp *rsp, bool
...
@@ -1012,7 +1011,6 @@ int32_t mndGetTableSma(SMnode *pMnode, char *tbFName, STableIndexRsp *rsp, bool
rsp
->
suid
=
pStb
->
uid
;
rsp
->
suid
=
pStb
->
uid
;
rsp
->
version
=
pStb
->
smaVer
;
rsp
->
version
=
pStb
->
smaVer
;
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
while
(
1
)
{
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_SMA
,
pIter
,
(
void
**
)
&
pSma
);
pIter
=
sdbFetch
(
pSdb
,
SDB_SMA
,
pIter
,
(
void
**
)
&
pSma
);
...
...
tests/script/jenkins/basic.txt
浏览文件 @
fbf9cb70
...
@@ -132,7 +132,7 @@
...
@@ -132,7 +132,7 @@
#./test.sh -f tsim/mnode/basic1.sim -m
#./test.sh -f tsim/mnode/basic1.sim -m
# --- sma
# --- sma
#
./test.sh -f tsim/sma/tsmaCreateInsertData.sim
./test.sh -f tsim/sma/tsmaCreateInsertData.sim
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
# --- valgrind
# --- valgrind
...
...
tests/script/tsim/sma/tsmaCreateInsertData.sim
浏览文件 @
fbf9cb70
...
@@ -37,6 +37,14 @@ print =============== trigger stream to execute sma aggr task and insert sma dat
...
@@ -37,6 +37,14 @@ print =============== trigger stream to execute sma aggr task and insert sma dat
sql insert into ct1 values(now+5s, 20, 20.0, 30.0)
sql insert into ct1 values(now+5s, 20, 20.0, 30.0)
#===================================================================
#===================================================================
print =============== show streams ================================
sql show streams;
print $data00 $data01 $data02
if $data00 != d1 then
return -1
endi
print =============== select * from ct1 from memory
print =============== select * from ct1 from memory
sql select * from ct1;
sql select * from ct1;
print $data00 $data01
print $data00 $data01
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录