Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bc487492
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看板
未验证
提交
bc487492
编写于
6月 18, 2023
作者:
D
dapan1121
提交者:
GitHub
6月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21764 from taosdata/enh/TD-24346-3.0e
enh: support delete tsma interval
上级
61d1f79a
b40069c0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
58 addition
and
7 deletion
+58
-7
source/dnode/vnode/src/sma/smaTimeRange.c
source/dnode/vnode/src/sma/smaTimeRange.c
+42
-4
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+0
-2
tests/script/tsim/sma/tsmaCreateInsertQuery.sim
tests/script/tsim/sma/tsmaCreateInsertQuery.sim
+16
-1
未找到文件。
source/dnode/vnode/src/sma/smaTimeRange.c
浏览文件 @
bc487492
...
...
@@ -29,7 +29,7 @@ int32_t tdProcessTSmaInsert(SSma *pSma, int64_t indexUid, const char *msg) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdProcessTSmaInsertImpl
(
pSma
,
indexUid
,
msg
))
<
0
)
{
sma
Warn
(
"vgId:%d, insert tsma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
sma
Error
(
"vgId:%d, insert tsma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
return
code
;
...
...
@@ -346,6 +346,43 @@ _end:
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
tsmaProcessDelReq
(
SSma
*
pSma
,
int64_t
indexUid
,
SBatchDeleteReq
*
pDelReq
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
if
(
taosArrayGetSize
(
pDelReq
->
deleteReqs
)
>
0
)
{
int32_t
len
=
0
;
tEncodeSize
(
tEncodeSBatchDeleteReq
,
pDelReq
,
len
,
code
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
void
*
pBuf
=
rpcMallocCont
(
len
+
sizeof
(
SMsgHead
));
if
(
!
pBuf
)
{
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
SEncoder
encoder
;
tEncoderInit
(
&
encoder
,
POINTER_SHIFT
(
pBuf
,
sizeof
(
SMsgHead
)),
len
);
tEncodeSBatchDeleteReq
(
&
encoder
,
pDelReq
);
tEncoderClear
(
&
encoder
);
((
SMsgHead
*
)
pBuf
)
->
vgId
=
TD_VID
(
pSma
->
pVnode
);
SRpcMsg
delMsg
=
{.
msgType
=
TDMT_VND_BATCH_DEL
,
.
pCont
=
pBuf
,
.
contLen
=
len
+
sizeof
(
SMsgHead
)};
code
=
tmsgPutToQueue
(
&
pSma
->
pVnode
->
msgCb
,
WRITE_QUEUE
,
&
delMsg
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
_exit:
taosArrayDestroy
(
pDelReq
->
deleteReqs
);
if
(
code
)
{
smaError
(
"vgId:%d, failed at line %d to process delete req for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
lino
,
indexUid
,
tstrerror
(
code
));
}
return
code
;
}
/**
* @brief Insert/Update Time-range-wise SMA data.
*
...
...
@@ -355,7 +392,6 @@ _end:
*/
static
int32_t
tdProcessTSmaInsertImpl
(
SSma
*
pSma
,
int64_t
indexUid
,
const
char
*
msg
)
{
const
SArray
*
pDataBlocks
=
(
const
SArray
*
)
msg
;
// TODO: destroy SSDataBlocks(msg)
if
(
!
pDataBlocks
)
{
terrno
=
TSDB_CODE_TSMA_INVALID_PTR
;
smaWarn
(
"vgId:%d, insert tsma data failed since pDataBlocks is NULL"
,
SMA_VID
(
pSma
));
...
...
@@ -419,8 +455,10 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
goto
_err
;
}
// TODO deleteReq
taosArrayDestroy
(
deleteReq
.
deleteReqs
);
if
((
terrno
=
tsmaProcessDelReq
(
pSma
,
indexUid
,
&
deleteReq
))
!=
0
)
{
goto
_err
;
}
#if 0
if (!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)) {
terrno = TSDB_CODE_APP_ERROR;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
bc487492
...
...
@@ -593,9 +593,7 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
}
}
// TODO: remove the function
void
smaHandleRes
(
void
*
pVnode
,
int64_t
smaId
,
const
SArray
*
data
)
{
// TODO
// blockDebugShowDataBlocks(data, __func__);
tdProcessTSmaInsert
(((
SVnode
*
)
pVnode
)
->
pSma
,
smaId
,
(
const
char
*
)
data
);
}
...
...
tests/script/tsim/sma/tsmaCreateInsertQuery.sim
浏览文件 @
bc487492
...
...
@@ -414,6 +414,21 @@ if $data05 != 30.000000000 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sql delete from stb;
print =============== query after delete in common vgroups
sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m) order by _wstart;
if $rows != 0 then
print rows $rows != 0
return -1
endi
sleep 2000
print =============== query after delete in designated vgroups
sql select _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m) order by _wstart;
if $rows != 0 then
print rows $rows != 0
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录