Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
85276450
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看板
未验证
提交
85276450
编写于
10月 15, 2022
作者:
H
Hongze Cheng
提交者:
GitHub
10月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17370 from taosdata/fix/hzcheng_coverity_scan
fix: more cv issue
上级
9781c1c2
7e174e34
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
77 addition
and
38 deletion
+77
-38
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+1
-0
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+22
-12
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+28
-18
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+24
-6
未找到文件。
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
85276450
...
...
@@ -693,6 +693,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
if
(
iCol
>=
pSchema
->
nCols
)
break
;
pColumn
=
&
pSchema
->
pSchema
[
iCol
];
ASSERT
(
pAlterTbReq
->
colName
);
if
(
strcmp
(
pColumn
->
name
,
pAlterTbReq
->
colName
)
==
0
)
break
;
iCol
++
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
85276450
...
...
@@ -961,7 +961,7 @@ int32_t tsdbFSCommit2(STsdb *pTsdb, STsdbFS *pFSNew) {
nRef
=
atomic_sub_fetch_32
(
&
pSetOld
->
pHeadF
->
nRef
,
1
);
if
(
nRef
==
0
)
{
tsdbHeadFileName
(
pTsdb
,
pSetOld
->
diskId
,
pSetOld
->
fid
,
pSetOld
->
pHeadF
,
fname
);
taosRemoveFile
(
fname
);
(
void
)
taosRemoveFile
(
fname
);
taosMemoryFree
(
pSetOld
->
pHeadF
);
}
...
...
@@ -1114,7 +1114,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) {
ASSERT
(
nRef
>=
0
);
if
(
nRef
==
0
)
{
tsdbHeadFileName
(
pTsdb
,
pSet
->
diskId
,
pSet
->
fid
,
pSet
->
pHeadF
,
fname
);
taosRemoveFile
(
fname
);
(
void
)
taosRemoveFile
(
fname
);
taosMemoryFree
(
pSet
->
pHeadF
);
}
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
85276450
...
...
@@ -843,7 +843,8 @@ _err:
// SDataFReader ====================================================
int32_t
tsdbDataFReaderOpen
(
SDataFReader
**
ppReader
,
STsdb
*
pTsdb
,
SDFileSet
*
pSet
)
{
int32_t
code
=
0
;
SDataFReader
*
pReader
;
int32_t
lino
=
0
;
SDataFReader
*
pReader
=
NULL
;
int32_t
szPage
=
pTsdb
->
pVnode
->
config
.
tsdbPageSize
;
char
fname
[
TSDB_FILENAME_LEN
];
...
...
@@ -851,7 +852,7 @@ int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pS
pReader
=
(
SDataFReader
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pReader
));
if
(
pReader
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
pReader
->
pTsdb
=
pTsdb
;
pReader
->
pSet
=
pSet
;
...
...
@@ -859,31 +860,40 @@ int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pS
// head
tsdbHeadFileName
(
pTsdb
,
pSet
->
diskId
,
pSet
->
fid
,
pSet
->
pHeadF
,
fname
);
code
=
tsdbOpenFile
(
fname
,
szPage
,
TD_FILE_READ
,
&
pReader
->
pHeadFD
);
if
(
code
)
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
// data
tsdbDataFileName
(
pTsdb
,
pSet
->
diskId
,
pSet
->
fid
,
pSet
->
pDataF
,
fname
);
code
=
tsdbOpenFile
(
fname
,
szPage
,
TD_FILE_READ
,
&
pReader
->
pDataFD
);
if
(
code
)
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
// sma
tsdbSmaFileName
(
pTsdb
,
pSet
->
diskId
,
pSet
->
fid
,
pSet
->
pSmaF
,
fname
);
code
=
tsdbOpenFile
(
fname
,
szPage
,
TD_FILE_READ
,
&
pReader
->
pSmaFD
);
if
(
code
)
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
// stt
for
(
int32_t
iStt
=
0
;
iStt
<
pSet
->
nSttF
;
iStt
++
)
{
tsdbSttFileName
(
pTsdb
,
pSet
->
diskId
,
pSet
->
fid
,
pSet
->
aSttF
[
iStt
],
fname
);
code
=
tsdbOpenFile
(
fname
,
szPage
,
TD_FILE_READ
,
&
pReader
->
aSttFD
[
iStt
]);
if
(
code
)
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
*
ppReader
=
pReader
;
return
code
;
_err:
tsdbError
(
"vgId:%d, tsdb data file reader open failed since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
tstrerror
(
code
));
*
ppReader
=
NULL
;
_exit:
if
(
code
)
{
*
ppReader
=
NULL
;
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
if
(
pReader
)
{
for
(
int32_t
iStt
=
0
;
iStt
<
pSet
->
nSttF
;
iStt
++
)
tsdbCloseFile
(
&
pReader
->
aSttFD
[
iStt
]);
tsdbCloseFile
(
&
pReader
->
pSmaFD
);
tsdbCloseFile
(
&
pReader
->
pDataFD
);
tsdbCloseFile
(
&
pReader
->
pHeadFD
);
taosMemoryFree
(
pReader
);
}
}
else
{
*
ppReader
=
pReader
;
}
return
code
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
浏览文件 @
85276450
...
...
@@ -445,13 +445,14 @@ _err:
int32_t
tsdbSnapReaderOpen
(
STsdb
*
pTsdb
,
int64_t
sver
,
int64_t
ever
,
int8_t
type
,
STsdbSnapReader
**
ppReader
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
STsdbSnapReader
*
pReader
=
NULL
;
// alloc
pReader
=
(
STsdbSnapReader
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pReader
));
if
(
pReader
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
pReader
->
pTsdb
=
pTsdb
;
pReader
->
sver
=
sver
;
...
...
@@ -461,19 +462,19 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, int8_t type
code
=
taosThreadRwlockRdlock
(
&
pTsdb
->
rwLock
);
if
(
code
)
{
code
=
TAOS_SYSTEM_ERROR
(
code
);
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
code
=
tsdbFSRef
(
pTsdb
,
&
pReader
->
fs
);
if
(
code
)
{
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
code
=
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
if
(
code
)
{
code
=
TAOS_SYSTEM_ERROR
(
code
);
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
// data
...
...
@@ -485,43 +486,52 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, int8_t type
pIter
->
aBlockIdx
=
taosArrayInit
(
0
,
sizeof
(
SBlockIdx
));
if
(
pIter
->
aBlockIdx
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
}
else
{
pIter
->
aSttBlk
=
taosArrayInit
(
0
,
sizeof
(
SSttBlk
));
if
(
pIter
->
aSttBlk
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
}
code
=
tBlockDataCreate
(
&
pIter
->
bData
);
if
(
code
)
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
code
=
tBlockDataCreate
(
&
pReader
->
bData
);
if
(
code
)
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
// del
pReader
->
aDelIdx
=
taosArrayInit
(
0
,
sizeof
(
SDelIdx
));
if
(
pReader
->
aDelIdx
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
pReader
->
aDelData
=
taosArrayInit
(
0
,
sizeof
(
SDelData
));
if
(
pReader
->
aDelData
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
tsdbInfo
(
"vgId:%d, vnode snapshot tsdb reader opened for %s"
,
TD_VID
(
pTsdb
->
pVnode
),
pTsdb
->
path
);
*
ppReader
=
pReader
;
return
code
;
_err:
tsdbError
(
"vgId:%d, vnode snapshot tsdb reader open for %s failed since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
pTsdb
->
path
,
tstrerror
(
code
));
*
ppReader
=
NULL
;
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s, TSDB path: %s"
,
TD_VID
(
pTsdb
->
pVnode
),
lino
,
tstrerror
(
code
),
pTsdb
->
path
);
*
ppReader
=
NULL
;
if
(
pReader
)
{
taosArrayDestroy
(
pReader
->
aDelData
);
taosArrayDestroy
(
pReader
->
aDelIdx
);
tBlockDataDestroy
(
&
pReader
->
bData
,
1
);
tsdbFSDestroy
(
&
pReader
->
fs
);
taosMemoryFree
(
pReader
);
}
}
else
{
*
ppReader
=
pReader
;
tsdbInfo
(
"vgId:%d, vnode snapshot tsdb reader opened for %s"
,
TD_VID
(
pTsdb
->
pVnode
),
pTsdb
->
path
);
}
return
code
;
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
85276450
...
...
@@ -43,14 +43,23 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
tDecoderInit
(
&
dc
,
(
uint8_t
*
)
pMsg
->
pCont
+
sizeof
(
SMsgHead
),
pMsg
->
contLen
-
sizeof
(
SMsgHead
));
tStartDecode
(
&
dc
);
tDecodeI32v
(
&
dc
,
&
nReqs
);
if
(
tDecodeI32v
(
&
dc
,
&
nReqs
)
<
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
goto
_err
;
}
for
(
int32_t
iReq
=
0
;
iReq
<
nReqs
;
iReq
++
)
{
tb_uid_t
uid
=
tGenIdPI64
();
char
*
name
=
NULL
;
tStartDecode
(
&
dc
);
tDecodeI32v
(
&
dc
,
NULL
);
tDecodeCStr
(
&
dc
,
&
name
);
if
(
tDecodeI32v
(
&
dc
,
NULL
)
<
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
return
code
;
}
if
(
tDecodeCStr
(
&
dc
,
&
name
)
<
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
return
code
;
}
*
(
int64_t
*
)(
dc
.
data
+
dc
.
pos
)
=
uid
;
*
(
int64_t
*
)(
dc
.
data
+
dc
.
pos
+
8
)
=
ctime
;
...
...
@@ -81,10 +90,19 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
char
*
name
=
NULL
;
tDecoderInit
(
&
dc
,
pBlock
->
data
,
msgIter
.
schemaLen
);
tStartDecode
(
&
dc
);
if
(
tStartDecode
(
&
dc
)
<
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
return
code
;
}
tDecodeI32v
(
&
dc
,
NULL
);
tDecodeCStr
(
&
dc
,
&
name
);
if
(
tDecodeI32v
(
&
dc
,
NULL
)
<
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
return
code
;
}
if
(
tDecodeCStr
(
&
dc
,
&
name
)
<
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
return
code
;
}
uid
=
metaGetTableEntryUidByName
(
pVnode
->
pMeta
,
name
);
if
(
uid
==
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录