Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
38a8cb7a
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看板
未验证
提交
38a8cb7a
编写于
3月 22, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
3月 22, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5520 from taosdata/hotfix/TD-3298
[TD-3298]<hotfix>: fix coverity scan error
上级
835886d1
e11f0585
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
24 addition
and
25 deletion
+24
-25
src/tfs/src/tdisk.c
src/tfs/src/tdisk.c
+1
-1
src/tfs/src/tfs.c
src/tfs/src/tfs.c
+6
-6
src/tsdb/inc/tsdbFile.h
src/tsdb/inc/tsdbFile.h
+1
-1
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+7
-7
src/tsdb/src/tsdbFS.c
src/tsdb/src/tsdbFS.c
+7
-7
src/tsdb/src/tsdbFile.c
src/tsdb/src/tsdbFile.c
+1
-1
src/tsdb/src/tsdbReadImpl.c
src/tsdb/src/tsdbReadImpl.c
+1
-1
src/util/inc/tchecksum.h
src/util/inc/tchecksum.h
+0
-1
未找到文件。
src/tfs/src/tdisk.c
浏览文件 @
38a8cb7a
...
@@ -27,7 +27,7 @@ SDisk *tfsNewDisk(int level, int id, const char *dir) {
...
@@ -27,7 +27,7 @@ SDisk *tfsNewDisk(int level, int id, const char *dir) {
pDisk
->
level
=
level
;
pDisk
->
level
=
level
;
pDisk
->
id
=
id
;
pDisk
->
id
=
id
;
strncpy
(
pDisk
->
dir
,
dir
,
TSDB_FILENAME_LEN
);
t
strncpy
(
pDisk
->
dir
,
dir
,
TSDB_FILENAME_LEN
);
return
pDisk
;
return
pDisk
;
}
}
...
...
src/tfs/src/tfs.c
浏览文件 @
38a8cb7a
...
@@ -187,7 +187,7 @@ void tfsInitFile(TFILE *pf, int level, int id, const char *bname) {
...
@@ -187,7 +187,7 @@ void tfsInitFile(TFILE *pf, int level, int id, const char *bname) {
pf
->
level
=
level
;
pf
->
level
=
level
;
pf
->
id
=
id
;
pf
->
id
=
id
;
strncpy
(
pf
->
rname
,
bname
,
TSDB_FILENAME_LEN
);
t
strncpy
(
pf
->
rname
,
bname
,
TSDB_FILENAME_LEN
);
char
tmpName
[
TMPNAME_LEN
]
=
{
0
};
char
tmpName
[
TMPNAME_LEN
]
=
{
0
};
snprintf
(
tmpName
,
TMPNAME_LEN
,
"%s/%s"
,
DISK_DIR
(
pDisk
),
bname
);
snprintf
(
tmpName
,
TMPNAME_LEN
,
"%s/%s"
,
DISK_DIR
(
pDisk
),
bname
);
...
@@ -230,15 +230,15 @@ void *tfsDecodeFile(void *buf, TFILE *pf) {
...
@@ -230,15 +230,15 @@ void *tfsDecodeFile(void *buf, TFILE *pf) {
void
tfsbasename
(
const
TFILE
*
pf
,
char
*
dest
)
{
void
tfsbasename
(
const
TFILE
*
pf
,
char
*
dest
)
{
char
tname
[
TSDB_FILENAME_LEN
]
=
"
\0
"
;
char
tname
[
TSDB_FILENAME_LEN
]
=
"
\0
"
;
strncpy
(
tname
,
pf
->
aname
,
TSDB_FILENAME_LEN
);
t
strncpy
(
tname
,
pf
->
aname
,
TSDB_FILENAME_LEN
);
strncpy
(
dest
,
basename
(
tname
),
TSDB_FILENAME_LEN
);
t
strncpy
(
dest
,
basename
(
tname
),
TSDB_FILENAME_LEN
);
}
}
void
tfsdirname
(
const
TFILE
*
pf
,
char
*
dest
)
{
void
tfsdirname
(
const
TFILE
*
pf
,
char
*
dest
)
{
char
tname
[
TSDB_FILENAME_LEN
]
=
"
\0
"
;
char
tname
[
TSDB_FILENAME_LEN
]
=
"
\0
"
;
strncpy
(
tname
,
pf
->
aname
,
TSDB_FILENAME_LEN
);
t
strncpy
(
tname
,
pf
->
aname
,
TSDB_FILENAME_LEN
);
strncpy
(
dest
,
dirname
(
tname
),
TSDB_FILENAME_LEN
);
t
strncpy
(
dest
,
dirname
(
tname
),
TSDB_FILENAME_LEN
);
}
}
// DIR APIs ====================================
// DIR APIs ====================================
...
@@ -344,7 +344,7 @@ TDIR *tfsOpendir(const char *rname) {
...
@@ -344,7 +344,7 @@ TDIR *tfsOpendir(const char *rname) {
}
}
tfsInitDiskIter
(
&
(
tdir
->
iter
));
tfsInitDiskIter
(
&
(
tdir
->
iter
));
strncpy
(
tdir
->
dirname
,
rname
,
TSDB_FILENAME_LEN
);
t
strncpy
(
tdir
->
dirname
,
rname
,
TSDB_FILENAME_LEN
);
if
(
tfsOpendirImpl
(
tdir
)
<
0
)
{
if
(
tfsOpendirImpl
(
tdir
)
<
0
)
{
free
(
tdir
);
free
(
tdir
);
...
...
src/tsdb/inc/tsdbFile.h
浏览文件 @
38a8cb7a
...
@@ -334,7 +334,7 @@ static FORCE_INLINE int tsdbOpenDFileSet(SDFileSet* pSet, int flags) {
...
@@ -334,7 +334,7 @@ static FORCE_INLINE int tsdbOpenDFileSet(SDFileSet* pSet, int flags) {
static
FORCE_INLINE
void
tsdbRemoveDFileSet
(
SDFileSet
*
pSet
)
{
static
FORCE_INLINE
void
tsdbRemoveDFileSet
(
SDFileSet
*
pSet
)
{
for
(
TSDB_FILE_T
ftype
=
0
;
ftype
<
TSDB_FILE_MAX
;
ftype
++
)
{
for
(
TSDB_FILE_T
ftype
=
0
;
ftype
<
TSDB_FILE_MAX
;
ftype
++
)
{
tsdbRemoveDFile
(
TSDB_DFILE_IN_SET
(
pSet
,
ftype
));
(
void
)
tsdbRemoveDFile
(
TSDB_DFILE_IN_SET
(
pSet
,
ftype
));
}
}
}
}
...
...
src/tsdb/src/tsdbCommit.c
浏览文件 @
38a8cb7a
...
@@ -164,7 +164,7 @@ static int tsdbCommitMeta(STsdbRepo *pRepo) {
...
@@ -164,7 +164,7 @@ static int tsdbCommitMeta(STsdbRepo *pRepo) {
tsdbError
(
"vgId:%d failed to update META record, uid %"
PRIu64
" since %s"
,
REPO_ID
(
pRepo
),
pAct
->
uid
,
tsdbError
(
"vgId:%d failed to update META record, uid %"
PRIu64
" since %s"
,
REPO_ID
(
pRepo
),
pAct
->
uid
,
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseMFile
(
&
mf
);
tsdbCloseMFile
(
&
mf
);
tsdbApplyMFileChange
(
&
mf
,
pOMFile
);
(
void
)
tsdbApplyMFileChange
(
&
mf
,
pOMFile
);
// TODO: need to reload metaCache
// TODO: need to reload metaCache
return
-
1
;
return
-
1
;
}
}
...
@@ -304,7 +304,7 @@ static int tsdbCommitTSData(STsdbRepo *pRepo) {
...
@@ -304,7 +304,7 @@ static int tsdbCommitTSData(STsdbRepo *pRepo) {
SDFileSet
*
pSet
=
NULL
;
SDFileSet
*
pSet
=
NULL
;
int
fid
;
int
fid
;
memset
(
&
commith
,
0
,
sizeof
(
SMemTable
*
));
memset
(
&
commith
,
0
,
sizeof
(
commith
));
if
(
pMem
->
numOfRows
<=
0
)
{
if
(
pMem
->
numOfRows
<=
0
)
{
// No memory data, just apply retention on each file on disk
// No memory data, just apply retention on each file on disk
...
@@ -399,9 +399,9 @@ static void tsdbEndCommit(STsdbRepo *pRepo, int eno) {
...
@@ -399,9 +399,9 @@ static void tsdbEndCommit(STsdbRepo *pRepo, int eno) {
if
(
pRepo
->
appH
.
notifyStatus
)
pRepo
->
appH
.
notifyStatus
(
pRepo
->
appH
.
appH
,
TSDB_STATUS_COMMIT_OVER
,
eno
);
if
(
pRepo
->
appH
.
notifyStatus
)
pRepo
->
appH
.
notifyStatus
(
pRepo
->
appH
.
appH
,
TSDB_STATUS_COMMIT_OVER
,
eno
);
SMemTable
*
pIMem
=
pRepo
->
imem
;
SMemTable
*
pIMem
=
pRepo
->
imem
;
tsdbLockRepo
(
pRepo
);
(
void
)
tsdbLockRepo
(
pRepo
);
pRepo
->
imem
=
NULL
;
pRepo
->
imem
=
NULL
;
tsdbUnlockRepo
(
pRepo
);
(
void
)
tsdbUnlockRepo
(
pRepo
);
tsdbUnRefMemTable
(
pRepo
,
pIMem
);
tsdbUnRefMemTable
(
pRepo
,
pIMem
);
tsem_post
(
&
(
pRepo
->
readyToCommit
));
tsem_post
(
&
(
pRepo
->
readyToCommit
));
}
}
...
@@ -1136,12 +1136,12 @@ static int tsdbMoveBlock(SCommitH *pCommith, int bidx) {
...
@@ -1136,12 +1136,12 @@ static int tsdbMoveBlock(SCommitH *pCommith, int bidx) {
}
}
static
int
tsdbCommitAddBlock
(
SCommitH
*
pCommith
,
const
SBlock
*
pSupBlock
,
const
SBlock
*
pSubBlocks
,
int
nSubBlocks
)
{
static
int
tsdbCommitAddBlock
(
SCommitH
*
pCommith
,
const
SBlock
*
pSupBlock
,
const
SBlock
*
pSubBlocks
,
int
nSubBlocks
)
{
if
(
taosArrayPush
(
pCommith
->
aSupBlk
,
pSupBlock
)
<
0
)
{
if
(
taosArrayPush
(
pCommith
->
aSupBlk
,
pSupBlock
)
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
if
(
pSubBlocks
&&
taosArrayPushBatch
(
pCommith
->
aSubBlk
,
pSubBlocks
,
nSubBlocks
)
<
0
)
{
if
(
pSubBlocks
&&
taosArrayPushBatch
(
pCommith
->
aSubBlk
,
pSubBlocks
,
nSubBlocks
)
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
...
@@ -1379,7 +1379,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -1379,7 +1379,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
tsdbRemoveDFile
(
pWHeadf
);
(
void
)
tsdbRemoveDFile
(
pWHeadf
);
if
(
pCommith
->
isRFileSet
)
{
if
(
pCommith
->
isRFileSet
)
{
tsdbCloseAndUnsetFSet
(
&
(
pCommith
->
readh
));
tsdbCloseAndUnsetFSet
(
&
(
pCommith
->
readh
));
return
-
1
;
return
-
1
;
...
...
src/tsdb/src/tsdbFS.c
浏览文件 @
38a8cb7a
...
@@ -380,7 +380,7 @@ static int tsdbSaveFSStatus(SFSStatus *pStatus, int vid) {
...
@@ -380,7 +380,7 @@ static int tsdbSaveFSStatus(SFSStatus *pStatus, int vid) {
if
(
taosWrite
(
fd
,
pBuf
,
fsheader
.
len
)
<
fsheader
.
len
)
{
if
(
taosWrite
(
fd
,
pBuf
,
fsheader
.
len
)
<
fsheader
.
len
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
close
(
fd
);
close
(
fd
);
remove
(
tfname
);
(
void
)
remove
(
tfname
);
taosTZfree
(
pBuf
);
taosTZfree
(
pBuf
);
return
-
1
;
return
-
1
;
}
}
...
@@ -413,7 +413,7 @@ static void tsdbApplyFSTxnOnDisk(SFSStatus *pFrom, SFSStatus *pTo) {
...
@@ -413,7 +413,7 @@ static void tsdbApplyFSTxnOnDisk(SFSStatus *pFrom, SFSStatus *pTo) {
sizeTo
=
taosArrayGetSize
(
pTo
->
df
);
sizeTo
=
taosArrayGetSize
(
pTo
->
df
);
// Apply meta file change
// Apply meta file change
tsdbApplyMFileChange
(
pFrom
->
pmf
,
pTo
->
pmf
);
(
void
)
tsdbApplyMFileChange
(
pFrom
->
pmf
,
pTo
->
pmf
);
// Apply SDFileSet change
// Apply SDFileSet change
if
(
ifrom
>=
sizeFrom
)
{
if
(
ifrom
>=
sizeFrom
)
{
...
@@ -853,7 +853,7 @@ static int tsdbScanRootDir(STsdbRepo *pRepo) {
...
@@ -853,7 +853,7 @@ static int tsdbScanRootDir(STsdbRepo *pRepo) {
continue
;
continue
;
}
}
tfsremove
(
pf
);
(
void
)
tfsremove
(
pf
);
tsdbDebug
(
"vgId:%d invalid file %s is removed"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
tsdbDebug
(
"vgId:%d invalid file %s is removed"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
}
}
...
@@ -879,7 +879,7 @@ static int tsdbScanDataDir(STsdbRepo *pRepo) {
...
@@ -879,7 +879,7 @@ static int tsdbScanDataDir(STsdbRepo *pRepo) {
tfsbasename
(
pf
,
bname
);
tfsbasename
(
pf
,
bname
);
if
(
!
tsdbIsTFileInFS
(
pfs
,
pf
))
{
if
(
!
tsdbIsTFileInFS
(
pfs
,
pf
))
{
tfsremove
(
pf
);
(
void
)
tfsremove
(
pf
);
tsdbDebug
(
"vgId:%d invalid file %s is removed"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
tsdbDebug
(
"vgId:%d invalid file %s is removed"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
}
}
}
}
...
@@ -939,7 +939,7 @@ static int tsdbRestoreMeta(STsdbRepo *pRepo) {
...
@@ -939,7 +939,7 @@ static int tsdbRestoreMeta(STsdbRepo *pRepo) {
if
(
strcmp
(
bname
,
tsdbTxnFname
[
TSDB_TXN_TEMP_FILE
])
==
0
)
{
if
(
strcmp
(
bname
,
tsdbTxnFname
[
TSDB_TXN_TEMP_FILE
])
==
0
)
{
// Skip current.t file
// Skip current.t file
tsdbInfo
(
"vgId:%d file %s exists, remove it"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
tsdbInfo
(
"vgId:%d file %s exists, remove it"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
tfsremove
(
pf
);
(
void
)
tfsremove
(
pf
);
continue
;
continue
;
}
}
...
@@ -1045,7 +1045,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
...
@@ -1045,7 +1045,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
int
code
=
regexec
(
&
regex
,
bname
,
0
,
NULL
,
0
);
int
code
=
regexec
(
&
regex
,
bname
,
0
,
NULL
,
0
);
if
(
code
==
0
)
{
if
(
code
==
0
)
{
if
(
taosArrayPush
(
fArray
,
(
void
*
)
pf
)
<
0
)
{
if
(
taosArrayPush
(
fArray
,
(
void
*
)
pf
)
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
tfsClosedir
(
tdir
);
tfsClosedir
(
tdir
);
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
...
@@ -1055,7 +1055,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
...
@@ -1055,7 +1055,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
}
else
if
(
code
==
REG_NOMATCH
)
{
}
else
if
(
code
==
REG_NOMATCH
)
{
// Not match
// Not match
tsdbInfo
(
"vgId:%d invalid file %s exists, remove it"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
tsdbInfo
(
"vgId:%d invalid file %s exists, remove it"
,
REPO_ID
(
pRepo
),
TFILE_NAME
(
pf
));
tfsremove
(
pf
);
(
void
)
tfsremove
(
pf
);
continue
;
continue
;
}
else
{
}
else
{
// Has other error
// Has other error
...
...
src/tsdb/src/tsdbFile.c
浏览文件 @
38a8cb7a
...
@@ -523,7 +523,7 @@ static int tsdbApplyDFileChange(SDFile *from, SDFile *to) {
...
@@ -523,7 +523,7 @@ static int tsdbApplyDFileChange(SDFile *from, SDFile *to) {
tsdbRollBackDFile
(
to
);
tsdbRollBackDFile
(
to
);
}
}
}
else
{
}
else
{
tsdbRemoveDFile
(
from
);
(
void
)
tsdbRemoveDFile
(
from
);
}
}
}
}
}
}
...
...
src/tsdb/src/tsdbReadImpl.c
浏览文件 @
38a8cb7a
...
@@ -139,7 +139,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
...
@@ -139,7 +139,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
ptr
=
tsdbDecodeSBlockIdx
(
ptr
,
&
blkIdx
);
ptr
=
tsdbDecodeSBlockIdx
(
ptr
,
&
blkIdx
);
ASSERT
(
ptr
!=
NULL
);
ASSERT
(
ptr
!=
NULL
);
if
(
taosArrayPush
(
pReadh
->
aBlkIdx
,
(
void
*
)(
&
blkIdx
))
<
0
)
{
if
(
taosArrayPush
(
pReadh
->
aBlkIdx
,
(
void
*
)(
&
blkIdx
))
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
...
...
src/util/inc/tchecksum.h
浏览文件 @
38a8cb7a
...
@@ -47,7 +47,6 @@ static FORCE_INLINE int taosCalcChecksumAppend(TSCKSUM csi, uint8_t *stream, uin
...
@@ -47,7 +47,6 @@ static FORCE_INLINE int taosCalcChecksumAppend(TSCKSUM csi, uint8_t *stream, uin
}
}
static
FORCE_INLINE
int
taosCheckChecksum
(
const
uint8_t
*
stream
,
uint32_t
ssize
,
TSCKSUM
checksum
)
{
static
FORCE_INLINE
int
taosCheckChecksum
(
const
uint8_t
*
stream
,
uint32_t
ssize
,
TSCKSUM
checksum
)
{
if
(
ssize
<
0
)
return
0
;
return
(
checksum
==
(
*
crc32c
)(
0
,
stream
,
(
size_t
)
ssize
));
return
(
checksum
==
(
*
crc32c
)(
0
,
stream
,
(
size_t
)
ssize
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录