Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e1f14cfe
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
e1f14cfe
编写于
8月 17, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
8月 17, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3104 from taosdata/hotfix/os
TD-1165 fix defects found by coverity scan
上级
974dc452
a2fbca35
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
36 addition
and
19 deletion
+36
-19
src/balance/src/balance.c
src/balance/src/balance.c
+2
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/common/src/ttimezone.c
src/common/src/ttimezone.c
+3
-1
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+4
-4
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+2
-2
src/os/src/detail/osSysinfo.c
src/os/src/detail/osSysinfo.c
+1
-0
src/plugins/mqtt/src/mqttSystem.c
src/plugins/mqtt/src/mqttSystem.c
+21
-8
src/util/src/tsocket.c
src/util/src/tsocket.c
+2
-2
未找到文件。
src/balance/src/balance.c
浏览文件 @
e1f14cfe
...
@@ -118,6 +118,7 @@ static void balanceSwapVnodeGid(SVnodeGid *pVnodeGid1, SVnodeGid *pVnodeGid2) {
...
@@ -118,6 +118,7 @@ static void balanceSwapVnodeGid(SVnodeGid *pVnodeGid1, SVnodeGid *pVnodeGid2) {
}
}
int32_t
balanceAllocVnodes
(
SVgObj
*
pVgroup
)
{
int32_t
balanceAllocVnodes
(
SVgObj
*
pVgroup
)
{
static
int32_t
randIndex
=
0
;
int32_t
dnode
=
0
;
int32_t
dnode
=
0
;
int32_t
vnodes
=
0
;
int32_t
vnodes
=
0
;
...
@@ -160,7 +161,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) {
...
@@ -160,7 +161,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) {
*/
*/
if
(
pVgroup
->
numOfVnodes
==
1
)
{
if
(
pVgroup
->
numOfVnodes
==
1
)
{
}
else
if
(
pVgroup
->
numOfVnodes
==
2
)
{
}
else
if
(
pVgroup
->
numOfVnodes
==
2
)
{
if
(
rand
()
%
2
==
0
)
{
if
(
rand
Index
++
%
2
==
0
)
{
balanceSwapVnodeGid
(
pVgroup
->
vnodeGid
,
pVgroup
->
vnodeGid
+
1
);
balanceSwapVnodeGid
(
pVgroup
->
vnodeGid
,
pVgroup
->
vnodeGid
+
1
);
}
}
}
else
{
}
else
{
...
...
src/client/src/tscSql.c
浏览文件 @
e1f14cfe
...
@@ -67,7 +67,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
...
@@ -67,7 +67,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
}
else
{
}
else
{
int
outlen
=
0
;
int
outlen
=
0
;
int
len
=
strlen
(
auth
);
int
len
=
(
int
)
strlen
(
auth
);
char
*
base64
=
(
char
*
)
base64_decode
(
auth
,
len
,
&
outlen
);
char
*
base64
=
(
char
*
)
base64_decode
(
auth
,
len
,
&
outlen
);
if
(
base64
==
NULL
||
outlen
==
0
)
{
if
(
base64
==
NULL
||
outlen
==
0
)
{
tscError
(
"invalid auth info:%s"
,
auth
);
tscError
(
"invalid auth info:%s"
,
auth
);
...
...
src/common/src/ttimezone.c
浏览文件 @
e1f14cfe
...
@@ -23,7 +23,9 @@
...
@@ -23,7 +23,9 @@
// TODO refactor to set the tz value through parameter
// TODO refactor to set the tz value through parameter
void
tsSetTimeZone
()
{
void
tsSetTimeZone
()
{
SGlobalCfg
*
cfg_timezone
=
taosGetConfigOption
(
"timezone"
);
SGlobalCfg
*
cfg_timezone
=
taosGetConfigOption
(
"timezone"
);
uInfo
(
"timezone is set to %s by %s"
,
tsTimezone
,
tsCfgStatusStr
[
cfg_timezone
->
cfgStatus
]);
if
(
cfg_timezone
!=
NULL
)
{
uInfo
(
"timezone is set to %s by %s"
,
tsTimezone
,
tsCfgStatusStr
[
cfg_timezone
->
cfgStatus
]);
}
#ifdef WINDOWS
#ifdef WINDOWS
char
winStr
[
TSDB_LOCALE_LEN
*
2
];
char
winStr
[
TSDB_LOCALE_LEN
*
2
];
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
e1f14cfe
...
@@ -710,10 +710,10 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
...
@@ -710,10 +710,10 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
pStatus
->
clusterCfg
.
statusInterval
=
htonl
(
tsStatusInterval
);
pStatus
->
clusterCfg
.
statusInterval
=
htonl
(
tsStatusInterval
);
pStatus
->
clusterCfg
.
maxtablesPerVnode
=
htonl
(
tsMaxTablePerVnode
);
pStatus
->
clusterCfg
.
maxtablesPerVnode
=
htonl
(
tsMaxTablePerVnode
);
pStatus
->
clusterCfg
.
maxVgroupsPerDb
=
htonl
(
tsMaxVgroupsPerDb
);
pStatus
->
clusterCfg
.
maxVgroupsPerDb
=
htonl
(
tsMaxVgroupsPerDb
);
strcpy
(
pStatus
->
clusterCfg
.
arbitrator
,
tsArbitrator
);
tstrncpy
(
pStatus
->
clusterCfg
.
arbitrator
,
tsArbitrator
,
TSDB_EP_LEN
);
strcpy
(
pStatus
->
clusterCfg
.
timezone
,
tsTimezone
);
tstrncpy
(
pStatus
->
clusterCfg
.
timezone
,
tsTimezone
,
64
);
strcpy
(
pStatus
->
clusterCfg
.
locale
,
tsLocale
);
tstrncpy
(
pStatus
->
clusterCfg
.
locale
,
tsLocale
,
TSDB_LOCALE_LEN
);
strcpy
(
pStatus
->
clusterCfg
.
charset
,
tsCharset
);
tstrncpy
(
pStatus
->
clusterCfg
.
charset
,
tsCharset
,
TSDB_LOCALE_LEN
);
vnodeBuildStatusMsg
(
pStatus
);
vnodeBuildStatusMsg
(
pStatus
);
contLen
=
sizeof
(
SDMStatusMsg
)
+
pStatus
->
openVnodes
*
sizeof
(
SVnodeLoad
);
contLen
=
sizeof
(
SDMStatusMsg
)
+
pStatus
->
openVnodes
*
sizeof
(
SVnodeLoad
);
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
e1f14cfe
...
@@ -73,9 +73,9 @@ static int32_t mnodeDbActionInsert(SSdbOper *pOper) {
...
@@ -73,9 +73,9 @@ static int32_t mnodeDbActionInsert(SSdbOper *pOper) {
pthread_mutex_lock
(
&
pDb
->
mutex
);
pthread_mutex_lock
(
&
pDb
->
mutex
);
pDb
->
vgListSize
=
VG_LIST_SIZE
;
pDb
->
vgListSize
=
VG_LIST_SIZE
;
pDb
->
vgList
=
calloc
(
pDb
->
vgListSize
,
sizeof
(
SVgObj
*
));
pDb
->
vgList
=
calloc
(
pDb
->
vgListSize
,
sizeof
(
SVgObj
*
));
pDb
->
numOfVgroups
=
0
;
pthread_mutex_unlock
(
&
pDb
->
mutex
);
pthread_mutex_unlock
(
&
pDb
->
mutex
);
pDb
->
numOfVgroups
=
0
;
pDb
->
numOfTables
=
0
;
pDb
->
numOfTables
=
0
;
pDb
->
numOfSuperTables
=
0
;
pDb
->
numOfSuperTables
=
0
;
...
@@ -927,7 +927,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
...
@@ -927,7 +927,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
if
(
quorum
>=
0
&&
quorum
!=
pDb
->
cfg
.
quorum
)
{
if
(
quorum
>=
0
&&
quorum
!=
pDb
->
cfg
.
quorum
)
{
mDebug
(
"db:%s, quorum:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
quorum
,
quorum
);
mDebug
(
"db:%s, quorum:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
quorum
,
quorum
);
newCfg
.
compression
=
quorum
;
newCfg
.
quorum
=
quorum
;
}
}
return
newCfg
;
return
newCfg
;
...
...
src/os/src/detail/osSysinfo.c
浏览文件 @
e1f14cfe
...
@@ -170,6 +170,7 @@ static void taosGetSystemTimezone() {
...
@@ -170,6 +170,7 @@ static void taosGetSystemTimezone() {
fclose
(
f
);
fclose
(
f
);
buf
[
sizeof
(
buf
)
-
1
]
=
0
;
char
*
lineEnd
=
strstr
(
buf
,
"
\n
"
);
char
*
lineEnd
=
strstr
(
buf
,
"
\n
"
);
if
(
lineEnd
!=
NULL
)
{
if
(
lineEnd
!=
NULL
)
{
*
lineEnd
=
0
;
*
lineEnd
=
0
;
...
...
src/plugins/mqtt/src/mqttSystem.c
浏览文件 @
e1f14cfe
...
@@ -70,14 +70,27 @@ int32_t mqttInitSystem() {
...
@@ -70,14 +70,27 @@ int32_t mqttInitSystem() {
recntStatus
.
port
=
strbetween
(
"'1883'"
,
"'"
,
"'"
);
recntStatus
.
port
=
strbetween
(
"'1883'"
,
"'"
,
"'"
);
}
}
topicPath
=
strbetween
(
strstr
(
url
,
strstr
(
_begin_hostname
,
":"
)
!=
NULL
?
recntStatus
.
port
:
recntStatus
.
hostname
),
char
*
portStr
=
recntStatus
.
hostname
;
"/"
,
"/"
);
if
(
_begin_hostname
!=
NULL
)
{
char
*
_topic
=
"+/+/+/"
;
char
*
colonStr
=
strstr
(
_begin_hostname
,
":"
);
int
_tpsize
=
strlen
(
topicPath
)
+
strlen
(
_topic
)
+
1
;
if
(
colonStr
!=
NULL
)
{
recntStatus
.
topic
=
calloc
(
1
,
_tpsize
);
portStr
=
recntStatus
.
port
;
sprintf
(
recntStatus
.
topic
,
"/%s/%s"
,
topicPath
,
_topic
);
}
recntStatus
.
client_id
=
strlen
(
tsMqttBrokerClientId
)
<
3
?
tsMqttBrokerClientId
:
"taos_mqtt"
;
}
mqttConnect
=
NULL
;
char
*
topicStr
=
strstr
(
url
,
portStr
);
if
(
topicStr
!=
NULL
)
{
topicPath
=
strbetween
(
topicStr
,
"/"
,
"/"
);
char
*
_topic
=
"+/+/+/"
;
int
_tpsize
=
strlen
(
topicPath
)
+
strlen
(
_topic
)
+
1
;
recntStatus
.
topic
=
calloc
(
1
,
_tpsize
);
sprintf
(
recntStatus
.
topic
,
"/%s/%s"
,
topicPath
,
_topic
);
recntStatus
.
client_id
=
strlen
(
tsMqttBrokerClientId
)
<
3
?
tsMqttBrokerClientId
:
"taos_mqtt"
;
mqttConnect
=
NULL
;
}
else
{
topicPath
=
NULL
;
}
return
rc
;
return
rc
;
}
}
...
...
src/util/src/tsocket.c
浏览文件 @
e1f14cfe
...
@@ -371,7 +371,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
...
@@ -371,7 +371,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
serverAdd
.
sin_addr
.
s_addr
=
ip
;
serverAdd
.
sin_addr
.
s_addr
=
ip
;
serverAdd
.
sin_port
=
(
uint16_t
)
htons
(
port
);
serverAdd
.
sin_port
=
(
uint16_t
)
htons
(
port
);
if
((
sockFd
=
(
int
)
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
))
<
0
)
{
if
((
sockFd
=
(
int
)
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
))
<
2
)
{
uError
(
"failed to open TCP socket: %d (%s)"
,
errno
,
strerror
(
errno
));
uError
(
"failed to open TCP socket: %d (%s)"
,
errno
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -382,7 +382,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
...
@@ -382,7 +382,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
uError
(
"setsockopt SO_REUSEADDR failed: %d (%s)"
,
errno
,
strerror
(
errno
));
uError
(
"setsockopt SO_REUSEADDR failed: %d (%s)"
,
errno
,
strerror
(
errno
));
taosCloseSocket
(
sockFd
);
taosCloseSocket
(
sockFd
);
return
-
1
;
return
-
1
;
}
;
}
/* bind socket to server address */
/* bind socket to server address */
if
(
bind
(
sockFd
,
(
struct
sockaddr
*
)
&
serverAdd
,
sizeof
(
serverAdd
))
<
0
)
{
if
(
bind
(
sockFd
,
(
struct
sockaddr
*
)
&
serverAdd
,
sizeof
(
serverAdd
))
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录