Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4ca305fd
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4ca305fd
编写于
9月 28, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17131 from taosdata/fix/TD-19254-D
fix: coverity scan for sma
上级
6cc2ac0c
bf377943
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
21 deletion
+27
-21
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+2
-2
source/dnode/vnode/src/sma/smaCommit.c
source/dnode/vnode/src/sma/smaCommit.c
+1
-1
source/dnode/vnode/src/sma/smaEnv.c
source/dnode/vnode/src/sma/smaEnv.c
+1
-1
source/dnode/vnode/src/sma/smaFS.c
source/dnode/vnode/src/sma/smaFS.c
+1
-1
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+10
-8
source/dnode/vnode/src/sma/smaSnapshot.c
source/dnode/vnode/src/sma/smaSnapshot.c
+7
-3
source/dnode/vnode/src/sma/smaUtil.c
source/dnode/vnode/src/sma/smaUtil.c
+4
-4
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+1
-1
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
4ca305fd
...
...
@@ -872,7 +872,7 @@ SArray *metaGetSmaIdsByTable(SMeta *pMeta, tb_uid_t uid) {
pSmaIdxKey
=
(
SSmaIdxKey
*
)
pCur
->
pKey
;
if
(
taosArrayPush
(
pUids
,
&
pSmaIdxKey
->
smaUid
)
<
0
)
{
if
(
!
taosArrayPush
(
pUids
,
&
pSmaIdxKey
->
smaUid
)
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
metaCloseSmaCursor
(
pCur
);
taosArrayDestroy
(
pUids
);
...
...
@@ -915,7 +915,7 @@ SArray *metaGetSmaTbUids(SMeta *pMeta) {
}
}
if
(
taosArrayPush
(
pUids
,
&
uid
)
<
0
)
{
if
(
!
taosArrayPush
(
pUids
,
&
uid
)
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
metaCloseSmaCursor
(
pCur
);
taosArrayDestroy
(
pUids
);
...
...
source/dnode/vnode/src/sma/smaCommit.c
浏览文件 @
4ca305fd
...
...
@@ -213,7 +213,7 @@ static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pStat) {
tdRSmaQTaskInfoGetFullName
(
TD_VID
(
pVnode
),
committed
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
qTaskInfoFullName
);
if
(
taosCheckExistFile
(
qTaskInfoFullName
))
{
SQTaskFile
qFile
=
{.
nRef
=
1
,
.
padding
=
0
,
.
version
=
committed
,
.
size
=
0
};
if
(
taosArrayPush
(
pFS
->
aQTaskInf
,
&
qFile
)
<
0
)
{
if
(
!
taosArrayPush
(
pFS
->
aQTaskInf
,
&
qFile
)
)
{
taosWUnLockLatch
(
RSMA_FS_LOCK
(
pStat
));
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_FAILED
;
...
...
source/dnode/vnode/src/sma/smaEnv.c
浏览文件 @
4ca305fd
...
...
@@ -386,7 +386,7 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) {
}
break
;
default:
smaError
(
"vgId:%d, undefined smaType:%"
,
SMA_VID
(
pSma
),
smaType
);
smaError
(
"vgId:%d, undefined smaType:%"
PRIi8
,
SMA_VID
(
pSma
),
smaType
);
return
TSDB_CODE_FAILED
;
}
...
...
source/dnode/vnode/src/sma/smaFS.c
浏览文件 @
4ca305fd
...
...
@@ -54,7 +54,7 @@ int32_t tdRSmaFSOpen(SSma *pSma, int64_t version) {
if
((
terrno
=
tdRSmaFSUpsertQTaskFile
(
RSMA_FS
(
pStat
),
&
qTaskFile
))
<
0
)
{
goto
_end
;
}
smaInfo
(
"vgId:%d, open fs, version:%"
PRIi64
", ref:%
"
PRIi64
,
TD_VID
(
pVnode
),
qTaskFile
.
version
,
qTaskFile
.
nRef
);
smaInfo
(
"vgId:%d, open fs, version:%"
PRIi64
", ref:%
d"
,
TD_VID
(
pVnode
),
qTaskFile
.
version
,
qTaskFile
.
nRef
);
}
_end:
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
4ca305fd
...
...
@@ -196,7 +196,8 @@ static int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SArray *tbUids,
if
(
!
suid
||
!
tbUids
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
smaError
(
"vgId:%d, failed to get rsma info for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
());
smaError
(
"vgId:%d, failed to get rsma info for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
suid
?
*
suid
:
-
1
,
terrstr
());
return
TSDB_CODE_FAILED
;
}
...
...
@@ -566,6 +567,7 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
}
if
(
!
taosArrayPush
(
pUidArray
,
uid
))
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
taosArrayDestroy
(
pUidArray
);
return
TSDB_CODE_FAILED
;
}
if
(
taosHashPut
(
pStore
->
uidHash
,
&
suid
,
sizeof
(
suid
),
&
pUidArray
,
sizeof
(
pUidArray
))
<
0
)
{
...
...
@@ -1678,13 +1680,13 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
SRSmaInfoItem
*
pItem
=
NULL
;
if
(
!
(
pRSmaRef
=
taosHashGet
(
smaMgmt
.
refHash
,
&
param
,
POINTER_BYTES
)))
{
smaDebug
(
"rsma fetch task not start since rsma info item:%p not exist in refHash:%p, rsetId:%
"
PRIi64
,
param
,
*
(
int64_t
*
)
&
param
,
smaMgmt
.
refHash
,
smaMgmt
.
rsetId
);
smaDebug
(
"rsma fetch task not start since rsma info item:%p not exist in refHash:%p, rsetId:%
d"
,
param
,
smaMgmt
.
refHash
,
smaMgmt
.
rsetId
);
return
;
}
if
(
!
(
pStat
=
(
SRSmaStat
*
)
tdAcquireSmaRef
(
smaMgmt
.
rsetId
,
pRSmaRef
->
refId
)))
{
smaDebug
(
"rsma fetch task not start since rsma stat already destroyed, rsetId:%
"
PRIi64
" refId:%d
)"
,
smaDebug
(
"rsma fetch task not start since rsma stat already destroyed, rsetId:%
d refId:%"
PRIi64
"
)"
,
smaMgmt
.
rsetId
,
pRSmaRef
->
refId
);
// pRSmaRef freed in taosHashRemove
taosHashRemove
(
smaMgmt
.
refHash
,
&
param
,
POINTER_BYTES
);
return
;
...
...
@@ -1693,7 +1695,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
pSma
=
pStat
->
pSma
;
if
(
!
(
pRSmaInfo
=
tdAcquireRSmaInfoBySuid
(
pSma
,
pRSmaRef
->
suid
)))
{
smaDebug
(
"rsma fetch task not start since rsma info not exist, rsetId:%
"
PRIi64
" refId:%d
)"
,
smaMgmt
.
rsetId
,
smaDebug
(
"rsma fetch task not start since rsma info not exist, rsetId:%
d refId:%"
PRIi64
"
)"
,
smaMgmt
.
rsetId
,
pRSmaRef
->
refId
);
// pRSmaRef freed in taosHashRemove
tdReleaseSmaRef
(
smaMgmt
.
rsetId
,
pRSmaRef
->
refId
);
taosHashRemove
(
smaMgmt
.
refHash
,
&
param
,
POINTER_BYTES
);
...
...
@@ -1701,7 +1703,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
}
if
(
RSMA_INFO_IS_DEL
(
pRSmaInfo
))
{
smaDebug
(
"rsma fetch task not start since rsma info already deleted, rsetId:%
"
PRIi64
" refId:%d
)"
,
smaMgmt
.
rsetId
,
smaDebug
(
"rsma fetch task not start since rsma info already deleted, rsetId:%
d refId:%"
PRIi64
"
)"
,
smaMgmt
.
rsetId
,
pRSmaRef
->
refId
);
// pRSmaRef freed in taosHashRemove
tdReleaseRSmaInfo
(
pSma
,
pRSmaInfo
);
tdReleaseSmaRef
(
smaMgmt
.
rsetId
,
pRSmaRef
->
refId
);
...
...
@@ -1717,7 +1719,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
case
TASK_TRIGGER_STAT_PAUSED
:
case
TASK_TRIGGER_STAT_CANCELLED
:
{
smaDebug
(
"vgId:%d, rsma fetch task not start for level %"
PRIi8
" since stat is %"
PRIi8
", rsetId
rsetId:%"
PRIi64
" refId:%d"
,
", rsetId
:%d refId:%"
PRIi64
,
SMA_VID
(
pSma
),
pItem
->
level
,
rsmaTriggerStat
,
smaMgmt
.
rsetId
,
pRSmaRef
->
refId
);
if
(
rsmaTriggerStat
==
TASK_TRIGGER_STAT_PAUSED
)
{
taosTmrReset
(
tdRSmaFetchTrigger
,
RSMA_FETCH_INTERVAL
,
pItem
,
smaMgmt
.
tmrHandle
,
&
pItem
->
tmrId
);
...
...
@@ -1845,7 +1847,7 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
void
*
msg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
msg
);
if
(
msg
)
{
if
(
taosArrayPush
(
pSubmitArr
,
&
msg
)
<
0
)
{
if
(
!
taosArrayPush
(
pSubmitArr
,
&
msg
)
)
{
tdFreeRSmaSubmitItems
(
pSubmitArr
);
goto
_err
;
}
...
...
source/dnode/vnode/src/sma/smaSnapshot.c
浏览文件 @
4ca305fd
...
...
@@ -70,6 +70,8 @@ int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRSmaSnapRead
return
TSDB_CODE_SUCCESS
;
_err:
if
(
pReader
)
rsmaSnapReaderClose
(
&
pReader
);
*
ppReader
=
NULL
;
smaError
(
"vgId:%d, vnode snapshot rsma reader open failed since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
code
));
return
TSDB_CODE_FAILED
;
}
...
...
@@ -101,8 +103,8 @@ static int32_t rsmaQTaskInfSnapReaderOpen(SRSmaSnapReader* pReader, int64_t vers
if
(
!
taosCheckExistFile
(
qTaskInfoFullName
))
{
tdRSmaFSUnRef
(
pSma
,
pStat
,
version
);
smaInfo
(
"vgId:%d, vnode snapshot rsma reader for qtaskinfo version %"
PRIi64
" not need as %s not exist
s
"
,
TD_VID
(
pVnode
),
qTaskInfoFullName
);
smaInfo
(
"vgId:%d, vnode snapshot rsma reader for qtaskinfo version %"
PRIi64
" not need as %s not exist"
,
TD_VID
(
pVnode
),
version
,
qTaskInfoFullName
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -336,6 +338,7 @@ int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, SRSmaSnapWrit
tdRSmaQTaskInfoGetFullName
(
TD_VID
(
pVnode
),
0
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
qTaskInfoFullName
);
TdFilePtr
qTaskF
=
taosCreateFile
(
qTaskInfoFullName
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_TRUNC
);
if
(
!
qTaskF
)
{
taosMemoryFree
(
qWriter
);
code
=
TAOS_SYSTEM_ERROR
(
errno
);
smaError
(
"vgId:%d, rsma snapshot writer open %s failed since %s"
,
TD_VID
(
pSma
->
pVnode
),
qTaskInfoFullName
,
tstrerror
(
code
));
...
...
@@ -356,6 +359,7 @@ int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, SRSmaSnapWrit
_err:
smaError
(
"vgId:%d, rsma snapshot writer open failed since %s"
,
TD_VID
(
pSma
->
pVnode
),
tstrerror
(
code
));
if
(
pWriter
)
rsmaSnapWriterClose
(
&
pWriter
,
0
);
*
ppWriter
=
NULL
;
return
code
;
}
...
...
@@ -449,11 +453,11 @@ static int32_t rsmaSnapWriteQTaskInfo(SRSmaSnapWriter* pWriter, uint8_t* pData,
code
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
}
smaInfo
(
"vgId:%d, vnode snapshot rsma write qtaskinfo %s succeed"
,
SMA_VID
(
pWriter
->
pSma
),
qWriter
->
fname
);
}
else
{
smaInfo
(
"vgId:%d, vnode snapshot rsma write qtaskinfo is not needed"
,
SMA_VID
(
pWriter
->
pSma
));
}
smaInfo
(
"vgId:%d, vnode snapshot rsma write qtaskinfo %s succeed"
,
SMA_VID
(
pWriter
->
pSma
),
qWriter
->
fname
);
_exit:
return
code
;
...
...
source/dnode/vnode/src/sma/smaUtil.c
浏览文件 @
4ca305fd
...
...
@@ -290,19 +290,19 @@ int32_t tdRemoveTFile(STFile *pTFile) {
void
*
tdAcquireSmaRef
(
int32_t
rsetId
,
int64_t
refId
)
{
void
*
pResult
=
taosAcquireRef
(
rsetId
,
refId
);
if
(
!
pResult
)
{
smaWarn
(
"rsma acquire ref for rsetId:%
"
PRIi64
" refId:%d
failed since %s"
,
rsetId
,
refId
,
terrstr
());
smaWarn
(
"rsma acquire ref for rsetId:%
d refId:%"
PRIi64
"
failed since %s"
,
rsetId
,
refId
,
terrstr
());
}
else
{
smaDebug
(
"rsma acquire ref for rsetId:%
"
PRIi64
" refId:%d
success"
,
rsetId
,
refId
);
smaDebug
(
"rsma acquire ref for rsetId:%
d refId:%"
PRIi64
"
success"
,
rsetId
,
refId
);
}
return
pResult
;
}
int32_t
tdReleaseSmaRef
(
int32_t
rsetId
,
int64_t
refId
)
{
if
(
taosReleaseRef
(
rsetId
,
refId
)
<
0
)
{
smaWarn
(
"rsma release ref for rsetId:%
"
PRIi64
" refId:%d
failed since %s"
,
rsetId
,
refId
,
terrstr
());
smaWarn
(
"rsma release ref for rsetId:%
d refId:%"
PRIi64
"
failed since %s"
,
rsetId
,
refId
,
terrstr
());
return
TSDB_CODE_FAILED
;
}
smaDebug
(
"rsma release ref for rsetId:%
"
PRIi64
" refId:%d
success"
,
rsetId
,
refId
);
smaDebug
(
"rsma release ref for rsetId:%
d refId:%"
PRIi64
"
success"
,
rsetId
,
refId
);
return
TSDB_CODE_SUCCESS
;
}
\ No newline at end of file
source/libs/stream/src/streamState.c
浏览文件 @
4ca305fd
...
...
@@ -29,7 +29,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath) {
if
(
!
specPath
)
{
sprintf
(
statePath
,
"%s/%d"
,
path
,
pTask
->
taskId
);
}
else
{
mem
cpy
(
statePath
,
path
,
300
);
strn
cpy
(
statePath
,
path
,
300
);
}
if
(
tdbOpen
(
statePath
,
4096
,
256
,
&
pState
->
db
)
<
0
)
{
goto
_err
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录