Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
09222801
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
09222801
编写于
7月 06, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(coverity): fix coverity scan issues
上级
db63b436
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
48 addition
and
92 deletion
+48
-92
source/common/src/trow.c
source/common/src/trow.c
+1
-1
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+5
-2
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+32
-83
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+5
-5
source/libs/tdb/src/db/tdbDb.c
source/libs/tdb/src/db/tdbDb.c
+4
-1
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+1
-0
未找到文件。
source/common/src/trow.c
浏览文件 @
09222801
...
...
@@ -423,7 +423,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
val
=
(
const
void
*
)
&
pColVal
->
value
.
val
;
}
}
else
{
pColVal
=
NULL
;
//
pColVal = NULL;
valType
=
TD_VTYPE_NONE
;
}
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
09222801
...
...
@@ -207,7 +207,10 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
tb_uid_t
uid
=
*
(
tb_uid_t
*
)
pData
;
tdbFree
(
pData
);
SMetaInfo
info
;
metaGetInfo
(
pMeta
,
uid
,
&
info
,
NULL
);
if
(
metaGetInfo
(
pMeta
,
uid
,
&
info
,
NULL
)
==
TSDB_CODE_NOT_FOUND
)
{
terrno
=
TSDB_CODE_PAR_TABLE_NOT_EXIST
;
return
-
1
;
}
if
(
info
.
uid
==
info
.
suid
)
{
return
0
;
}
else
{
...
...
@@ -939,7 +942,7 @@ int metaTtlDropTable(SMeta *pMeta, int64_t timePointMs, SArray *tbUids) {
return
0
;
}
metaInfo
(
"ttl find expired table count: %zu"
,
TARRAY_SIZE
(
tbUids
));
metaInfo
(
"ttl find expired table count: %zu"
,
TARRAY_SIZE
(
tbUids
));
metaDropTables
(
pMeta
,
tbUids
);
return
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
09222801
...
...
@@ -1031,7 +1031,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
return
code
;
}
/*
int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype) {
int32_t code = 0;
SLRUCache *pCache = pTsdb->lruCache;
...
...
@@ -1079,7 +1079,7 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR
return code;
}
*/
int32_t
tsdbCacheDel
(
STsdb
*
pTsdb
,
tb_uid_t
suid
,
tb_uid_t
uid
,
TSKEY
sKey
,
TSKEY
eKey
)
{
int32_t
code
=
0
;
// fetch schema
...
...
@@ -1829,10 +1829,11 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa
}
*
pIgnoreEarlierTs
=
false
;
/*
if (!hasVal) {
state->state = SFSLASTNEXTROW_FILESET;
}
*/
if
(
!
state
->
checkRemainingRow
)
{
state
->
checkRemainingRow
=
true
;
}
...
...
@@ -2020,10 +2021,9 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
tMapDataGetItemByIdx
(
&
state
->
blockMap
,
state
->
iBlock
,
&
block
,
tGetDataBlk
);
if
(
block
.
maxKey
.
ts
<=
state
->
lastTs
)
{
*
pIgnoreEarlierTs
=
true
;
if
(
state
->
pBlockData
)
{
tBlockDataDestroy
(
state
->
pBlockData
);
state
->
pBlockData
=
NULL
;
}
tBlockDataDestroy
(
state
->
pBlockData
);
state
->
pBlockData
=
NULL
;
*
ppRow
=
NULL
;
return
code
;
...
...
@@ -3176,97 +3176,46 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
TSKEY
rowTs
=
TSDBROW_TS
(
pRow
);
if
(
lastRowTs
==
TSKEY_MAX
)
{
lastRowTs
=
rowTs
;
for
(
int16_t
iCol
=
noneCol
;
iCol
<
nCols
;
++
iCol
)
{
if
(
iCol
>=
nLastCol
)
{
break
;
}
SLastCol
*
pCol
=
taosArrayGet
(
pColArray
,
iCol
);
if
(
pCol
->
colVal
.
cid
!=
pTSchema
->
columns
[
slotIds
[
iCol
]].
colId
)
{
continue
;
}
if
(
slotIds
[
iCol
]
==
0
)
{
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
0
];
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
rowTs
});
taosArraySet
(
pColArray
,
0
,
&
(
SLastCol
){.
ts
=
rowTs
,
.
colVal
=
*
pColVal
});
continue
;
}
tsdbRowGetColVal
(
pRow
,
pTSchema
,
slotIds
[
iCol
],
pColVal
);
*
pCol
=
(
SLastCol
){.
ts
=
rowTs
,
.
colVal
=
*
pColVal
};
if
(
IS_VAR_DATA_TYPE
(
pColVal
->
type
)
/*&& pColVal->value.nData > 0*/
)
{
pCol
->
colVal
.
value
.
pData
=
taosMemoryMalloc
(
pCol
->
colVal
.
value
.
nData
);
if
(
pCol
->
colVal
.
value
.
pData
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
if
(
pColVal
->
value
.
nData
>
0
)
{
memcpy
(
pCol
->
colVal
.
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
}
}
/*if (COL_VAL_IS_NONE(pColVal)) {
if (!setNoneCol) {
noneCol = iCol;
setNoneCol = true;
}
} else {*/
int32_t
aColIndex
=
taosArraySearchIdx
(
aColArray
,
&
pColVal
->
cid
,
compareInt16Val
,
TD_EQ
);
if
(
aColIndex
>=
0
)
{
taosArrayRemove
(
aColArray
,
aColIndex
);
}
//}
}
if
(
!
setNoneCol
)
{
// done, goto return pColArray
break
;
}
else
{
continue
;
}
}
lastRowTs
=
rowTs
;
// merge into pColArray
setNoneCol
=
false
;
for
(
int16_t
iCol
=
noneCol
;
iCol
<
nCols
;
++
iCol
)
{
if
(
iCol
>=
nLastCol
)
{
break
;
}
// high version's column value
SLastCol
*
lastColVal
=
(
SLastCol
*
)
taosArrayGet
(
pColArray
,
iCol
);
if
(
lastColVal
->
colVal
.
cid
!=
pTSchema
->
columns
[
slotIds
[
iCol
]].
colId
)
{
SLastCol
*
pCol
=
taosArrayGet
(
pColArray
,
iCol
);
if
(
pCol
->
colVal
.
cid
!=
pTSchema
->
columns
[
slotIds
[
iCol
]].
colId
)
{
continue
;
}
SColVal
*
tColVal
=
&
lastColVal
->
colVal
;
if
(
slotIds
[
iCol
]
==
0
)
{
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
0
];
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
rowTs
});
taosArraySet
(
pColArray
,
0
,
&
(
SLastCol
){.
ts
=
rowTs
,
.
colVal
=
*
pColVal
});
continue
;
}
tsdbRowGetColVal
(
pRow
,
pTSchema
,
slotIds
[
iCol
],
pColVal
);
if
(
COL_VAL_IS_NONE
(
tColVal
)
&&
!
COL_VAL_IS_NONE
(
pColVal
))
{
SLastCol
lastCol
=
{.
ts
=
rowTs
,
.
colVal
=
*
pColVal
};
if
(
IS_VAR_DATA_TYPE
(
pColVal
->
type
)
&&
pColVal
->
value
.
nData
>
0
)
{
SLastCol
*
pLastCol
=
(
SLastCol
*
)
taosArrayGet
(
pColArray
,
iCol
);
taosMemoryFree
(
pLastCol
->
colVal
.
value
.
pData
);
lastCol
.
colVal
.
value
.
pData
=
taosMemoryMalloc
(
lastCol
.
colVal
.
value
.
nData
);
if
(
lastCol
.
colVal
.
value
.
pData
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
memcpy
(
lastCol
.
colVal
.
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
*
pCol
=
(
SLastCol
){.
ts
=
rowTs
,
.
colVal
=
*
pColVal
};
if
(
IS_VAR_DATA_TYPE
(
pColVal
->
type
)
/*&& pColVal->value.nData > 0*/
)
{
pCol
->
colVal
.
value
.
pData
=
taosMemoryMalloc
(
pCol
->
colVal
.
value
.
nData
);
if
(
pCol
->
colVal
.
value
.
pData
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
if
(
pColVal
->
value
.
nData
>
0
)
{
memcpy
(
pCol
->
colVal
.
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
}
}
taosArraySet
(
pColArray
,
iCol
,
&
lastCol
);
int32_t
aColIndex
=
taosArraySearchIdx
(
aColArray
,
&
lastCol
.
colVal
.
cid
,
compareInt16Val
,
TD_EQ
);
int32_t
aColIndex
=
taosArraySearchIdx
(
aColArray
,
&
pColVal
->
cid
,
compareInt16Val
,
TD_EQ
);
if
(
aColIndex
>=
0
)
{
taosArrayRemove
(
aColArray
,
aColIndex
);
}
else
if
(
COL_VAL_IS_NONE
(
tColVal
)
&&
!
COL_VAL_IS_NONE
(
pColVal
)
&&
!
setNoneCol
)
{
noneCol
=
iCol
;
setNoneCol
=
true
;
}
}
}
while
(
setNoneCol
);
break
;
}
while
(
1
);
if
(
!
hasRow
)
{
if
(
ignoreEarlierTs
)
{
...
...
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
09222801
...
...
@@ -345,7 +345,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL
}
*
ppKey
=
pTKey
;
*
pkLen
=
cd
.
kLen
;
memcpy
(
*
ppKey
,
cd
.
pKey
,
cd
.
kLen
);
memcpy
(
*
ppKey
,
cd
.
pKey
,
(
size_t
)
cd
.
kLen
);
}
if
(
ppVal
)
{
...
...
@@ -357,7 +357,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL
}
*
ppVal
=
pTVal
;
*
vLen
=
cd
.
vLen
;
memcpy
(
*
ppVal
,
cd
.
pVal
,
cd
.
vLen
);
memcpy
(
*
ppVal
,
cd
.
pVal
,
(
size_t
)
cd
.
vLen
);
}
if
(
TDB_CELLDECODER_FREE_KEY
(
&
cd
))
{
...
...
@@ -1793,7 +1793,7 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) {
*
ppKey
=
pKey
;
*
kLen
=
cd
.
kLen
;
memcpy
(
pKey
,
cd
.
pKey
,
cd
.
kLen
);
memcpy
(
pKey
,
cd
.
pKey
,
(
size_t
)
cd
.
kLen
);
if
(
ppVal
)
{
if
(
cd
.
vLen
>
0
)
{
...
...
@@ -1852,7 +1852,7 @@ int tdbBtreePrev(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) {
*
ppKey
=
pKey
;
*
kLen
=
cd
.
kLen
;
memcpy
(
pKey
,
cd
.
pKey
,
cd
.
kLen
);
memcpy
(
pKey
,
cd
.
pKey
,
(
size_t
)
cd
.
kLen
);
if
(
ppVal
)
{
// TODO: vLen may be zero
...
...
@@ -1864,7 +1864,7 @@ int tdbBtreePrev(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) {
*
ppVal
=
pVal
;
*
vLen
=
cd
.
vLen
;
memcpy
(
pVal
,
cd
.
pVal
,
cd
.
vLen
);
memcpy
(
pVal
,
cd
.
pVal
,
(
size_t
)
cd
.
vLen
);
}
ret
=
tdbBtcMoveToPrev
(
pBtc
);
...
...
source/libs/tdb/src/db/tdbDb.c
浏览文件 @
09222801
...
...
@@ -62,7 +62,10 @@ int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb, i
}
memset
(
pDb
->
pgrHash
,
0
,
tsize
);
taosMulModeMkDir
(
dbname
,
0755
);
ret
=
taosMulModeMkDir
(
dbname
,
0755
);
if
(
ret
<
0
)
{
return
-
1
;
}
#ifdef USE_MAINDB
// open main db
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
09222801
...
...
@@ -980,6 +980,7 @@ int tdbPagerRestoreJournals(SPager *pPager) {
jname
[
dirLen
]
=
'/'
;
sprintf
(
jname
+
dirLen
+
1
,
TDB_MAINDB_NAME
"-journal.%"
PRId64
,
*
pTxnId
);
if
(
tdbPagerRestore
(
pPager
,
jname
)
<
0
)
{
taosArrayDestroy
(
pTxnList
);
tdbCloseDir
(
&
pDir
);
tdbError
(
"failed to restore file due to %s. jFileName:%s"
,
strerror
(
errno
),
jname
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录