Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
91d5df42
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
91d5df42
编写于
2月 22, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:error by coverity scan
上级
8a925342
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
49 addition
and
33 deletion
+49
-33
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-2
source/client/src/clientMain.c
source/client/src/clientMain.c
+1
-1
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+3
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+6
-3
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+4
-3
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+1
-1
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+1
-1
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+2
-6
source/dnode/vnode/src/tq/tqMeta.c
source/dnode/vnode/src/tq/tqMeta.c
+11
-3
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+12
-9
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+2
-2
utils/test/c/tmqSim.c
utils/test/c/tmqSim.c
+3
-1
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
91d5df42
...
...
@@ -192,7 +192,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
(
*
pRequest
)
->
sqlLen
=
sqlLen
;
(
*
pRequest
)
->
validateOnly
=
validateSql
;
SSyncQueryParam
*
newpParam
;
SSyncQueryParam
*
newpParam
=
NULL
;
if
(
param
==
NULL
)
{
newpParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncQueryParam
));
if
(
newpParam
==
NULL
)
{
...
...
@@ -1545,7 +1545,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
}
pRequest
->
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
(
SRetrieveTableRsp
*
)
pResInfo
->
pData
,
convertUcs4
,
true
);
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
(
const
SRetrieveTableRsp
*
)
pResInfo
->
pData
,
convertUcs4
,
true
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
pResultInfo
->
numOfRows
=
0
;
return
NULL
;
...
...
source/client/src/clientMain.c
浏览文件 @
91d5df42
...
...
@@ -1016,7 +1016,7 @@ static void fetchCallback(void *pResult, void *param, int32_t code) {
}
pRequest
->
code
=
setQueryResultFromRsp
(
pResultInfo
,
(
SRetrieveTableRsp
*
)
pResultInfo
->
pData
,
pResultInfo
->
convertUcs4
,
true
);
setQueryResultFromRsp
(
pResultInfo
,
(
const
SRetrieveTableRsp
*
)
pResultInfo
->
pData
,
pResultInfo
->
convertUcs4
,
true
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
pResultInfo
->
numOfRows
=
0
;
pRequest
->
code
=
code
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
91d5df42
...
...
@@ -480,6 +480,9 @@ int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) {
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
pRes
,
false
,
true
);
}
if
(
code
!=
0
){
taosMemoryFree
(
pRes
);
}
tFreeSShowVariablesRsp
(
&
rsp
);
}
...
...
source/client/src/clientSml.c
浏览文件 @
91d5df42
...
...
@@ -1154,13 +1154,16 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
SSmlLineInfo
*
elements
=
info
->
lines
+
i
;
SSmlTableInfo
*
tinfo
=
NULL
;
if
(
info
->
protocol
==
TSDB_SML_LINE_PROTOCOL
)
{
tinfo
=
*
(
SSmlTableInfo
**
)
taosHashGet
(
info
->
childTables
,
elements
->
measure
,
elements
->
measureTagsLen
);
SSmlTableInfo
**
tmp
=
(
SSmlTableInfo
**
)
taosHashGet
(
info
->
childTables
,
elements
->
measure
,
elements
->
measureTagsLen
);
if
(
tmp
)
tinfo
=
*
tmp
;
}
else
if
(
info
->
protocol
==
TSDB_SML_TELNET_PROTOCOL
)
{
tinfo
=
*
(
SSmlTableInfo
**
)
taosHashGet
(
info
->
childTables
,
elements
->
measureTag
,
SSmlTableInfo
**
tmp
=
(
SSmlTableInfo
**
)
taosHashGet
(
info
->
childTables
,
elements
->
measureTag
,
elements
->
measureLen
+
elements
->
tagsLen
);
if
(
tmp
)
tinfo
=
*
tmp
;
}
else
{
tinfo
=
*
(
SSmlTableInfo
**
)
taosHashGet
(
info
->
childTables
,
elements
->
measureTag
,
SSmlTableInfo
**
tmp
=
(
SSmlTableInfo
**
)
taosHashGet
(
info
->
childTables
,
elements
->
measureTag
,
elements
->
measureLen
+
elements
->
tagsLen
);
if
(
tmp
)
tinfo
=
*
tmp
;
}
if
(
tinfo
==
NULL
)
{
...
...
source/client/src/clientSmlJson.c
浏览文件 @
91d5df42
...
...
@@ -1279,10 +1279,11 @@ int32_t smlParseJSON(SSmlHandle *info, char *payload) {
if
(
cnt
>=
payloadNum
)
{
payloadNum
=
payloadNum
<<
1
;
void
*
tmp
=
taosMemoryRealloc
(
info
->
lines
,
payloadNum
*
sizeof
(
SSmlLineInfo
));
if
(
tmp
!=
NULL
)
{
info
->
lines
=
(
SSmlLineInfo
*
)
tmp
;
memset
(
info
->
lines
+
cnt
,
0
,
(
payloadNum
-
cnt
)
*
sizeof
(
SSmlLineInfo
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
info
->
lines
=
(
SSmlLineInfo
*
)
tmp
;
memset
(
info
->
lines
+
cnt
,
0
,
(
payloadNum
-
cnt
)
*
sizeof
(
SSmlLineInfo
));
}
ret
=
smlParseJSONString
(
info
,
&
dataPointStart
,
info
->
lines
+
cnt
);
if
((
info
->
lines
+
cnt
)
->
measure
==
NULL
)
break
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
91d5df42
...
...
@@ -674,7 +674,7 @@ SUBSCRIBE_OVER:
taosMemoryFree
(
pConsumerNew
);
}
// TODO: replace with destroy subscribe msg
if
(
subscribe
.
topicNames
)
taosArrayDestroyP
(
subscribe
.
topicNames
,
(
FDelete
)
taosMemoryFree
);
taosArrayDestroyP
(
subscribe
.
topicNames
,
(
FDelete
)
taosMemoryFree
);
return
code
;
}
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
91d5df42
...
...
@@ -115,7 +115,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
if
(
pStream
->
fixedSinkVgId
==
0
)
{
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pStream
->
targetDb
);
if
(
pDb
->
cfg
.
numOfVgroups
>
1
)
{
if
(
pDb
!=
NULL
&&
pDb
->
cfg
.
numOfVgroups
>
1
)
{
isShuffle
=
true
;
pTask
->
outputType
=
TASK_OUTPUT__SHUFFLE_DISPATCH
;
pTask
->
dispatchMsgType
=
TDMT_STREAM_TASK_DISPATCH
;
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
91d5df42
...
...
@@ -134,7 +134,7 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq) {
showObj
.
pMnode
=
pMnode
;
showObj
.
type
=
convertToRetrieveType
(
pReq
->
tb
,
tListLen
(
pReq
->
tb
));
memcpy
(
showObj
.
db
,
pReq
->
db
,
TSDB_DB_FNAME_LEN
);
strncpy
(
showObj
.
filterTb
,
pReq
->
filterTb
,
TSDB_TABLE_NAME_LEN
);
t
strncpy
(
showObj
.
filterTb
,
pReq
->
filterTb
,
TSDB_TABLE_NAME_LEN
);
int32_t
keepTime
=
tsShellActivityTimer
*
6
*
1000
;
SShowObj
*
pShow
=
taosCachePut
(
pMgmt
->
cache
,
&
showId
,
sizeof
(
int64_t
),
&
showObj
,
size
,
keepTime
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
91d5df42
...
...
@@ -1335,12 +1335,8 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
}
}
int32_t
ref
=
atomic_sub_fetch_32
(
pRef
,
1
);
/*A(ref >= 0);*/
if
(
ref
==
0
)
{
blockDataDestroy
(
pDelBlock
);
taosMemoryFree
(
pRef
);
}
blockDataDestroy
(
pDelBlock
);
taosMemoryFree
(
pRef
);
#if 0
SStreamDataBlock* pStreamBlock = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0);
...
...
source/dnode/vnode/src/tq/tqMeta.c
浏览文件 @
91d5df42
...
...
@@ -269,6 +269,7 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) {
}
int32_t
tqMetaRestoreHandle
(
STQ
*
pTq
)
{
int
code
=
0
;
TBC
*
pCur
=
NULL
;
if
(
tdbTbcOpen
(
pTq
->
pExecStore
,
&
pCur
,
NULL
)
<
0
)
{
return
-
1
;
...
...
@@ -290,7 +291,8 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
handle
.
pRef
=
walOpenRef
(
pTq
->
pVnode
->
pWal
);
if
(
handle
.
pRef
==
NULL
)
{
return
-
1
;
code
=
-
1
;
goto
end
;
}
walRefVer
(
handle
.
pRef
,
handle
.
snapshotVer
);
...
...
@@ -307,16 +309,21 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
qCreateQueueExecTaskInfo
(
handle
.
execHandle
.
execCol
.
qmsg
,
&
reader
,
&
handle
.
execHandle
.
numOfCols
,
NULL
);
if
(
handle
.
execHandle
.
task
==
NULL
)
{
tqError
(
"cannot create exec task for %s"
,
handle
.
subKey
);
return
-
1
;
code
=
-
1
;
goto
end
;
}
void
*
scanner
=
NULL
;
qExtractStreamScanner
(
handle
.
execHandle
.
task
,
&
scanner
);
if
(
scanner
==
NULL
)
{
tqError
(
"cannot extract stream scanner for %s"
,
handle
.
subKey
);
code
=
-
1
;
goto
end
;
}
handle
.
execHandle
.
pExecReader
=
qExtractReaderFromStreamScanner
(
scanner
);
if
(
handle
.
execHandle
.
pExecReader
==
NULL
)
{
tqError
(
"cannot extract exec reader for %s"
,
handle
.
subKey
);
code
=
-
1
;
goto
end
;
}
}
else
if
(
handle
.
execHandle
.
subType
==
TOPIC_SUB_TYPE__DB
)
{
handle
.
pWalReader
=
walOpenReader
(
pTq
->
pVnode
->
pWal
,
NULL
);
...
...
@@ -347,8 +354,9 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
taosHashPut
(
pTq
->
pHandle
,
pKey
,
kLen
,
&
handle
,
sizeof
(
STqHandle
));
}
end:
tdbFree
(
pKey
);
tdbFree
(
pVal
);
tdbTbcClose
(
pCur
);
return
0
;
return
code
;
}
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
91d5df42
...
...
@@ -370,11 +370,6 @@ int32_t tqPutReqToQueue(SVnode* pVnode, SVCreateTbBatchReq* pReqs) {
}
return
TSDB_CODE_SUCCESS
;
_error:
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
tqError
(
"failed to encode submit req since %s"
,
terrstr
());
return
TSDB_CODE_OUT_OF_MEMORY
;
}
void
tqSinkToTablePipeline2
(
SStreamTask
*
pTask
,
void
*
vnode
,
int64_t
ver
,
void
*
data
)
{
...
...
@@ -441,9 +436,6 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
for
(
int32_t
rowId
=
0
;
rowId
<
rows
;
rowId
++
)
{
SVCreateTbReq
createTbReq
=
{
0
};
SVCreateTbReq
*
pCreateTbReq
=
&
createTbReq
;
if
(
!
pCreateTbReq
)
{
goto
_end
;
}
// set const
pCreateTbReq
->
flags
=
0
;
...
...
@@ -460,6 +452,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
if
(
size
==
2
)
{
tagArray
=
taosArrayInit
(
1
,
sizeof
(
STagVal
));
if
(
!
tagArray
)
{
tdDestroySVCreateTbReq
(
pCreateTbReq
);
goto
_end
;
}
STagVal
tagVal
=
{
...
...
@@ -477,6 +470,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
}
else
{
tagArray
=
taosArrayInit
(
size
-
1
,
sizeof
(
STagVal
));
if
(
!
tagArray
)
{
tdDestroySVCreateTbReq
(
pCreateTbReq
);
goto
_end
;
}
for
(
int32_t
tagId
=
UD_TAG_COLUMN_INDEX
,
step
=
1
;
tagId
<
size
;
tagId
++
,
step
++
)
{
...
...
@@ -503,6 +497,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
tTagNew
(
tagArray
,
1
,
false
,
&
pTag
);
tagArray
=
taosArrayDestroy
(
tagArray
);
if
(
pTag
==
NULL
)
{
tdDestroySVCreateTbReq
(
pCreateTbReq
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_end
;
}
...
...
@@ -558,6 +553,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
SVCreateTbReq
*
pCreateTbReq
=
NULL
;
if
(
!
(
pCreateTbReq
=
taosMemoryCalloc
(
1
,
sizeof
(
SVCreateStbReq
))))
{
taosMemoryFree
(
ctbName
);
goto
_end
;
};
...
...
@@ -574,6 +570,8 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
// set tag content
tagArray
=
taosArrayInit
(
1
,
sizeof
(
STagVal
));
if
(
!
tagArray
)
{
taosMemoryFree
(
ctbName
);
tdDestroySVCreateTbReq
(
pCreateTbReq
);
goto
_end
;
}
STagVal
tagVal
=
{
...
...
@@ -589,6 +587,8 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
tagArray
=
taosArrayDestroy
(
tagArray
);
if
(
pTag
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
taosMemoryFree
(
ctbName
);
tdDestroySVCreateTbReq
(
pCreateTbReq
);
goto
_end
;
}
pCreateTbReq
->
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
...
...
@@ -620,7 +620,6 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
", actual suid %"
PRId64
""
,
TD_VID
(
pVnode
),
ctbName
,
suid
,
mr
.
me
.
ctbEntry
.
suid
);
metaReaderClear
(
&
mr
);
taosMemoryFree
(
ctbName
);
}
tbData
.
uid
=
mr
.
me
.
uid
;
...
...
@@ -631,6 +630,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
// rows
if
(
!
pVals
&&
!
(
pVals
=
taosArrayInit
(
pTSchema
->
numOfCols
,
sizeof
(
SColVal
))))
{
taosArrayDestroy
(
tbData
.
aRowP
);
tdDestroySVCreateTbReq
(
tbData
.
pCreateTbReq
);
goto
_end
;
}
...
...
@@ -681,6 +681,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
SSubmitReq2
submitReq
=
{
0
};
if
(
!
(
submitReq
.
aSubmitTbData
=
taosArrayInit
(
1
,
sizeof
(
SSubmitTbData
))))
{
tDestroySSubmitTbData
(
&
tbData
,
TSDB_MSG_FLG_ENCODE
);
goto
_end
;
}
...
...
@@ -694,6 +695,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
len
+=
sizeof
(
SSubmitReq2Msg
);
pBuf
=
rpcMallocCont
(
len
);
if
(
NULL
==
pBuf
)
{
tDestroySSubmitReq2
(
&
submitReq
,
TSDB_MSG_FLG_ENCODE
);
goto
_end
;
}
((
SSubmitReq2Msg
*
)
pBuf
)
->
header
.
vgId
=
TD_VID
(
pVnode
);
...
...
@@ -705,6 +707,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
tqError
(
"failed to encode submit req since %s"
,
terrstr
());
tEncoderClear
(
&
encoder
);
rpcFreeCont
(
pBuf
);
tDestroySSubmitReq2
(
&
submitReq
,
TSDB_MSG_FLG_ENCODE
);
continue
;
}
tEncoderClear
(
&
encoder
);
...
...
utils/test/c/sml_test.c
浏览文件 @
91d5df42
...
...
@@ -215,8 +215,8 @@ int smlProcess_json3_Test() {
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"[{
\"
metric
\"
:
\"
sys.cpu.nice3
\"
,
\"
timestamp
\"
:0,
\"
value
\"
:
\"
18
\"
,
\"
tags
\"
:{
\"
host
\"
:
\"
web01
\"
,
\"
id
\"
:
\"
t1
\"
,"
"
\"
dc
\"
:
\"
lga
\"
}}]"
};
"[{
\"
metric
\"
:
\"
sys.cpu.nice3
\"
,
\"
timestamp
\"
:0,
\"
value
\"
:
\"
18
\"
,
\"
tags
\"
:{
\"
host
\"
:
\"
web01
\"
,
\"
id
\"
:
\"
t1
\"
,
\"
dc
\"
:
\"
lga
\"
}}]
"
};
char
*
sql1
[
1
]
=
{
0
};
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
sql1
[
i
]
=
taosMemoryCalloc
(
1
,
1024
);
...
...
utils/test/c/tmqSim.c
浏览文件 @
91d5df42
...
...
@@ -855,7 +855,9 @@ void loop_consume(SThreadInfo* pInfo) {
taosFprintfFile
(
g_fp
,
"==== consumerId: %d, consumeMsgCnt: %"
PRId64
", consumeRowCnt: %"
PRId64
"
\n
"
,
pInfo
->
consumerId
,
pInfo
->
consumeMsgCnt
,
pInfo
->
consumeRowCnt
);
taosFsyncFile
(
pInfo
->
pConsumeRowsFile
);
if
(
taosFsyncFile
(
pInfo
->
pConsumeRowsFile
)
<
0
){
printf
(
"taosFsyncFile error:%s"
,
strerror
(
errno
));
}
taosCloseFile
(
&
pInfo
->
pConsumeRowsFile
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录