Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4b3d9891
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4b3d9891
编写于
8月 21, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
other: naming optimization
上级
77bfd400
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
49 deletion
+18
-49
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+18
-49
未找到文件。
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
4b3d9891
...
...
@@ -42,9 +42,9 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t msgSiz
static
SRSmaInfo
*
tdAcquireRSmaInfoBySuid
(
SSma
*
pSma
,
int64_t
suid
);
static
void
tdReleaseRSmaInfo
(
SSma
*
pSma
,
SRSmaInfo
*
pInfo
);
static
void
tdFreeRSmaSubmitItems
(
SArray
*
pItems
);
static
int32_t
tdRSma
ConsumeAndFetch
(
SSma
*
pSma
,
SRSmaInfo
*
pInfo
,
SArray
*
pSubmitArr
);
static
int32_t
tdRSma
Fetch
AndSubmitResult
(
SSma
*
pSma
,
qTaskInfo_t
taskInfo
,
SRSmaInfoItem
*
pItem
,
STSchema
*
pTSchema
,
int64_t
suid
);
static
int32_t
tdRSma
FetchAllResult
(
SSma
*
pSma
,
SRSmaInfo
*
pInfo
,
SArray
*
pSubmitArr
);
static
int32_t
tdRSma
Exec
AndSubmitResult
(
SSma
*
pSma
,
qTaskInfo_t
taskInfo
,
SRSmaInfoItem
*
pItem
,
STSchema
*
pTSchema
,
int64_t
suid
);
static
void
tdRSmaFetchTrigger
(
void
*
param
,
void
*
tmrId
);
static
int32_t
tdRSmaQTaskInfoIterInit
(
SRSmaQTaskInfoIter
*
pIter
,
STFile
*
pTFile
);
static
int32_t
tdRSmaQTaskInfoIterNextBlock
(
SRSmaQTaskInfoIter
*
pIter
,
bool
*
isFinish
);
...
...
@@ -636,8 +636,8 @@ _end:
return
code
;
}
static
int32_t
tdRSma
Fetch
AndSubmitResult
(
SSma
*
pSma
,
qTaskInfo_t
taskInfo
,
SRSmaInfoItem
*
pItem
,
STSchema
*
pTSchema
,
int64_t
suid
)
{
static
int32_t
tdRSma
Exec
AndSubmitResult
(
SSma
*
pSma
,
qTaskInfo_t
taskInfo
,
SRSmaInfoItem
*
pItem
,
STSchema
*
pTSchema
,
int64_t
suid
)
{
SArray
*
pResList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
if
(
pResList
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -815,7 +815,7 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t msgSize,
}
SRSmaInfoItem
*
pItem
=
RSMA_INFO_ITEM
(
pInfo
,
idx
);
tdRSma
Fetch
AndSubmitResult
(
pSma
,
qTaskInfo
,
pItem
,
pInfo
->
pTSchema
,
pInfo
->
suid
);
tdRSma
Exec
AndSubmitResult
(
pSma
,
qTaskInfo
,
pItem
,
pInfo
->
pTSchema
,
pInfo
->
suid
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1596,46 +1596,15 @@ static void tdFreeRSmaSubmitItems(SArray *pItems) {
}
}
static
int32_t
tdRSmaConsumeAndFetch
(
SSma
*
pSma
,
SRSmaInfo
*
pInfo
,
SArray
*
pSubmitArr
)
{
// step 1: consume submit req
#if 0
int64_t qMemSize = 0;
if ((qMemSize = taosQueueMemorySize(pInfo->queue) > 0)) {
taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
SRSmaStat *pRSmaStat = SMA_RSMA_STAT(pSma);
atomic_fetch_sub_64(&pRSmaStat->nBufItems, taosQallItemSize(pInfo->qall));
taosArrayClear(pSubmitArr);
while (1) {
void *msg = NULL;
taosGetQitem(pInfo->qall, (void **)&msg);
if (msg) {
if (taosArrayPush(pSubmitArr, &msg) < 0) {
tdFreeRSmaSubmitItems(pSubmitArr);
goto _err;
}
} else {
break;
}
}
int32_t size = taosArrayGetSize(pSubmitArr);
if (size > 0) {
for (int32_t i = 1; i <= TSDB_RETENTION_L2; ++i) {
if (tdExecuteRSmaImpl(pSma, pSubmitArr->pData, size, STREAM_INPUT__MERGED_SUBMIT, pInfo, RSMA_EXEC_TIMEOUT, i) <
0) {
tdFreeRSmaSubmitItems(pSubmitArr);
goto _err;
}
}
tdFreeRSmaSubmitItems(pSubmitArr);
}
}
#endif
// step 2: fetch rsma result(consider the efficiency and functionality)
/**
* @brief fetch rsma result(consider the efficiency and functionality)
*
* @param pSma
* @param pInfo
* @param pSubmitArr
* @return int32_t
*/
static
int32_t
tdRSmaFetchAllResult
(
SSma
*
pSma
,
SRSmaInfo
*
pInfo
,
SArray
*
pSubmitArr
)
{
SSDataBlock
dataBlock
=
{.
info
.
type
=
STREAM_GET_ALL
};
for
(
int8_t
i
=
1
;
i
<=
TSDB_RETENTION_L2
;
++
i
)
{
SRSmaInfoItem
*
pItem
=
RSMA_INFO_ITEM
(
pInfo
,
i
-
1
);
...
...
@@ -1665,7 +1634,7 @@ static int32_t tdRSmaConsumeAndFetch(SSma *pSma, SRSmaInfo *pInfo, SArray *pSubm
if
((
terrno
=
qSetMultiStreamInput
(
taskInfo
,
&
dataBlock
,
1
,
STREAM_INPUT__DATA_BLOCK
))
<
0
)
{
goto
_err
;
}
if
(
tdRSma
Fetch
AndSubmitResult
(
pSma
,
taskInfo
,
pItem
,
pInfo
->
pTSchema
,
pInfo
->
suid
)
<
0
)
{
if
(
tdRSma
Exec
AndSubmitResult
(
pSma
,
taskInfo
,
pItem
,
pInfo
->
pTSchema
,
pInfo
->
suid
)
<
0
)
{
tdCleanupStreamInputDataBlock
(
taskInfo
);
goto
_err
;
}
...
...
@@ -1772,7 +1741,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
tdRSmaBatchExec
(
pSma
,
pInfo
,
pInfo
->
qall
,
pSubmitArr
,
type
);
}
tdRSma
ConsumeAndFetch
(
pSma
,
pInfo
,
pSubmitArr
);
tdRSma
FetchAllResult
(
pSma
,
pInfo
,
pSubmitArr
);
if
(
qallItemSize
>
0
)
{
// subtract the item size after the task finished, commit should wait for all items be consumed
atomic_fetch_sub_64
(
&
pRSmaStat
->
nBufItems
,
qallItemSize
);
...
...
@@ -1803,7 +1772,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
tdRSmaBatchExec(pSma, pInfo, pInfo->qall, pSubmitArr, type);
}
// tdRSma
ConsumeAndFetch
(pSma, pInfo, pSubmitArr);
// tdRSma
FetchAllResult
(pSma, pInfo, pSubmitArr);
ASSERT(1 == atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录