Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
de3596c9
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看板
未验证
提交
de3596c9
编写于
6月 28, 2022
作者:
C
Cary Xu
提交者:
GitHub
6月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14320 from taosdata/feature/TD-11274-3.0
refactor: rsma code optimization
上级
beaf8134
fc55d6fb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
16 deletion
+67
-16
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+65
-15
source/util/src/terror.c
source/util/src/terror.c
+1
-1
未找到文件。
include/util/taoserror.h
浏览文件 @
de3596c9
...
...
@@ -615,6 +615,7 @@ int32_t* taosGetErrno();
//rsma
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
#define TSDB_CODE_RSMA_QTASKINFO_CREATE TAOS_DEF_ERROR_CODE(0, 0x3152)
//index
#define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200)
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
de3596c9
...
...
@@ -40,6 +40,10 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF
static
int32_t
tdRSmaQTaskInfoRestore
(
SSma
*
pSma
,
SRSmaQTaskInfoIter
*
pIter
);
static
int32_t
tdRSmaQTaskInfoItemRestore
(
SSma
*
pSma
,
const
SRSmaQTaskInfoItem
*
infoItem
);
static
int32_t
tdRSmaRestoreQTaskInfoInit
(
SSma
*
pSma
);
static
int32_t
tdRSmaRestoreQTaskInfoReload
(
SSma
*
pSma
);
static
int32_t
tdRSmaRestoreTSDataReload
(
SSma
*
pSma
);
struct
SRSmaInfoItem
{
SRSmaInfo
*
pRsmaInfo
;
void
*
taskInfo
;
// qTaskInfo_t
...
...
@@ -246,6 +250,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaInfo
pItem
->
pRsmaInfo
=
pRSmaInfo
;
pItem
->
taskInfo
=
qCreateStreamExecTaskInfo
(
param
->
qmsg
[
idx
],
pReadHandle
);
if
(
!
pItem
->
taskInfo
)
{
terrno
=
TSDB_CODE_RSMA_QTASKINFO_CREATE
;
goto
_err
;
}
pItem
->
triggerStat
=
TASK_TRIGGER_STAT_INACTIVE
;
...
...
@@ -696,10 +701,9 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
tdProcessRSmaRestoreImpl
(
SSma
*
pSma
)
{
static
int32_t
tdRSmaRestoreQTaskInfoInit
(
SSma
*
pSma
)
{
SVnode
*
pVnode
=
pSma
->
pVnode
;
// step 1: iterate all stables to restore the rsma env
SArray
*
suidList
=
taosArrayInit
(
1
,
sizeof
(
tb_uid_t
));
if
(
tsdbGetStbIdList
(
SMA_META
(
pSma
),
0
,
suidList
)
<
0
)
{
taosArrayDestroy
(
suidList
);
...
...
@@ -741,42 +745,88 @@ int32_t tdProcessRSmaRestoreImpl(SSma *pSma) {
}
}
// step 2: retrieve qtaskinfo items from the persistence file(rsma/qtaskinfo) and restore
STFile
tFile
=
{
0
};
char
qTaskInfoFName
[
TSDB_FILENAME_LEN
];
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
suidList
);
return
TSDB_CODE_SUCCESS
;
_err:
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
suidList
);
return
TSDB_CODE_FAILED
;
}
static
int32_t
tdRSmaRestoreQTaskInfoReload
(
SSma
*
pSma
)
{
SVnode
*
pVnode
=
pSma
->
pVnode
;
STFile
tFile
=
{
0
};
char
qTaskInfoFName
[
TSDB_FILENAME_LEN
];
tdRSmaQTaskInfoGetFName
(
TD_VID
(
pVnode
),
TD_QTASK_CUR_FILE
,
qTaskInfoFName
);
if
(
tdInitTFile
(
&
tFile
,
pVnode
->
pTfs
,
qTaskInfoFName
)
<
0
)
{
goto
_err
;
}
if
(
!
taosCheckExistFile
(
TD_TFILE_FULL_NAME
(
&
tFile
)))
{
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
suidList
);
if
(
!
taosCheckExistFile
(
TD_TFILE_FULL_NAME
(
&
tFile
)))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
tdOpenTFile
(
&
tFile
,
TD_FILE_READ
)
<
0
)
{
goto
_err
;
}
SRSmaQTaskInfoIter
fIter
=
{
0
};
if
(
tdRSmaQTaskInfoIterInit
(
&
fIter
,
&
tFile
)
<
0
)
{
tdRSmaQTaskInfoIterDestroy
(
&
fIter
);
tdCloseTFile
(
&
tFile
);
goto
_err
;
}
SRSmaQTaskInfoItem
infoItem
=
{
0
};
if
(
tdRSmaQTaskInfoRestore
(
pSma
,
&
fIter
)
<
0
)
{
tdRSmaQTaskInfoIterDestroy
(
&
fIter
);
tdCloseTFile
(
&
tFile
);
goto
_err
;
}
tdRSmaQTaskInfoIterDestroy
(
&
fIter
);
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
suidList
);
tdCloseTFile
(
&
tFile
);
return
TSDB_CODE_SUCCESS
;
_err:
smaError
(
"rsma restore, qtaskinfo reload failed since %s"
,
terrstr
());
return
TSDB_CODE_FAILED
;
}
/**
* @brief reload ts data from checkpoint
*
* @param pSma
* @return int32_t
*/
static
int32_t
tdRSmaRestoreTSDataReload
(
SSma
*
pSma
)
{
// TODO
return
TSDB_CODE_SUCCESS
;
_err:
smaError
(
"rsma restore, ts data reload failed since %s"
,
terrstr
());
return
TSDB_CODE_FAILED
;
}
int32_t
tdProcessRSmaRestoreImpl
(
SSma
*
pSma
)
{
// step 1: iterate all stables to restore the rsma env
if
(
tdRSmaRestoreQTaskInfoInit
(
pSma
)
<
0
)
{
goto
_err
;
}
// step 2: retrieve qtaskinfo items from the persistence file(rsma/qtaskinfo) and restore
if
(
tdRSmaRestoreQTaskInfoReload
(
pSma
)
<
0
)
{
goto
_err
;
}
// step 3: reload ts data from checkpoint
if
(
tdRSmaRestoreTSDataReload
(
pSma
)
<
0
)
{
goto
_err
;
}
return
TSDB_CODE_SUCCESS
;
_err:
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
suidList
);
smaError
(
"failed to restore rsma task since %s"
,
terrstr
());
return
TSDB_CODE_FAILED
;
}
...
...
source/util/src/terror.c
浏览文件 @
de3596c9
...
...
@@ -581,10 +581,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_PTR, "Invalid tsma pointe
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSMA_INVALID_PARA
,
"Invalid tsma parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSMA_NO_INDEX_IN_CACHE
,
"No tsma index in cache"
)
//rsma
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_INVALID_ENV
,
"Invalid rsma env"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_INVALID_STAT
,
"Invalid rsma state"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RSMA_QTASKINFO_CREATE
,
"Rsma qtaskinfo creation error"
)
//tq
TAOS_DEFINE_ERROR
(
TSDB_CODE_TQ_NO_COMMITTED_OFFSET
,
"No committed offset"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录