Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ad7dc3c4
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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,发现更多精彩内容 >>
未验证
提交
ad7dc3c4
编写于
6月 22, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2407 from taosdata/bugfix/client-coverity
td-617: fix some coverity issues
上级
758bd5dc
82ea4c2f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
48 addition
and
19 deletion
+48
-19
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+7
-2
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+26
-7
src/client/src/tscServer.c
src/client/src/tscServer.c
+12
-4
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-1
src/util/src/ttimer.c
src/util/src/ttimer.c
+1
-4
未找到文件。
src/client/src/TSDBJNIConnector.c
浏览文件 @
ad7dc3c4
...
...
@@ -565,6 +565,11 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
sql
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
jsql
,
NULL
);
}
if
(
topic
==
NULL
||
sql
==
NULL
)
{
jniTrace
(
"jobj:%p, invalid argument: topic or sql is NULL"
,
jobj
);
return
sub
;
}
TAOS_SUB
*
tsub
=
taos_subscribe
(
taos
,
(
int
)
restart
,
topic
,
sql
,
NULL
,
NULL
,
jinterval
);
sub
=
(
jlong
)
tsub
;
...
...
@@ -574,8 +579,8 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
jniTrace
(
"jobj:%p, successfully subscribe: topic: %s"
,
jobj
,
topic
);
}
if
(
topic
!=
NULL
)
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jtopic
,
topic
);
if
(
sql
!=
NULL
)
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jsql
,
sql
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jtopic
,
topic
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jsql
,
sql
);
return
sub
;
}
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
ad7dc3c4
...
...
@@ -123,7 +123,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDesc
}
}
if
(
n
==
0
)
{
if
(
n
==
0
||
pCtx
==
NULL
)
{
free
(
pTagCtx
);
}
else
{
pCtx
->
tagInfo
.
pTagCtxList
=
pTagCtx
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
ad7dc3c4
...
...
@@ -1483,6 +1483,7 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr
const
char
*
msg6
=
"function applied to tags not allowed"
;
const
char
*
msg7
=
"normal table can not apply this function"
;
const
char
*
msg8
=
"multi-columns selection does not support alias column name"
;
const
char
*
msg9
=
"invalid function"
;
switch
(
optr
)
{
case
TK_COUNT
:
{
...
...
@@ -1683,7 +1684,9 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr
bool
requireAllFields
=
(
pItem
->
pNode
->
pParam
==
NULL
);
int16_t
functionID
=
0
;
changeFunctionID
(
optr
,
&
functionID
);
if
(
changeFunctionID
(
optr
,
&
functionID
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg9
);
}
if
(
!
requireAllFields
)
{
if
(
pItem
->
pNode
->
pParam
->
nExpr
<
1
)
{
...
...
@@ -3183,10 +3186,22 @@ static bool isValidExpr(tSQLExpr* pLeft, tSQLExpr* pRight, int32_t optr) {
*
* However, columnA < 4+12 is valid
*/
if
((
pLeft
->
nSQLOptr
>=
TK_COUNT
&&
pLeft
->
nSQLOptr
<=
TK_AVG_IRATE
)
||
(
pRight
->
nSQLOptr
>=
TK_COUNT
&&
pRight
->
nSQLOptr
<=
TK_AVG_IRATE
)
||
(
pLeft
->
nSQLOptr
>=
TK_BOOL
&&
pLeft
->
nSQLOptr
<=
TK_BINARY
&&
pRight
->
nSQLOptr
>=
TK_BOOL
&&
pRight
->
nSQLOptr
<=
TK_BINARY
))
{
if
(
pLeft
->
nSQLOptr
>=
TK_COUNT
&&
pLeft
->
nSQLOptr
<=
TK_AVG_IRATE
)
{
return
false
;
}
if
(
pRight
==
NULL
)
{
return
true
;
}
if
(
pRight
->
nSQLOptr
>=
TK_COUNT
&&
pRight
->
nSQLOptr
<=
TK_AVG_IRATE
)
{
return
false
;
}
if
(
pLeft
->
nSQLOptr
>=
TK_BOOL
&&
pLeft
->
nSQLOptr
<=
TK_BINARY
&&
pRight
->
nSQLOptr
>=
TK_BOOL
&&
pRight
->
nSQLOptr
<=
TK_BINARY
)
{
return
false
;
}
...
...
@@ -3759,13 +3774,17 @@ static void doAddJoinTagsColumnsIntoTagList(SQueryInfo* pQueryInfo, SCondExpr* p
if
(
QUERY_IS_JOIN_QUERY
(
pQueryInfo
->
type
)
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
SColumnIndex
index
=
{
0
};
getColumnIndexByName
(
&
pCondExpr
->
pJoinExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
);
if
(
getColumnIndexByName
(
&
pCondExpr
->
pJoinExpr
->
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p: invalid column name (left)"
,
pQueryInfo
);
}
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
index
.
columnIndex
=
index
.
columnIndex
-
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
tscColumnListInsert
(
pTableMetaInfo
->
tagColList
,
&
index
);
getColumnIndexByName
(
&
pCondExpr
->
pJoinExpr
->
pRight
->
colInfo
,
pQueryInfo
,
&
index
);
if
(
getColumnIndexByName
(
&
pCondExpr
->
pJoinExpr
->
pRight
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p: invalid column name (right)"
,
pQueryInfo
);
}
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
index
.
columnIndex
=
index
.
columnIndex
-
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
...
...
src/client/src/tscServer.c
浏览文件 @
ad7dc3c4
...
...
@@ -202,7 +202,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpcIpSet
*
pIpSet
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
rpcMsg
->
handle
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscError
(
"%p sql is already released"
,
pSql
->
signature
);
tscError
(
"%p sql is already released"
,
pSql
);
return
;
}
...
...
@@ -819,8 +819,16 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
assert
(
QUERY_IS_JOIN_QUERY
(
pQueryInfo
->
type
)
&&
pBlockInfo
!=
NULL
);
// this query should not be sent
// todo refactor
fseek
(
pQueryInfo
->
tsBuf
->
f
,
pBlockInfo
->
offset
,
SEEK_SET
);
fread
(
pMsg
,
pBlockInfo
->
compLen
,
1
,
pQueryInfo
->
tsBuf
->
f
);
if
(
fseek
(
pQueryInfo
->
tsBuf
->
f
,
pBlockInfo
->
offset
,
SEEK_SET
)
!=
0
)
{
int
code
=
TAOS_SYSTEM_ERROR
(
ferror
(
pQueryInfo
->
tsBuf
->
f
));
tscError
(
"%p: fseek failed: %s"
,
pSql
,
tstrerror
(
code
));
return
code
;
}
if
(
fread
(
pMsg
,
pBlockInfo
->
compLen
,
1
,
pQueryInfo
->
tsBuf
->
f
)
!=
pBlockInfo
->
compLen
)
{
int
code
=
TAOS_SYSTEM_ERROR
(
ferror
(
pQueryInfo
->
tsBuf
->
f
));
tscError
(
"%p: fread didn't return expected data: %s"
,
pSql
,
tstrerror
(
code
));
return
code
;
}
pMsg
+=
pBlockInfo
->
compLen
;
tsLen
=
pBlockInfo
->
compLen
;
...
...
@@ -1622,7 +1630,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
if
(
pMetaMsg
->
numOfTags
>
TSDB_MAX_TAGS
||
pMetaMsg
->
numOfTags
<
0
)
{
if
(
pMetaMsg
->
numOfTags
>
TSDB_MAX_TAGS
)
{
tscError
(
"invalid numOfTags:%d"
,
pMetaMsg
->
numOfTags
);
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
ad7dc3c4
...
...
@@ -1378,6 +1378,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
if
(
ret
!=
0
)
{
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscQueueAsyncRes
(
pSql
);
tfree
(
pMemoryBuf
);
return
ret
;
}
...
...
@@ -1729,7 +1730,6 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
pRes
->
numOfRows
,
pQueryInfo
->
groupbyExpr
.
orderType
);
if
(
ret
!=
0
)
{
// set no disk space error info, and abort retry
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_TSC_NO_DISKSPACE
);
pthread_mutex_unlock
(
&
trsupport
->
queryMutex
);
}
else
if
(
pRes
->
completed
)
{
tscAllDataRetrievedFromDnode
(
trsupport
,
pSql
);
...
...
src/util/src/ttimer.c
浏览文件 @
ad7dc3c4
...
...
@@ -385,8 +385,8 @@ static void taosTimerLoopFunc(int signo) {
timer
=
next
;
}
pthread_mutex_unlock
(
&
wheel
->
mutex
);
wheel
->
nextScanAt
+=
wheel
->
resolution
;
pthread_mutex_unlock
(
&
wheel
->
mutex
);
}
addToExpired
(
expired
);
...
...
@@ -514,17 +514,14 @@ static void taosTmrModuleInit(void) {
tmrError
(
"failed to create the mutex for wheel, reason:%s"
,
strerror
(
errno
));
return
;
}
pthread_mutex_lock
(
&
wheel
->
mutex
);
wheel
->
nextScanAt
=
now
+
wheel
->
resolution
;
wheel
->
index
=
0
;
wheel
->
slots
=
(
tmr_obj_t
**
)
calloc
(
wheel
->
size
,
sizeof
(
tmr_obj_t
*
));
if
(
wheel
->
slots
==
NULL
)
{
tmrError
(
"failed to allocate wheel slots"
);
pthread_mutex_unlock
(
&
wheel
->
mutex
);
return
;
}
timerMap
.
size
+=
wheel
->
size
;
pthread_mutex_unlock
(
&
wheel
->
mutex
);
}
timerMap
.
count
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录