Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8281176b
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看板
提交
8281176b
编写于
6月 27, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
other: code optimization
上级
16b2d793
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
25 deletion
+22
-25
source/dnode/vnode/src/sma/smaEnv.c
source/dnode/vnode/src/sma/smaEnv.c
+2
-5
source/dnode/vnode/src/sma/smaOpen.c
source/dnode/vnode/src/sma/smaOpen.c
+2
-2
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+17
-17
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+1
-1
未找到文件。
source/dnode/vnode/src/sma/smaEnv.c
浏览文件 @
8281176b
...
...
@@ -156,6 +156,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
static
void
tdDestroyTSmaStat
(
STSmaStat
*
pStat
)
{
if
(
pStat
)
{
smaDebug
(
"destroy tsma stat"
);
tDestroyTSma
(
pStat
->
pTSma
);
taosMemoryFreeClear
(
pStat
->
pTSma
);
taosMemoryFreeClear
(
pStat
->
pTSchema
);
...
...
@@ -170,7 +171,7 @@ static void *tdFreeTSmaStat(STSmaStat *pStat) {
static
void
tdDestroyRSmaStat
(
SRSmaStat
*
pStat
)
{
if
(
pStat
)
{
smaDebug
(
"vgId:%d
, %s:%d free rsma stat"
,
SMA_VID
(
pStat
->
pSma
),
__func__
,
__LINE__
);
smaDebug
(
"vgId:%d
destroy rsma stat"
,
SMA_VID
(
pStat
->
pSma
)
);
// step 1: set persistence task cancelled
atomic_store_8
(
RSMA_TRIGGER_STAT
(
pStat
),
TASK_TRIGGER_STAT_CANCELLED
);
...
...
@@ -245,16 +246,12 @@ void *tdFreeSmaState(SSmaStat *pSmaStat, int8_t smaType) {
int32_t
tdDestroySmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
)
{
if
(
pSmaStat
)
{
if
(
smaType
==
TSDB_SMA_TYPE_TIME_RANGE
)
{
smaDebug
(
"%s:%d destroy tsma stat"
,
__func__
,
__LINE__
);
tdDestroyTSmaStat
(
SMA_TSMA_STAT
(
pSmaStat
));
}
else
if
(
smaType
==
TSDB_SMA_TYPE_ROLLUP
)
{
smaDebug
(
"%s:%d destroy rsma stat"
,
__func__
,
__LINE__
);
tdDestroyRSmaStat
(
SMA_RSMA_STAT
(
pSmaStat
));
}
else
{
ASSERT
(
0
);
}
}
else
{
smaDebug
(
"%s:%d no need to destroy rsma stat"
,
__func__
,
__LINE__
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
source/dnode/vnode/src/sma/smaOpen.c
浏览文件 @
8281176b
...
...
@@ -190,8 +190,8 @@ static int32_t rsmaRestore(SSma *pSma) {
if
(
TABLE_IS_ROLLUP
(
mr
.
me
.
flags
))
{
SRSmaParam
*
param
=
&
mr
.
me
.
stbEntry
.
rsmaParam
;
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
smaDebug
(
"
%s:%d table:%"
PRIi64
" maxdelay[%d]:%"
PRIi64
" watermark[%d]:%"
PRIi64
,
__func__
,
__LINE__
,
suid
,
i
,
param
->
maxdelay
[
i
],
i
,
param
->
watermark
[
i
]);
smaDebug
(
"
vgId: %d table:%"
PRIi64
" maxdelay[%d]:%"
PRIi64
" watermark[%d]:%"
PRIi64
,
TD_VID
(
pSma
->
pVnode
)
,
suid
,
i
,
param
->
maxdelay
[
i
],
i
,
param
->
watermark
[
i
]);
}
}
}
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
8281176b
...
...
@@ -49,10 +49,10 @@ static FORCE_INLINE void tdFreeTaskHandle(qTaskInfo_t *taskHandle, int32_t vgId,
// Note: free/kill may in RC
qTaskInfo_t
otaskHandle
=
atomic_load_ptr
(
taskHandle
);
if
(
otaskHandle
&&
atomic_val_compare_exchange_ptr
(
taskHandle
,
otaskHandle
,
NULL
))
{
smaDebug
(
"vgId:%d,
%s:%d free qTaskInfo_t %p of level %d"
,
vgId
,
__func__
,
__LINE__
,
otaskHandle
,
level
);
smaDebug
(
"vgId:%d,
free qTaskInfo_t %p of level %d"
,
vgId
,
otaskHandle
,
level
);
qDestroyTask
(
otaskHandle
);
}
else
{
smaDebug
(
"vgId:%d,
%s:%d not free qTaskInfo_t %p of level %d"
,
vgId
,
__func__
,
__LINE__
,
otaskHandle
,
level
);
smaDebug
(
"vgId:%d,
not free qTaskInfo_t %p of level %d"
,
vgId
,
otaskHandle
,
level
);
}
}
...
...
@@ -89,7 +89,7 @@ static FORCE_INLINE int32_t tdUidStoreInit(STbUidStore **pStore) {
return
TSDB_CODE_SUCCESS
;
}
static
FORCE_INLINE
int32_t
tdUpdateTbUidListImpl
(
SSma
*
pSma
,
tb_uid_t
*
suid
,
SArray
*
tbUids
)
{
static
int32_t
tdUpdateTbUidListImpl
(
SSma
*
pSma
,
tb_uid_t
*
suid
,
SArray
*
tbUids
)
{
SSmaEnv
*
pEnv
=
SMA_RSMA_ENV
(
pSma
);
SRSmaStat
*
pStat
=
(
SRSmaStat
*
)
SMA_ENV_STAT
(
pEnv
);
SRSmaInfo
*
pRSmaInfo
=
NULL
;
...
...
@@ -528,16 +528,16 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
int8_t
rsmaTriggerStat
=
atomic_load_8
(
RSMA_TRIGGER_STAT
(
pStat
));
if
(
rsmaTriggerStat
==
TASK_TRIGGER_STAT_CANCELLED
||
rsmaTriggerStat
==
TASK_TRIGGER_STAT_FINISHED
)
{
smaDebug
(
"vgId:%d,
%s:%d
level %"
PRIi8
" not fetch since stat is cancelled for table suid:%"
PRIi64
,
SMA_VID
(
pSma
),
__func__
,
__LINE__
,
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
smaDebug
(
"vgId:%d, level %"
PRIi8
" not fetch since stat is cancelled for table suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
return
;
}
int8_t
fetchTriggerStat
=
atomic_val_compare_exchange_8
(
&
pItem
->
triggerStat
,
TASK_TRIGGER_STAT_ACTIVE
,
TASK_TRIGGER_STAT_INACTIVE
);
if
(
fetchTriggerStat
==
TASK_TRIGGER_STAT_ACTIVE
)
{
smaDebug
(
"vgId:%d,
%s:%d level %"
PRIi8
" stat is active for table suid:%"
PRIi64
,
SMA_VID
(
pSma
),
__func__
,
__LINE__
,
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
smaDebug
(
"vgId:%d,
level %"
PRIi8
" stat is active for table suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
tdRefSmaStat
(
pSma
,
(
SSmaStat
*
)
pStat
);
...
...
@@ -548,13 +548,13 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
tdUnRefSmaStat
(
pSma
,
(
SSmaStat
*
)
pStat
);
}
else
{
smaDebug
(
"vgId:%d,
%s:%d level %"
PRIi8
" stat is inactive for table suid:%"
PRIi64
,
SMA_VID
(
pSma
),
__func__
,
__LINE__
,
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
smaDebug
(
"vgId:%d,
level %"
PRIi8
" stat is inactive for table suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
}
}
static
FORCE_INLINE
int32_t
tdExecuteRSmaImpl
(
SSma
*
pSma
,
const
void
*
pMsg
,
int32_t
inputType
,
SRSmaInfoItem
*
pItem
,
tb_uid_t
suid
,
int8_t
level
)
{
static
int32_t
tdExecuteRSmaImpl
(
SSma
*
pSma
,
const
void
*
pMsg
,
int32_t
inputType
,
SRSmaInfoItem
*
pItem
,
tb_uid_t
suid
,
int8_t
level
)
{
if
(
!
pItem
||
!
pItem
->
taskInfo
)
{
smaDebug
(
"vgId:%d, no qTaskInfo to execute rsma %"
PRIi8
" task for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
suid
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -570,7 +570,7 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
tdFetchAndSubmitRSmaResult
(
pItem
,
STREAM_DATA_TYPE_SUBMIT_BLOCK
);
atomic_store_8
(
&
pItem
->
triggerStat
,
TASK_TRIGGER_STAT_ACTIVE
);
smaDebug
(
"vgId:%d,
%s:%d process rsma insert"
,
SMA_VID
(
pSma
),
__func__
,
__LINE__
);
smaDebug
(
"vgId:%d,
process rsma insert"
,
SMA_VID
(
pSma
)
);
SSmaEnv
*
pEnv
=
SMA_RSMA_ENV
(
pSma
);
SRSmaStat
*
pStat
=
SMA_RSMA_STAT
(
pEnv
->
pStat
);
...
...
@@ -823,7 +823,7 @@ static void tdRSmaPersistTrigger(void *param, void *tmrId) {
if
(
TASK_TRIGGER_STAT_CANCELLED
!=
atomic_val_compare_exchange_8
(
RSMA_TRIGGER_STAT
(
pRSmaStat
),
TASK_TRIGGER_STAT_CANCELLED
,
TASK_TRIGGER_STAT_FINISHED
))
{
smaDebug
(
"
%s:%d rsma persistence start since active"
,
__func__
,
__LINE__
);
smaDebug
(
"
rsma persistence start since active"
);
tdRSmaPersistTask
(
pRSmaStat
);
taosTmrReset
(
tdRSmaPersistTrigger
,
RSMA_QTASK_PERSIST_MS
,
pRSmaStat
,
pRSmaStat
->
tmrHandle
,
&
pRSmaStat
->
tmrId
);
}
else
{
...
...
@@ -832,16 +832,16 @@ static void tdRSmaPersistTrigger(void *param, void *tmrId) {
}
break
;
case
TASK_TRIGGER_STAT_CANCELLED
:
{
atomic_store_8
(
RSMA_TRIGGER_STAT
(
pRSmaStat
),
TASK_TRIGGER_STAT_FINISHED
);
smaDebug
(
"
%s:%d rsma persistence not start since cancelled and finished"
,
__func__
,
__LINE__
);
smaDebug
(
"
rsma persistence not start since cancelled and finished"
);
}
break
;
case
TASK_TRIGGER_STAT_INACTIVE
:
{
smaDebug
(
"
%s:%d rsma persistence not start since inactive"
,
__func__
,
__LINE__
);
smaDebug
(
"
rsma persistence not start since inactive"
);
}
break
;
case
TASK_TRIGGER_STAT_INIT
:
{
smaDebug
(
"
%s:%d rsma persistence not start since init"
,
__func__
,
__LINE__
);
smaDebug
(
"
rsma persistence not start since init"
);
}
break
;
default:
{
smaWarn
(
"
%s:%d rsma persistence not start since unknown stat %"
PRIi8
,
__func__
,
__LINE__
,
tmrStat
);
smaWarn
(
"
rsma persistence not start since unknown stat %"
PRIi8
,
tmrStat
);
ASSERT
(
0
);
}
break
;
}
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
8281176b
...
...
@@ -172,9 +172,9 @@ void vnodeClose(SVnode *pVnode) {
vnodeSyncClose
(
pVnode
);
vnodeQueryClose
(
pVnode
);
walClose
(
pVnode
->
pWal
);
smaCloseEx
(
pVnode
->
pSma
);
tqClose
(
pVnode
->
pTq
);
if
(
pVnode
->
pTsdb
)
tsdbClose
(
&
pVnode
->
pTsdb
);
smaCloseEx
(
pVnode
->
pSma
);
metaClose
(
pVnode
->
pMeta
);
vnodeCloseBufPool
(
pVnode
);
// destroy handle
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录