Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5c66712b
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5c66712b
编写于
10月 17, 2022
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: coverity issues
上级
08397dc6
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
30 addition
and
14 deletion
+30
-14
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+1
-1
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+4
-3
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+1
-0
source/libs/tdb/src/db/tdbPCache.c
source/libs/tdb/src/db/tdbPCache.c
+4
-3
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+15
-6
source/libs/tdb/src/db/tdbTable.c
source/libs/tdb/src/db/tdbTable.c
+2
-0
source/libs/tdb/src/inc/tdbOs.h
source/libs/tdb/src/inc/tdbOs.h
+3
-1
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
5c66712b
...
...
@@ -675,7 +675,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
SSchemaWrapper
*
pSchemaWrapper
=
&
schema
;
tDecoderInit
(
&
dc
,
pData
,
nData
);
tDecodeSSchemaWrapper
(
&
dc
,
pSchemaWrapper
);
(
void
)
tDecodeSSchemaWrapper
(
&
dc
,
pSchemaWrapper
);
tDecoderClear
(
&
dc
);
tdbFree
(
pData
);
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
5c66712b
...
...
@@ -944,6 +944,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
metaUpdateTagIdx
(
pMeta
,
&
ctbEntry
);
}
ASSERT
(
ctbEntry
.
ctbEntry
.
pTags
);
SCtbIdxKey
ctbIdxKey
=
{.
suid
=
ctbEntry
.
ctbEntry
.
suid
,
.
uid
=
uid
};
tdbTbUpsert
(
pMeta
->
pCtbIdx
,
&
ctbIdxKey
,
sizeof
(
ctbIdxKey
),
ctbEntry
.
ctbEntry
.
pTags
,
((
STag
*
)(
ctbEntry
.
ctbEntry
.
pTags
))
->
len
,
&
pMeta
->
txn
);
...
...
@@ -952,7 +953,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
tDecoderClear
(
&
dc1
);
tDecoderClear
(
&
dc2
);
if
(
ctbEntry
.
ctbEntry
.
pTags
)
taosMemoryFree
((
void
*
)
ctbEntry
.
ctbEntry
.
pTags
);
taosMemoryFree
((
void
*
)
ctbEntry
.
ctbEntry
.
pTags
);
if
(
ctbEntry
.
pBuf
)
taosMemoryFree
(
ctbEntry
.
pBuf
);
if
(
stbEntry
.
pBuf
)
tdbFree
(
stbEntry
.
pBuf
);
tdbTbcClose
(
pTbDbc
);
...
...
@@ -1202,8 +1203,8 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
SMetaEntry
stbEntry
=
{
0
};
STagIdxKey
*
pTagIdxKey
=
NULL
;
int32_t
nTagIdxKey
;
const
SSchema
*
pTagColumn
;
// = &stbEntry.stbEntry.schema.pSchema[0];
const
void
*
pTagData
=
NULL
;
//
const
SSchema
*
pTagColumn
;
const
void
*
pTagData
=
NULL
;
int32_t
nTagData
=
0
;
SDecoder
dc
=
{
0
};
int32_t
ret
=
0
;
...
...
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
5c66712b
...
...
@@ -1006,6 +1006,7 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const
nLeft
-=
kLen
;
// pack partial val to local if any space left
if
(
nLocal
>
nHeader
+
kLen
+
sizeof
(
SPgno
))
{
ASSERT
(
pVal
!=
NULL
&&
vLen
!=
0
);
memcpy
(
pCell
+
nHeader
+
kLen
,
pVal
,
nLocal
-
nHeader
-
kLen
-
sizeof
(
SPgno
));
nLeft
-=
nLocal
-
nHeader
-
kLen
-
sizeof
(
SPgno
);
}
...
...
source/libs/tdb/src/db/tdbPCache.c
浏览文件 @
5c66712b
...
...
@@ -105,6 +105,7 @@ static int tdbPCacheAlterImpl(SPCache *pCache, int32_t nPage) {
for
(
int32_t
iPage
=
pCache
->
nPages
;
iPage
<
nPage
;
iPage
++
)
{
if
(
tdbPageCreate
(
pCache
->
szPage
,
&
aPage
[
iPage
],
tdbDefaultMalloc
,
NULL
)
<
0
)
{
// TODO: handle error
tdbOsFree
(
pCache
->
aPage
);
return
-
1
;
}
...
...
@@ -267,7 +268,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn)
// 4. Try a create new page
if
(
!
pPage
)
{
ret
=
tdbPageCreate
(
pCache
->
szPage
,
&
pPage
,
pTxn
->
xMalloc
,
pTxn
->
xArg
);
if
(
ret
<
0
)
{
if
(
ret
<
0
&&
pPage
!=
NULL
)
{
// TODO
ASSERT
(
0
);
return
NULL
;
...
...
@@ -300,8 +301,8 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn)
pPage
->
pPager
=
pPageH
->
pPager
;
memcpy
(
pPage
->
pData
,
pPageH
->
pData
,
pPage
->
pageSize
);
tdbDebug
(
"pcache/pPageH: %p %d %p %p %d"
,
pPageH
,
pPageH
->
pPageHdr
-
pPageH
->
pData
,
pPageH
->
xCellSize
,
pPage
,
TDB_PAGE_PGNO
(
pPageH
));
//
tdbDebug("pcache/pPageH: %p %d %p %p %d", pPageH, pPageH->pPageHdr - pPageH->pData, pPageH->xCellSize, pPage,
//
TDB_PAGE_PGNO(pPageH));
tdbPageInit
(
pPage
,
pPageH
->
pPageHdr
-
pPageH
->
pData
,
pPageH
->
xCellSize
);
pPage
->
kLen
=
pPageH
->
kLen
;
pPage
->
vLen
=
pPageH
->
vLen
;
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
5c66712b
...
...
@@ -84,7 +84,8 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
pPager
->
pCache
=
pCache
;
pPager
->
fd
=
tdbOsOpen
(
pPager
->
dbFileName
,
TDB_O_CREAT
|
TDB_O_RDWR
,
0755
);
if
(
pPager
->
fd
<
0
)
{
if
(
TDB_FD_INVALID
(
pPager
->
fd
))
{
// if (pPager->fd < 0) {
return
-
1
;
}
...
...
@@ -226,7 +227,7 @@ int tdbPagerBegin(SPager *pPager, TXN *pTxn) {
// Open the journal
pPager
->
jfd
=
tdbOsOpen
(
pPager
->
jFileName
,
TDB_O_CREAT
|
TDB_O_RDWR
,
0755
);
if
(
pPager
->
jfd
<
0
)
{
if
(
TDB_FD_INVALID
(
pPager
->
jfd
)
)
{
tdbError
(
"failed to open file due to %s. jFileName:%s"
,
strerror
(
errno
),
pPager
->
jFileName
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
...
...
@@ -365,7 +366,7 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
// 4, remove the journal file
tdbOsClose
(
pPager
->
jfd
);
tdbOsRemove
(
pPager
->
jFileName
);
(
void
)
tdbOsRemove
(
pPager
->
jFileName
);
pPager
->
inTran
=
0
;
return
0
;
...
...
@@ -540,7 +541,8 @@ static int tdbPagerWritePageToJournal(SPager *pPager, SPage *pPage) {
ret
=
tdbOsWrite
(
pPager
->
jfd
,
pPage
->
pData
,
pPage
->
pageSize
);
if
(
ret
<
0
)
{
tdbError
(
"failed to write page data due to %s. file:%s, pageSize:%ld"
,
strerror
(
errno
),
pPager
->
jFileName
,
pPage
->
pageSize
);
tdbError
(
"failed to write page data due to %s. file:%s, pageSize:%ld"
,
strerror
(
errno
),
pPager
->
jFileName
,
pPage
->
pageSize
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
...
...
@@ -568,7 +570,8 @@ static int tdbPagerWritePageToDB(SPager *pPager, SPage *pPage) {
ret
=
tdbOsWrite
(
pPager
->
fd
,
pPage
->
pData
,
pPage
->
pageSize
);
if
(
ret
<
0
)
{
tdbError
(
"failed to write page data due to %s. file:%s, pageSize:%ld"
,
strerror
(
errno
),
pPager
->
dbFileName
,
pPage
->
pageSize
);
tdbError
(
"failed to write page data due to %s. file:%s, pageSize:%ld"
,
strerror
(
errno
),
pPager
->
dbFileName
,
pPage
->
pageSize
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
...
...
@@ -603,11 +606,13 @@ int tdbPagerRestore(SPager *pPager, SBTree *pBt) {
int
ret
=
tdbOsRead
(
jfd
,
&
pgno
,
sizeof
(
pgno
));
if
(
ret
<
0
)
{
tdbOsFree
(
pageBuf
);
return
-
1
;
}
ret
=
tdbOsRead
(
jfd
,
pageBuf
,
pPager
->
pageSize
);
if
(
ret
<
0
)
{
tdbOsFree
(
pageBuf
);
return
-
1
;
}
...
...
@@ -615,13 +620,16 @@ int tdbPagerRestore(SPager *pPager, SBTree *pBt) {
if
(
tdbOsLSeek
(
pPager
->
fd
,
offset
,
SEEK_SET
)
<
0
)
{
tdbError
(
"failed to lseek fd due to %s. file:%s, offset:%ld"
,
strerror
(
errno
),
pPager
->
dbFileName
,
offset
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
tdbOsFree
(
pageBuf
);
return
-
1
;
}
ret
=
tdbOsWrite
(
pPager
->
fd
,
pageBuf
,
pPager
->
pageSize
);
if
(
ret
<
0
)
{
tdbError
(
"failed to write buf due to %s. file: %s, bufsize:%d"
,
strerror
(
errno
),
pPager
->
dbFileName
,
pPager
->
pageSize
);
tdbError
(
"failed to write buf due to %s. file: %s, bufsize:%d"
,
strerror
(
errno
),
pPager
->
dbFileName
,
pPager
->
pageSize
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
tdbOsFree
(
pageBuf
);
return
-
1
;
}
}
...
...
@@ -629,6 +637,7 @@ int tdbPagerRestore(SPager *pPager, SBTree *pBt) {
if
(
tdbOsFSync
(
pPager
->
fd
)
<
0
)
{
tdbError
(
"failed to fsync fd due to %s. dbfile:%s"
,
strerror
(
errno
),
pPager
->
dbFileName
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
tdbOsFree
(
pageBuf
);
return
-
1
;
}
...
...
source/libs/tdb/src/db/tdbTable.c
浏览文件 @
5c66712b
...
...
@@ -106,11 +106,13 @@ int tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprF
// pTb->pBt
ret
=
tdbBtreeOpen
(
keyLen
,
valLen
,
pPager
,
tbname
,
pgno
,
keyCmprFn
,
&
(
pTb
->
pBt
));
if
(
ret
<
0
)
{
tdbOsFree
(
pTb
);
return
-
1
;
}
ret
=
tdbPagerRestore
(
pPager
,
pTb
->
pBt
);
if
(
ret
<
0
)
{
tdbOsFree
(
pTb
);
return
-
1
;
}
...
...
source/libs/tdb/src/inc/tdbOs.h
浏览文件 @
5c66712b
...
...
@@ -37,6 +37,8 @@ extern "C" {
/* file */
typedef
TdFilePtr
tdb_fd_t
;
#define TDB_FD_INVALID(fd) (fd == NULL)
#define TDB_O_CREAT TD_FILE_CREATE
#define TDB_O_WRITE TD_FILE_WRITE
#define TDB_O_READ TD_FILE_READ
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录