Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7c3f43d6
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看板
提交
7c3f43d6
编写于
6月 30, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: tsma logic optimization
上级
e577e78e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
23 deletion
+40
-23
source/dnode/vnode/src/sma/smaTimeRange.c
source/dnode/vnode/src/sma/smaTimeRange.c
+40
-23
未找到文件。
source/dnode/vnode/src/sma/smaTimeRange.c
浏览文件 @
7c3f43d6
...
...
@@ -113,7 +113,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
if
(
!
pDataBlocks
)
{
terrno
=
TSDB_CODE_TSMA_INVALID_PTR
;
smaWarn
(
"vgId:%d, insert tsma data failed since pDataBlocks is NULL"
,
SMA_VID
(
pSma
));
return
terrno
;
return
TSDB_CODE_FAILED
;
}
if
(
taosArrayGetSize
(
pDataBlocks
)
<=
0
)
{
...
...
@@ -127,9 +127,9 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
return
TSDB_CODE_FAILED
;
}
SSmaEnv
*
pEnv
=
SMA_TSMA_ENV
(
pSma
);
SSmaStat
*
pStat
=
NULL
;
STSmaStat
*
pItem
=
NULL
;
SSmaEnv
*
pEnv
=
SMA_TSMA_ENV
(
pSma
);
SSmaStat
*
pStat
=
NULL
;
STSmaStat
*
pTsmaStat
=
NULL
;
if
(
!
pEnv
||
!
(
pStat
=
SMA_ENV_STAT
(
pEnv
)))
{
terrno
=
TSDB_CODE_TSMA_INVALID_STAT
;
...
...
@@ -137,32 +137,43 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
}
tdRefSmaStat
(
pSma
,
pStat
);
pItem
=
&
pStat
->
tsmaStat
;
ASSERT
(
pItem
);
pTsmaStat
=
SMA_TSMA_STAT
(
pStat
);
if
(
!
p
Item
->
pTSma
)
{
if
(
!
p
TsmaStat
->
pTSma
)
{
STSma
*
pTSma
=
metaGetSmaInfoByIndex
(
SMA_META
(
pSma
),
indexUid
);
if
(
!
pTSma
)
{
terrno
=
TSDB_CODE_TSMA_NO_INDEX_IN_META
;
smaWarn
(
"vgId:%d, tsma insert for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
));
return
TSDB_CODE_FAILED
;
smaError
(
"vgId:%d, failed to get STSma while tsma insert for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
));
goto
_err
;
}
pTsmaStat
->
pTSma
=
pTSma
;
pTsmaStat
->
pTSchema
=
metaGetTbTSchema
(
SMA_META
(
pSma
),
pTSma
->
dstTbUid
,
-
1
);
if
(
!
pTsmaStat
->
pTSchema
)
{
smaError
(
"vgId:%d, failed to get STSchema while tsma insert for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
));
goto
_err
;
}
pItem
->
pTSma
=
pTSma
;
pItem
->
pTSchema
=
metaGetTbTSchema
(
SMA_META
(
pSma
),
pTSma
->
dstTbUid
,
-
1
);
ASSERT
(
pItem
->
pTSchema
);
// TODO
}
ASSERT
(
pItem
->
pTSma
->
indexUid
==
indexUid
);
SSubmitReq
*
pSubmitReq
=
NULL
;
if
(
pTsmaStat
->
pTSma
->
indexUid
!=
indexUid
)
{
terrno
=
TSDB_CODE_VND_APP_ERROR
;
smaError
(
"vgId:%d, tsma insert for smaIndex %"
PRIi64
"(!=%"
PRIi64
") failed since %s"
,
SMA_VID
(
pSma
),
indexUid
,
pTsmaStat
->
pTSma
->
indexUid
,
tstrerror
(
terrno
));
goto
_err
;
}
pSubmitReq
=
tdBlockToSubmit
((
const
SArray
*
)
msg
,
pItem
->
pTSchema
,
true
,
pItem
->
pTSma
->
dstTbUid
,
pItem
->
pTSma
->
dstTbName
,
pItem
->
pTSma
->
dstVgId
);
SSubmitReq
*
pSubmitReq
=
tdBlockToSubmit
((
const
SArray
*
)
msg
,
pTsmaStat
->
pTSchema
,
true
,
pTsmaStat
->
pTSma
->
dstTbUid
,
pTsmaStat
->
pTSma
->
dstTbName
,
pTsmaStat
->
pTSma
->
dstVgId
);
ASSERT
(
pSubmitReq
);
// TODO
if
(
!
pSubmitReq
)
{
smaError
(
"vgId:%d, failed to gen submit blk while tsma insert for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
));
goto
_err
;
}
ASSERT
(
!
strncasecmp
(
"td.tsma.rst.tb"
,
pItem
->
pTSma
->
dstTbName
,
14
));
#if 0
ASSERT(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14));
#endif
SRpcMsg
submitReqMsg
=
{
.
msgType
=
TDMT_VND_SUBMIT
,
...
...
@@ -170,9 +181,15 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
.
contLen
=
ntohl
(
pSubmitReq
->
length
),
};
ASSERT
(
tmsgPutToQueue
(
&
pSma
->
pVnode
->
msgCb
,
WRITE_QUEUE
,
&
submitReqMsg
)
==
0
);
if
(
tmsgPutToQueue
(
&
pSma
->
pVnode
->
msgCb
,
WRITE_QUEUE
,
&
submitReqMsg
)
<
0
)
{
smaError
(
"vgId:%d, failed to put SubmitReq msg while tsma insert for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
));
goto
_err
;
}
tdUnRefSmaStat
(
pSma
,
pStat
);
return
TSDB_CODE_SUCCESS
;
_err:
tdUnRefSmaStat
(
pSma
,
pStat
);
return
TSDB_CODE_FAILED
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录