Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
1317dbc5
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1317dbc5
编写于
5月 01, 2020
作者:
sangshuduo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix part of issues reported by TScanCode.
[TD-217]
上级
59a39792
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
60 addition
and
21 deletion
+60
-21
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+7
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+6
-2
src/client/src/tscStream.c
src/client/src/tscStream.c
+2
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+3
-1
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+1
-0
src/kit/shell/src/shellImport.c
src/kit/shell/src/shellImport.c
+1
-0
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+13
-2
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+3
-0
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+2
-4
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+3
-1
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+5
-1
src/query/src/qparserImpl.c
src/query/src/qparserImpl.c
+2
-2
src/query/src/qtsbuf.c
src/query/src/qtsbuf.c
+7
-3
src/query/src/queryUtil.c
src/query/src/queryUtil.c
+4
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-1
未找到文件。
src/client/src/tscSecondaryMerge.c
浏览文件 @
1317dbc5
...
...
@@ -140,7 +140,13 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
// offset of cmd in SSqlObj structure
char
*
pSqlObjAddr
=
(
char
*
)
pCmd
-
offsetof
(
SSqlObj
,
cmd
);
if
(
pMemBuffer
==
NULL
||
pDesc
->
pColumnModel
==
NULL
)
{
if
(
pMemBuffer
==
NULL
)
{
tscError
(
"%p pMemBuffer"
,
pMemBuffer
);
pRes
->
code
=
TSDB_CODE_APP_ERROR
;
return
;
}
if
(
pDesc
->
pColumnModel
==
NULL
)
{
tscLocalReducerEnvDestroy
(
pMemBuffer
,
pDesc
,
finalmodel
,
numOfBuffer
);
tscError
(
"%p no local buffer or intermediate result format model"
,
pSqlObjAddr
);
...
...
src/client/src/tscServer.c
浏览文件 @
1317dbc5
...
...
@@ -228,7 +228,11 @@ int tscSendMsgToServer(SSqlObj *pSql) {
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
rpcMsg
->
handle
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
if
(
pSql
==
NULL
)
{
tscError
(
"%p sql is already released"
,
pSql
->
signature
);
return
;
}
if
(
pSql
->
signature
!=
pSql
)
{
tscError
(
"%p sql is already released, signature:%p"
,
pSql
,
pSql
->
signature
);
return
;
}
...
...
@@ -310,7 +314,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
pRes
->
rspType
=
rpcMsg
->
msgType
;
pRes
->
rspLen
=
rpcMsg
->
contLen
;
if
(
pRes
->
rspLen
>
0
)
{
if
(
pRes
->
rspLen
>
0
&&
rpcMsg
->
pCont
)
{
char
*
tmp
=
(
char
*
)
realloc
(
pRes
->
pRsp
,
pRes
->
rspLen
);
if
(
tmp
==
NULL
)
{
pRes
->
code
=
TSDB_CODE_CLI_OUT_OF_MEMORY
;
...
...
src/client/src/tscStream.c
浏览文件 @
1317dbc5
...
...
@@ -172,17 +172,17 @@ static void tscSetTimestampForRes(SSqlStream *pStream, SSqlObj *pSql) {
static
void
tscProcessStreamRetrieveResult
(
void
*
param
,
TAOS_RES
*
res
,
int
numOfRows
)
{
SSqlStream
*
pStream
=
(
SSqlStream
*
)
param
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
res
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
if
(
pSql
==
NULL
||
numOfRows
<
0
)
{
int64_t
retryDelayTime
=
tscGetRetryDelayTime
(
pStream
->
slidingTime
,
pStream
->
precision
);
tscError
(
"%p stream:%p, retrieve data failed, code:%d, retry in %"
PRId64
"ms"
,
pSql
,
pStream
,
numOfRows
,
retryDelayTime
);
tscClearTableMetaInfo
(
pTableMetaInfo
,
true
);
tscSetRetryTimer
(
pStream
,
pStream
->
pSql
,
retryDelayTime
);
return
;
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
if
(
numOfRows
>
0
)
{
// when reaching here the first execution of stream computing is successful.
pStream
->
numOfRes
+=
numOfRows
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
...
...
src/client/src/tscUtil.c
浏览文件 @
1317dbc5
...
...
@@ -757,7 +757,9 @@ void tscCloseTscObj(STscObj* pObj) {
taosTmrStopA
(
&
(
pObj
->
pTimer
));
tscFreeSqlObj
(
pSql
);
sem_destroy
(
&
pSql
->
rspSem
);
if
(
pSql
)
{
sem_destroy
(
&
pSql
->
rspSem
);
}
rpcClose
(
pObj
->
pMgmtConn
);
pthread_mutex_destroy
(
&
pObj
->
mutex
);
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
1317dbc5
...
...
@@ -213,6 +213,7 @@ static void dnodeCheckDataDirOpenned(char *dir) {
int32_t
ret
=
flock
(
fd
,
LOCK_EX
|
LOCK_NB
);
if
(
ret
!=
0
)
{
dError
(
"failed to lock file:%s ret:%d, database may be running, quit"
,
filepath
,
ret
);
close
(
fd
);
exit
(
0
);
}
}
...
...
src/kit/shell/src/shellImport.c
浏览文件 @
1317dbc5
...
...
@@ -142,6 +142,7 @@ static void shellSourceFile(TAOS *con, char *fptr) {
if
(
wordexp
(
fptr
,
&
full_path
,
0
)
!=
0
)
{
fprintf
(
stderr
,
"ERROR: illegal file name
\n
"
);
free
(
cmd
);
return
;
}
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
1317dbc5
...
...
@@ -62,7 +62,13 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
if
(
arg
)
arguments
->
password
=
arg
;
break
;
case
'P'
:
tsMnodeShellPort
=
atoi
(
arg
);
if
(
arg
)
{
tsMnodeShellPort
=
atoi
(
arg
);
}
else
{
fprintf
(
stderr
,
"Invalid port
\n
"
);
return
-
1
;
}
break
;
case
't'
:
arguments
->
timezone
=
arg
;
...
...
@@ -101,7 +107,12 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
wordfree
(
&
full_path
);
break
;
case
'T'
:
arguments
->
threadNum
=
atoi
(
arg
);
if
(
arg
)
{
arguments
->
threadNum
=
atoi
(
arg
);
}
else
{
fprintf
(
stderr
,
"Invalid number of threads
\n
"
);
return
-
1
;
}
break
;
case
'd'
:
arguments
->
database
=
arg
;
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
1317dbc5
...
...
@@ -340,6 +340,9 @@ int main(int argc, char *argv[]) {
int
count_data_type
=
0
;
char
dataString
[
512
];
bool
do_aggreFunc
=
true
;
memset
(
dataString
,
0
,
512
);
if
(
strcasecmp
(
data_type
[
0
],
"BINARY"
)
==
0
||
strcasecmp
(
data_type
[
0
],
"BOOL"
)
==
0
)
{
do_aggreFunc
=
false
;
}
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
1317dbc5
...
...
@@ -383,14 +383,13 @@ int taosGetTableRecordInfo(char *table, STableRecordInfo *pTableRecordInfo) {
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
while
((
row
=
taos_fetch_row
(
result
))
!=
NULL
)
{
if
((
row
=
taos_fetch_row
(
result
))
!=
NULL
)
{
isSet
=
true
;
pTableRecordInfo
->
isMetric
=
false
;
strncpy
(
pTableRecordInfo
->
tableRecord
.
name
,
(
char
*
)
row
[
TSDB_SHOW_TABLES_NAME_INDEX
],
fields
[
TSDB_SHOW_TABLES_NAME_INDEX
].
bytes
);
strncpy
(
pTableRecordInfo
->
tableRecord
.
metric
,
(
char
*
)
row
[
TSDB_SHOW_TABLES_METRIC_INDEX
],
fields
[
TSDB_SHOW_TABLES_METRIC_INDEX
].
bytes
);
break
;
}
taos_free_result
(
result
);
...
...
@@ -410,11 +409,10 @@ int taosGetTableRecordInfo(char *table, STableRecordInfo *pTableRecordInfo) {
return
-
1
;
}
while
((
row
=
taos_fetch_row
(
result
))
!=
NULL
)
{
if
((
row
=
taos_fetch_row
(
result
))
!=
NULL
)
{
isSet
=
true
;
pTableRecordInfo
->
isMetric
=
true
;
strcpy
(
pTableRecordInfo
->
tableRecord
.
metric
,
table
);
break
;
}
taos_free_result
(
result
);
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
1317dbc5
...
...
@@ -149,7 +149,9 @@ void mgmtDealyedAddToShellQueue(SQueuedMsg *queuedMsg) {
}
static
void
mgmtProcessMsgFromShell
(
SRpcMsg
*
rpcMsg
)
{
if
(
rpcMsg
==
NULL
||
rpcMsg
->
pCont
==
NULL
)
{
assert
(
rpcMsg
);
if
(
rpcMsg
->
pCont
==
NULL
)
{
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_INVALID_MSG_LEN
);
return
;
}
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
1317dbc5
...
...
@@ -158,7 +158,11 @@ static int32_t mgmtVgroupActionUpdate(SSdbOper *pOper) {
}
mgmtDecVgroupRef
(
pVgroup
);
mTrace
(
"vgId:%d, is updated, tables:%d numOfVnode:%d"
,
pVgroup
->
vgId
,
pDb
->
cfg
.
maxTables
,
pVgroup
->
numOfVnodes
);
mTrace
(
"vgId:%d, is updated, numOfVnode:%d"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
);
if
(
pDb
)
{
mTrace
(
"tables:%d"
,
pDb
->
cfg
.
maxTables
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
src/query/src/qparserImpl.c
浏览文件 @
1317dbc5
...
...
@@ -675,7 +675,7 @@ void SQLInfoDestroy(SSqlInfo *pInfo) {
free
(
pInfo
->
pDCLInfo
->
a
);
}
if
(
pInfo
->
type
==
TSDB_SQL_CREATE_DB
)
{
if
(
pInfo
->
pDCLInfo
!=
NULL
&&
pInfo
->
type
==
TSDB_SQL_CREATE_DB
)
{
tVariantListDestroy
(
pInfo
->
pDCLInfo
->
dbOpt
.
keep
);
}
...
...
@@ -899,4 +899,4 @@ void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) {
pDBInfo
->
keep
=
NULL
;
memset
(
&
pDBInfo
->
precision
,
0
,
sizeof
(
SSQLToken
));
}
\ No newline at end of file
}
src/query/src/qtsbuf.c
浏览文件 @
1317dbc5
...
...
@@ -636,12 +636,16 @@ void tsBufResetPos(STSBuf* pTSBuf) {
STSElem
tsBufGetElem
(
STSBuf
*
pTSBuf
)
{
STSElem
elem1
=
{.
vnode
=
-
1
};
STSCursor
*
pCur
=
&
pTSBuf
->
cur
;
if
(
pTSBuf
==
NULL
||
pCur
->
vnodeIndex
<
0
)
{
if
(
pTSBuf
==
NULL
)
{
return
elem1
;
}
STSCursor
*
pCur
=
&
pTSBuf
->
cur
;
if
(
pCur
!=
NULL
&&
pCur
->
vnodeIndex
<
0
)
{
return
elem1
;
}
STSBlock
*
pBlock
=
&
pTSBuf
->
block
;
elem1
.
vnode
=
pTSBuf
->
pData
[
pCur
->
vnodeIndex
].
info
.
vnode
;
...
...
@@ -920,4 +924,4 @@ static STSBuf* allocResForTSBuf(STSBuf* pTSBuf) {
pTSBuf
->
fileSize
+=
getDataStartOffset
();
return
pTSBuf
;
}
\ No newline at end of file
}
src/query/src/queryUtil.c
浏览文件 @
1317dbc5
...
...
@@ -62,7 +62,10 @@ void destroyTimeWindowRes(SWindowResult *pWindowRes, int32_t nOutputCols) {
}
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
numOfCols
)
{
if
(
pWindowResInfo
==
NULL
||
pWindowResInfo
->
capacity
==
0
)
{
if
(
pWindowResInfo
==
NULL
)
{
return
;
}
if
(
pWindowResInfo
->
capacity
==
0
)
{
assert
(
pWindowResInfo
->
hashList
==
NULL
&&
pWindowResInfo
->
pResult
==
NULL
);
return
;
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
1317dbc5
...
...
@@ -216,7 +216,7 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
return
false
;
}
if
(
pCheckInfo
->
iter
==
NULL
)
{
if
(
pCheckInfo
->
iter
==
NULL
&&
pTable
->
mem
)
{
pCheckInfo
->
iter
=
tSkipListCreateIterFromVal
(
pTable
->
mem
->
pData
,
(
const
char
*
)
&
pCheckInfo
->
lastKey
,
TSDB_DATA_TYPE_TIMESTAMP
,
pHandle
->
order
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录