Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
82067f3b
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,发现更多精彩内容 >>
提交
82067f3b
编写于
2月 22, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix coverity issues.
上级
61a70012
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
33 deletion
+38
-33
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+31
-31
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+6
-1
source/util/src/tutil.c
source/util/src/tutil.c
+1
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
82067f3b
...
@@ -220,6 +220,8 @@ static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFil
...
@@ -220,6 +220,8 @@ static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFil
static
void
initBlockDumpInfo
(
STsdbReader
*
pReader
,
SDataBlockIter
*
pBlockIter
);
static
void
initBlockDumpInfo
(
STsdbReader
*
pReader
,
SDataBlockIter
*
pBlockIter
);
static
int32_t
getInitialDelIndex
(
const
SArray
*
pDelSkyline
,
int32_t
order
);
static
int32_t
getInitialDelIndex
(
const
SArray
*
pDelSkyline
,
int32_t
order
);
static
STableBlockScanInfo
*
getTableBlockScanInfo
(
SHashObj
*
pTableMap
,
uint64_t
uid
,
const
char
*
id
);
static
FORCE_INLINE
STSchema
*
getLatestTableSchema
(
STsdbReader
*
pReader
,
uint64_t
uid
);
static
FORCE_INLINE
STSchema
*
getLatestTableSchema
(
STsdbReader
*
pReader
,
uint64_t
uid
);
static
bool
outOfTimeWindow
(
int64_t
ts
,
STimeWindow
*
pWindow
)
{
return
(
ts
>
pWindow
->
ekey
)
||
(
ts
<
pWindow
->
skey
);
}
static
bool
outOfTimeWindow
(
int64_t
ts
,
STimeWindow
*
pWindow
)
{
return
(
ts
>
pWindow
->
ekey
)
||
(
ts
<
pWindow
->
skey
);
}
...
@@ -699,13 +701,11 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader,
...
@@ -699,13 +701,11 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader,
if
(
pBlockIdx
->
uid
==
pList
->
tableUidList
[
j
])
{
if
(
pBlockIdx
->
uid
==
pList
->
tableUidList
[
j
])
{
// this block belongs to a table that is not queried.
// this block belongs to a table that is not queried.
void
*
p
=
taosHashGet
(
pReader
->
status
.
pTableMap
,
&
pBlockIdx
->
uid
,
sizeof
(
uint64_t
));
STableBlockScanInfo
*
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
pBlockIdx
->
uid
,
pReader
->
idStr
);
if
(
p
==
NULL
)
{
if
(
pScanInfo
==
NULL
)
{
tsdbError
(
"failed to locate the tableBlockScan Info in hashmap, uid:%"
PRIu64
", %s"
,
pBlockIdx
->
uid
,
pReader
->
idStr
);
return
terrno
;
return
TSDB_CODE_APP_ERROR
;
}
}
STableBlockScanInfo
*
pScanInfo
=
*
(
STableBlockScanInfo
**
)
p
;
if
(
pScanInfo
->
pBlockList
==
NULL
)
{
if
(
pScanInfo
->
pBlockList
==
NULL
)
{
pScanInfo
->
pBlockList
=
taosArrayInit
(
4
,
sizeof
(
SBlockIndex
));
pScanInfo
->
pBlockList
=
taosArrayInit
(
4
,
sizeof
(
SBlockIndex
));
}
}
...
@@ -753,9 +753,10 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
...
@@ -753,9 +753,10 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
SBlockIdx
*
pBlockIdx
=
taosArrayGet
(
pIndexList
,
i
);
SBlockIdx
*
pBlockIdx
=
taosArrayGet
(
pIndexList
,
i
);
STableBlockScanInfo
*
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
pBlockIdx
->
uid
,
pReader
->
idStr
);
STableBlockScanInfo
*
pScanInfo
=
if
(
pScanInfo
==
NULL
)
{
*
(
STableBlockScanInfo
**
)
taosHashGet
(
pReader
->
status
.
pTableMap
,
&
pBlockIdx
->
uid
,
sizeof
(
int64_t
));
return
terrno
;
}
tMapDataReset
(
&
pScanInfo
->
mapData
);
tMapDataReset
(
&
pScanInfo
->
mapData
);
tsdbReadDataBlk
(
pReader
->
pFileReader
,
pBlockIdx
,
&
pScanInfo
->
mapData
);
tsdbReadDataBlk
(
pReader
->
pFileReader
,
pBlockIdx
,
&
pScanInfo
->
mapData
);
...
@@ -1257,14 +1258,13 @@ static int32_t fileDataBlockOrderCompar(const void* pLeft, const void* pRight, v
...
@@ -1257,14 +1258,13 @@ static int32_t fileDataBlockOrderCompar(const void* pLeft, const void* pRight, v
static
int32_t
doSetCurrentBlock
(
SDataBlockIter
*
pBlockIter
,
const
char
*
idStr
)
{
static
int32_t
doSetCurrentBlock
(
SDataBlockIter
*
pBlockIter
,
const
char
*
idStr
)
{
SFileDataBlockInfo
*
pBlockInfo
=
getCurrentBlockInfo
(
pBlockIter
);
SFileDataBlockInfo
*
pBlockInfo
=
getCurrentBlockInfo
(
pBlockIter
);
if
(
pBlockInfo
!=
NULL
)
{
if
(
pBlockInfo
!=
NULL
)
{
STableBlockScanInfo
*
*
pScanInfo
=
taosHashGet
(
pBlockIter
->
pTableMap
,
&
pBlockInfo
->
uid
,
sizeof
(
pBlockInfo
->
uid
)
);
STableBlockScanInfo
*
pScanInfo
=
getTableBlockScanInfo
(
pBlockIter
->
pTableMap
,
pBlockInfo
->
uid
,
idStr
);
if
(
pScanInfo
==
NULL
)
{
if
(
pScanInfo
==
NULL
)
{
tsdbError
(
"failed to locate the uid:%"
PRIu64
" in query table uid list, %s"
,
pBlockInfo
->
uid
,
idStr
);
return
terrno
;
return
TSDB_CODE_INVALID_PARA
;
}
}
SBlockIndex
*
pIndex
=
taosArrayGet
(
(
*
pScanInfo
)
->
pBlockList
,
pBlockInfo
->
tbBlockIdx
);
SBlockIndex
*
pIndex
=
taosArrayGet
(
pScanInfo
->
pBlockList
,
pBlockInfo
->
tbBlockIdx
);
tMapDataGetItemByIdx
(
&
(
*
pScanInfo
)
->
mapData
,
pIndex
->
ordinalIndex
,
&
pBlockIter
->
block
,
tGetDataBlk
);
tMapDataGetItemByIdx
(
&
pScanInfo
->
mapData
,
pIndex
->
ordinalIndex
,
&
pBlockIter
->
block
,
tGetDataBlk
);
}
}
#if 0
#if 0
...
@@ -2507,16 +2507,11 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
...
@@ -2507,16 +2507,11 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
STableBlockScanInfo
*
pBlockScanInfo
=
NULL
;
STableBlockScanInfo
*
pBlockScanInfo
=
NULL
;
if
(
pBlockInfo
!=
NULL
)
{
if
(
pBlockInfo
!=
NULL
)
{
void
*
p
=
taosHashGet
(
pReader
->
status
.
pTableMap
,
&
pBlockInfo
->
uid
,
sizeof
(
pBlockInfo
->
uid
));
pBlockScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
pBlockInfo
->
uid
,
pReader
->
idStr
);
if
(
p
==
NULL
)
{
if
(
pBlockScanInfo
==
NULL
)
{
code
=
TSDB_CODE_INVALID_PARA
;
tsdbError
(
"failed to locate the uid:%"
PRIu64
" in query table uid list, total tables:%d, %s"
,
pBlockInfo
->
uid
,
taosHashGetSize
(
pReader
->
status
.
pTableMap
),
pReader
->
idStr
);
goto
_end
;
goto
_end
;
}
}
pBlockScanInfo
=
*
(
STableBlockScanInfo
**
)
p
;
SDataBlk
*
pBlock
=
getCurrentBlock
(
&
pReader
->
status
.
blockIter
);
SDataBlk
*
pBlock
=
getCurrentBlock
(
&
pReader
->
status
.
blockIter
);
TSDBKEY
keyInBuf
=
getCurrentKeyInBuf
(
pBlockScanInfo
,
pReader
);
TSDBKEY
keyInBuf
=
getCurrentKeyInBuf
(
pBlockScanInfo
,
pReader
);
...
@@ -2856,12 +2851,9 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
...
@@ -2856,12 +2851,9 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
SLastBlockReader
*
pLastBlockReader
=
pReader
->
status
.
fileIter
.
pLastBlockReader
;
SLastBlockReader
*
pLastBlockReader
=
pReader
->
status
.
fileIter
.
pLastBlockReader
;
ASSERT
(
pBlockInfo
!=
NULL
);
ASSERT
(
pBlockInfo
!=
NULL
);
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
pBlockInfo
->
uid
,
pReader
->
idStr
);
pScanInfo
=
*
(
STableBlockScanInfo
**
)
taosHashGet
(
pReader
->
status
.
pTableMap
,
&
pBlockInfo
->
uid
,
sizeof
(
pBlockInfo
->
uid
));
if
(
pScanInfo
==
NULL
)
{
if
(
pScanInfo
==
NULL
)
{
tsdbError
(
"failed to get table scan-info, %s"
,
pReader
->
idStr
);
return
terrno
;
code
=
TSDB_CODE_INVALID_PARA
;
return
code
;
}
}
pBlock
=
getCurrentBlock
(
pBlockIter
);
pBlock
=
getCurrentBlock
(
pBlockIter
);
...
@@ -4202,7 +4194,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
...
@@ -4202,7 +4194,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
SSDataBlock
*
pResBlock
=
pReader
->
pResBlock
;
SSDataBlock
*
pResBlock
=
pReader
->
pResBlock
;
if
(
pResBlock
->
pBlockAgg
==
NULL
)
{
if
(
pResBlock
->
pBlockAgg
==
NULL
)
{
size_t
num
=
taosArrayGetSize
(
pResBlock
->
pDataBlock
);
size_t
num
=
taosArrayGetSize
(
pResBlock
->
pDataBlock
);
pResBlock
->
pBlockAgg
=
taosMemoryCalloc
(
num
,
sizeof
(
SColumnDataAgg
)
);
pResBlock
->
pBlockAgg
=
taosMemoryCalloc
(
num
,
POINTER_BYTES
);
}
}
// do fill all null column value SMA info
// do fill all null column value SMA info
...
@@ -4232,6 +4224,18 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
...
@@ -4232,6 +4224,18 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
return
code
;
return
code
;
}
}
STableBlockScanInfo
*
getTableBlockScanInfo
(
SHashObj
*
pTableMap
,
uint64_t
uid
,
const
char
*
id
)
{
STableBlockScanInfo
**
p
=
taosHashGet
(
pTableMap
,
&
uid
,
sizeof
(
uid
));
if
(
p
==
NULL
||
*
p
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_PARA
;
int32_t
size
=
taosHashGetSize
(
pTableMap
);
tsdbError
(
"failed to locate the uid:%"
PRIu64
" in query table uid list, total tables:%d, %s"
,
uid
,
size
,
id
);
return
NULL
;
}
return
*
p
;
}
static
SSDataBlock
*
doRetrieveDataBlock
(
STsdbReader
*
pReader
)
{
static
SSDataBlock
*
doRetrieveDataBlock
(
STsdbReader
*
pReader
)
{
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
...
@@ -4240,12 +4244,8 @@ static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
...
@@ -4240,12 +4244,8 @@ static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
}
}
SFileDataBlockInfo
*
pBlockInfo
=
getCurrentBlockInfo
(
&
pStatus
->
blockIter
);
SFileDataBlockInfo
*
pBlockInfo
=
getCurrentBlockInfo
(
&
pStatus
->
blockIter
);
STableBlockScanInfo
*
pBlockScanInfo
=
STableBlockScanInfo
*
pBlockScanInfo
=
getTableBlockScanInfo
(
pStatus
->
pTableMap
,
pBlockInfo
->
uid
,
pReader
->
idStr
);
*
(
STableBlockScanInfo
**
)
taosHashGet
(
pStatus
->
pTableMap
,
&
pBlockInfo
->
uid
,
sizeof
(
pBlockInfo
->
uid
));
if
(
pBlockScanInfo
==
NULL
)
{
if
(
pBlockScanInfo
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_PARA
;
tsdbError
(
"failed to locate the uid:%"
PRIu64
" in query table uid list, total tables:%d, %s"
,
pBlockInfo
->
uid
,
taosHashGetSize
(
pReader
->
status
.
pTableMap
),
pReader
->
idStr
);
return
NULL
;
return
NULL
;
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
82067f3b
...
@@ -2022,7 +2022,12 @@ int32_t extractTableSchemaInfo(SReadHandle* pHandle, SScanPhysiNode* pScanNode,
...
@@ -2022,7 +2022,12 @@ int32_t extractTableSchemaInfo(SReadHandle* pHandle, SScanPhysiNode* pScanNode,
tDecoderClear
(
&
mr
.
coder
);
tDecoderClear
(
&
mr
.
coder
);
tb_uid_t
suid
=
mr
.
me
.
ctbEntry
.
suid
;
tb_uid_t
suid
=
mr
.
me
.
ctbEntry
.
suid
;
metaGetTableEntryByUidCache
(
&
mr
,
suid
);
code
=
metaGetTableEntryByUidCache
(
&
mr
,
suid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
metaReaderClear
(
&
mr
);
return
terrno
;
}
pSchemaInfo
->
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
pSchemaInfo
->
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
pSchemaInfo
->
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
pSchemaInfo
->
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
}
else
{
}
else
{
...
...
source/util/src/tutil.c
浏览文件 @
82067f3b
...
@@ -118,7 +118,7 @@ char **strsplit(char *z, const char *delim, int32_t *num) {
...
@@ -118,7 +118,7 @@ char **strsplit(char *z, const char *delim, int32_t *num) {
if
((
*
num
)
>=
size
)
{
if
((
*
num
)
>=
size
)
{
size
=
(
size
<<
1
);
size
=
(
size
<<
1
);
split
=
taosMemoryRealloc
(
split
,
POINTER_BYTES
*
size
);
split
=
taosMemoryRealloc
(
split
,
POINTER_BYTES
*
size
);
ASSERTS
(
NULL
!=
split
,
"realloc memory failed. size=%d"
,
POINTER_BYTES
*
size
);
ASSERTS
(
NULL
!=
split
,
"realloc memory failed. size=%d"
,
(
int32_t
)
POINTER_BYTES
*
size
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录