Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b15fa09a
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
提交
b15fa09a
编写于
9月 06, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: qinf process optimization for duplicated commit version
上级
da8244f1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
10 deletion
+41
-10
source/dnode/vnode/src/inc/sma.h
source/dnode/vnode/src/inc/sma.h
+1
-0
source/dnode/vnode/src/sma/smaCommit.c
source/dnode/vnode/src/sma/smaCommit.c
+16
-5
source/dnode/vnode/src/sma/smaFS.c
source/dnode/vnode/src/sma/smaFS.c
+12
-0
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+12
-5
未找到文件。
source/dnode/vnode/src/inc/sma.h
浏览文件 @
b15fa09a
...
...
@@ -211,6 +211,7 @@ int32_t tdRSmaFSOpen(SSma *pSma, int64_t version);
void
tdRSmaFSClose
(
SRSmaFS
*
fs
);
int32_t
tdRSmaFSRef
(
SSma
*
pSma
,
SRSmaStat
*
pStat
,
int64_t
version
);
void
tdRSmaFSUnRef
(
SSma
*
pSma
,
SRSmaStat
*
pStat
,
int64_t
version
);
int64_t
tdRSmaFSMaxVer
(
SSma
*
pSma
,
SRSmaStat
*
pStat
);
int32_t
tdRSmaFSUpsertQTaskFile
(
SRSmaFS
*
pFS
,
SQTaskFile
*
qTaskFile
);
int32_t
tdRSmaRestore
(
SSma
*
pSma
,
int8_t
type
,
int64_t
committedVer
);
int32_t
tdRSmaProcessCreateImpl
(
SSma
*
pSma
,
SRSmaParam
*
param
,
int64_t
suid
,
const
char
*
tbName
);
...
...
source/dnode/vnode/src/sma/smaCommit.c
浏览文件 @
b15fa09a
...
...
@@ -182,6 +182,7 @@ static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pStat) {
SVnode
*
pVnode
=
pSma
->
pVnode
;
SRSmaFS
*
pFS
=
RSMA_FS
(
pStat
);
int64_t
committed
=
pStat
->
commitAppliedVer
;
int64_t
fsMaxVer
=
-
1
;
char
qTaskInfoFullName
[
TSDB_FILENAME_LEN
];
taosWLockLatch
(
RSMA_FS_LOCK
(
pStat
));
...
...
@@ -204,10 +205,20 @@ static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pStat) {
++
i
;
}
SQTaskFile
qFile
=
{.
nRef
=
1
,
.
padding
=
0
,
.
version
=
committed
,
.
size
=
0
};
if
(
tdRSmaFSUpsertQTaskFile
(
pFS
,
&
qFile
)
<
0
)
{
taosWUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
return
TSDB_CODE_FAILED
;
if
(
taosArrayGetSize
(
pFS
->
aQTaskInf
)
>
0
)
{
fsMaxVer
=
((
SQTaskFile
*
)
taosArrayGetLast
(
pFS
->
aQTaskInf
))
->
version
;
}
if
(
fsMaxVer
<
committed
)
{
SQTaskFile
qFile
=
{.
nRef
=
1
,
.
padding
=
0
,
.
version
=
committed
,
.
size
=
0
};
if
(
taosArrayPush
(
pFS
->
aQTaskInf
,
&
qFile
)
<
0
)
{
taosWUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_FAILED
;
}
}
else
{
smaDebug
(
"vgId:%d, update qinf, no need as committed %"
PRIi64
" not larger than fsMaxVer %"
PRIi64
,
TD_VID
(
pVnode
),
committed
,
fsMaxVer
);
}
taosWUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
...
...
@@ -365,7 +376,7 @@ static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma) {
return
TSDB_CODE_SUCCESS
;
}
SRSmaStat
*
pRSmaStat
=
(
SRSmaStat
*
)
SMA_ENV_STAT
(
pEnv
);
SRSmaStat
*
pRSmaStat
=
(
SRSmaStat
*
)
SMA_ENV_STAT
(
pEnv
);
// step 1: merge qTaskInfo and iQTaskInfo
// lock
...
...
source/dnode/vnode/src/sma/smaFS.c
浏览文件 @
b15fa09a
...
...
@@ -96,6 +96,18 @@ int32_t tdRSmaFSRef(SSma *pSma, SRSmaStat *pStat, int64_t version) {
return
oldVal
;
}
int64_t
tdRSmaFSMaxVer
(
SSma
*
pSma
,
SRSmaStat
*
pStat
)
{
SArray
*
aQTaskInf
=
RSMA_FS
(
pStat
)
->
aQTaskInf
;
int64_t
version
=
-
1
;
taosRLockLatch
(
RSMA_FS_LOCK
(
pStat
));
if
(
taosArrayGetSize
(
aQTaskInf
)
>
0
)
{
version
=
((
SQTaskFile
*
)
taosArrayGetLast
(
aQTaskInf
))
->
version
;
}
taosRUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
return
version
;
}
void
tdRSmaFSUnRef
(
SSma
*
pSma
,
SRSmaStat
*
pStat
,
int64_t
version
)
{
SVnode
*
pVnode
=
pSma
->
pVnode
;
SArray
*
aQTaskInf
=
RSMA_FS
(
pStat
)
->
aQTaskInf
;
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
b15fa09a
...
...
@@ -1453,17 +1453,24 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
return
TSDB_CODE_SUCCESS
;
}
int64_t
fsMaxVer
=
tdRSmaFSMaxVer
(
pSma
,
pRSmaStat
);
if
(
pRSmaStat
->
commitAppliedVer
<=
fsMaxVer
)
{
smaDebug
(
"vgId:%d, rsma persist, no need as applied %"
PRIi64
" not larger than fsMaxVer %"
PRIi64
,
vid
,
pRSmaStat
->
commitAppliedVer
,
fsMaxVer
);
return
TSDB_CODE_SUCCESS
;
}
STFile
tFile
=
{
0
};
#if 0
if (pRSmaStat->commitAppliedVer > 0) {
char qTaskInfoFName[TSDB_FILENAME_LEN];
tdRSmaQTaskInfoGetFileName(vid, pRSmaStat->commitAppliedVer, qTaskInfoFName);
if (tdInitTFile(&tFile, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFName) < 0) {
smaError("vgId:%d, rsma persit, init %s failed since %s", vid, qTaskInfoFName, terrstr());
smaError("vgId:%d, rsma persi
s
t, init %s failed since %s", vid, qTaskInfoFName, terrstr());
goto _err;
}
if (tdCreateTFile(&tFile, true, TD_FTYPE_RSMA_QTASKINFO) < 0) {
smaError("vgId:%d, rsma persit, create %s failed since %s", vid, TD_TFILE_FULL_NAME(&tFile), terrstr());
smaError("vgId:%d, rsma persi
s
t, create %s failed since %s", vid, TD_TFILE_FULL_NAME(&tFile), terrstr());
goto _err;
}
smaDebug("vgId:%d, rsma, serialize qTaskInfo, file %s created", vid, TD_TFILE_FULL_NAME(&tFile));
...
...
@@ -1513,11 +1520,11 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
char
qTaskInfoFName
[
TSDB_FILENAME_LEN
];
tdRSmaQTaskInfoGetFileName
(
vid
,
pRSmaStat
->
commitAppliedVer
,
qTaskInfoFName
);
if
(
tdInitTFile
(
&
tFile
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
qTaskInfoFName
)
<
0
)
{
smaError
(
"vgId:%d, rsma persit, init %s failed since %s"
,
vid
,
qTaskInfoFName
,
terrstr
());
smaError
(
"vgId:%d, rsma persi
s
t, init %s failed since %s"
,
vid
,
qTaskInfoFName
,
terrstr
());
goto
_err
;
}
if
(
tdCreateTFile
(
&
tFile
,
true
,
TD_FTYPE_RSMA_QTASKINFO
)
<
0
)
{
smaError
(
"vgId:%d, rsma persit, create %s failed since %s"
,
vid
,
TD_TFILE_FULL_NAME
(
&
tFile
),
terrstr
());
smaError
(
"vgId:%d, rsma persi
s
t, create %s failed since %s"
,
vid
,
TD_TFILE_FULL_NAME
(
&
tFile
),
terrstr
());
goto
_err
;
}
smaDebug
(
"vgId:%d, rsma, table %"
PRIi64
" serialize qTaskInfo, file %s created"
,
vid
,
pRSmaInfo
->
suid
,
...
...
@@ -1561,7 +1568,7 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
}
return
TSDB_CODE_SUCCESS
;
_err:
smaError
(
"vgId:%d, rsma persit failed since %s"
,
vid
,
terrstr
());
smaError
(
"vgId:%d, rsma persi
s
t failed since %s"
,
vid
,
terrstr
());
if
(
isFileCreated
)
{
tdRemoveTFile
(
&
tFile
);
tdDestroyTFile
(
&
tFile
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录