Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c1393fb2
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看板
提交
c1393fb2
编写于
7月 06, 2023
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: invoke streamStateCommit for rsma
上级
e8cdf132
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
22 deletion
+60
-22
source/dnode/vnode/src/inc/sma.h
source/dnode/vnode/src/inc/sma.h
+14
-15
source/dnode/vnode/src/sma/smaCommit.c
source/dnode/vnode/src/sma/smaCommit.c
+5
-7
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+41
-0
未找到文件。
source/dnode/vnode/src/inc/sma.h
浏览文件 @
c1393fb2
...
...
@@ -105,17 +105,16 @@ struct SRSmaFS {
struct
SRSmaStat
{
SSma
*
pSma
;
int64_t
commitAppliedVer
;
// vnode applied version for async commit
int64_t
refId
;
// shared by fetch tasks
volatile
int64_t
nBufItems
;
// number of items in queue buffer
SRWLatch
lock
;
// r/w lock for rsma fs(e.g. qtaskinfo)
volatile
int32_t
nFetchAll
;
// active number of fetch all
volatile
int8_t
triggerStat
;
// shared by fetch tasks
volatile
int8_t
commitStat
;
// 0 not in committing, 1 in committing
volatile
int8_t
delFlag
;
// 0 no deleted SRSmaInfo, 1 has deleted SRSmaInfo
SRSmaFS
fs
;
// for recovery/snapshot r/w
SHashObj
*
infoHash
;
// key: suid, value: SRSmaInfo
tsem_t
notEmpty
;
// has items in queue buffer
int64_t
refId
;
// shared by fetch tasks
volatile
int64_t
nBufItems
;
// number of items in queue buffer
SRWLatch
lock
;
// r/w lock for rsma fs(e.g. qtaskinfo)
volatile
int32_t
nFetchAll
;
// active number of fetch all
volatile
int8_t
triggerStat
;
// shared by fetch tasks
volatile
int8_t
commitStat
;
// 0 not in committing, 1 in committing
volatile
int8_t
delFlag
;
// 0 no deleted SRSmaInfo, 1 has deleted SRSmaInfo
SRSmaFS
fs
;
// for recovery/snapshot r/w
SHashObj
*
infoHash
;
// key: suid, value: SRSmaInfo
tsem_t
notEmpty
;
// has items in queue buffer
};
struct
SSmaStat
{
...
...
@@ -156,9 +155,9 @@ struct SRSmaInfo {
int16_t
padding
;
T_REF_DECLARE
()
SRSmaInfoItem
items
[
TSDB_RETENTION_L2
];
void
*
taskInfo
[
TSDB_RETENTION_L2
];
// qTaskInfo_t
STaosQueue
*
queue
;
// buffer queue of SubmitReq
STaosQall
*
qall
;
// buffer qall of SubmitReq
void
*
taskInfo
[
TSDB_RETENTION_L2
];
// qTaskInfo_t
STaosQueue
*
queue
;
// buffer queue of SubmitReq
STaosQall
*
qall
;
// buffer qall of SubmitReq
};
#define RSMA_INFO_HEAD_LEN offsetof(SRSmaInfo, items)
...
...
@@ -221,6 +220,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo, bool isDeepFree);
int32_t
tdRSmaRestore
(
SSma
*
pSma
,
int8_t
type
,
int64_t
committedVer
,
int8_t
rollback
);
int32_t
tdRSmaProcessCreateImpl
(
SSma
*
pSma
,
SRSmaParam
*
param
,
int64_t
suid
,
const
char
*
tbName
);
int32_t
tdRSmaProcessExecImpl
(
SSma
*
pSma
,
ERsmaExecType
type
);
int32_t
tdRSmaPersistExecImpl
(
SRSmaStat
*
pRSmaStat
,
SHashObj
*
pInfoHash
);
int32_t
tdRSmaProcessRestoreImpl
(
SSma
*
pSma
,
int8_t
type
,
int64_t
qtaskFileVer
,
int8_t
rollback
);
void
tdRSmaQTaskInfoGetFileName
(
int32_t
vgId
,
int64_t
suid
,
int8_t
level
,
int64_t
version
,
char
*
outputName
);
void
tdRSmaQTaskInfoGetFullPath
(
int32_t
vgId
,
tb_uid_t
suid
,
int8_t
level
,
const
char
*
path
,
char
*
outputName
);
...
...
@@ -234,7 +234,6 @@ static FORCE_INLINE void tdUnRefRSmaInfo(SSma *pSma, SRSmaInfo *pRSmaInfo) {
smaTrace
(
"vgId:%d, unref rsma info:%p, val:%d"
,
SMA_VID
(
pSma
),
pRSmaInfo
,
ref
);
}
void
tdRSmaGetDirName
(
int32_t
vgId
,
const
char
*
pdname
,
const
char
*
dname
,
bool
endWithSep
,
char
*
outputName
);
#ifdef __cplusplus
...
...
source/dnode/vnode/src/sma/smaCommit.c
浏览文件 @
c1393fb2
...
...
@@ -149,13 +149,6 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma, bool isCommit) {
while
(
atomic_val_compare_exchange_8
(
RSMA_COMMIT_STAT
(
pRSmaStat
),
0
,
1
)
!=
0
)
{
tdSmaLoopsCheck
(
&
nLoops
,
1000
);
}
pRSmaStat
->
commitAppliedVer
=
pSma
->
pVnode
->
state
.
applied
;
if
(
ASSERTS
(
pRSmaStat
->
commitAppliedVer
>=
-
1
,
"commit applied version %"
PRIi64
" < -1"
,
pRSmaStat
->
commitAppliedVer
))
{
code
=
TSDB_CODE_APP_ERROR
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
// step 2: wait for all triggered fetch tasks to finish
nLoops
=
0
;
...
...
@@ -183,6 +176,11 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma, bool isCommit) {
if
(
!
isCommit
)
goto
_exit
;
code
=
tdRSmaPersistExecImpl
(
pRSmaStat
,
RSMA_INFO_HASH
(
pRSmaStat
));
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
smaInfo
(
"vgId:%d, rsma commit, operator state committed, TID:%p"
,
SMA_VID
(
pSma
),
(
void
*
)
taosGetSelfPthreadId
());
smaInfo
(
"vgId:%d, rsma commit, all items are consumed, TID:%p"
,
SMA_VID
(
pSma
),
(
void
*
)
taosGetSelfPthreadId
());
// all rsma results are written completely
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
c1393fb2
...
...
@@ -1052,6 +1052,47 @@ _err:
return
code
;
}
int32_t
tdRSmaPersistExecImpl
(
SRSmaStat
*
pRSmaStat
,
SHashObj
*
pInfoHash
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
SSma
*
pSma
=
pRSmaStat
->
pSma
;
SVnode
*
pVnode
=
pSma
->
pVnode
;
SRSmaFS
fs
=
{
0
};
if
(
taosHashGetSize
(
pInfoHash
)
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
void
*
infoHash
=
NULL
;
while
((
infoHash
=
taosHashIterate
(
pInfoHash
,
infoHash
)))
{
SRSmaInfo
*
pRSmaInfo
=
*
(
SRSmaInfo
**
)
infoHash
;
if
(
RSMA_INFO_IS_DEL
(
pRSmaInfo
))
{
continue
;
}
for
(
int32_t
i
=
0
;
i
<
TSDB_RETENTION_L2
;
++
i
)
{
SRSmaInfoItem
*
pItem
=
RSMA_INFO_ITEM
(
pRSmaInfo
,
i
);
if
(
pItem
&&
pItem
->
pStreamState
)
{
if
(
streamStateCommit
(
pItem
->
pStreamState
)
<
0
)
{
code
=
TSDB_CODE_RSMA_STREAM_STATE_COMMIT
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
smaDebug
(
"vgId:%d, rsma persist, stream state commit success, table %"
PRIi64
", level %d"
,
TD_VID
(
pVnode
),
pRSmaInfo
->
suid
,
i
+
1
);
}
}
}
_exit:
if
(
code
)
{
smaError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
terrno
=
code
;
return
code
;
}
/**
* @brief trigger to get rsma result in async mode
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录