Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f4f75a0c
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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看板
提交
f4f75a0c
编写于
6月 09, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD_543] fix coverity scan issues in mnode module
上级
c96f11e8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
26 addition
and
17 deletion
+26
-17
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+2
-2
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+1
-1
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+5
-3
src/mnode/src/mnodeMain.c
src/mnode/src/mnodeMain.c
+6
-2
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+1
-1
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+9
-7
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+1
-0
未找到文件。
src/common/inc/tdataformat.h
浏览文件 @
f4f75a0c
...
@@ -31,7 +31,7 @@ extern "C" {
...
@@ -31,7 +31,7 @@ extern "C" {
do { \
do { \
VarDataLenT __len = strlen(str); \
VarDataLenT __len = strlen(str); \
*(VarDataLenT *)(x) = __len; \
*(VarDataLenT *)(x) = __len; \
strn
cpy(varDataVal(x), (str), __len); \
mem
cpy(varDataVal(x), (str), __len); \
} while (0);
} while (0);
#define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \
#define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \
...
@@ -43,7 +43,7 @@ extern "C" {
...
@@ -43,7 +43,7 @@ extern "C" {
#define STR_WITH_SIZE_TO_VARSTR(x, str, _size) \
#define STR_WITH_SIZE_TO_VARSTR(x, str, _size) \
do { \
do { \
*(VarDataLenT *)(x) = (_size); \
*(VarDataLenT *)(x) = (_size); \
strn
cpy(varDataVal(x), (str), (_size)); \
mem
cpy(varDataVal(x), (str), (_size)); \
} while (0);
} while (0);
// ----------------- TSDB COLUMN DEFINITION
// ----------------- TSDB COLUMN DEFINITION
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
f4f75a0c
...
@@ -203,7 +203,7 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) {
...
@@ -203,7 +203,7 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) {
int16_t
numOfTags
=
htons
(
pTable
->
numOfTags
);
int16_t
numOfTags
=
htons
(
pTable
->
numOfTags
);
int32_t
sid
=
htonl
(
pTable
->
sid
);
int32_t
sid
=
htonl
(
pTable
->
sid
);
uint64_t
uid
=
htobe64
(
pTable
->
uid
);
uint64_t
uid
=
htobe64
(
pTable
->
uid
);
dPrint
(
"table:%s, numOfColumns:%d numOfTags:%d sid:%d uid:"
PRIu64
,
pTable
->
tableId
,
numOfColumns
,
numOfTags
,
sid
,
uid
);
dPrint
(
"table:%s, numOfColumns:%d numOfTags:%d sid:%d uid:
%
"
PRIu64
,
pTable
->
tableId
,
numOfColumns
,
numOfTags
,
sid
,
uid
);
return
rpcRsp
.
pCont
;
return
rpcRsp
.
pCont
;
}
}
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
f4f75a0c
...
@@ -882,7 +882,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
...
@@ -882,7 +882,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
}
}
if
(
pDb
->
cfg
.
replications
-
replications
>=
2
)
{
if
(
pDb
->
cfg
.
replications
-
replications
>=
2
)
{
mError
(
"db:%s, replica number can't change from
3 to 1"
,
pDb
->
name
,
replications
);
mError
(
"db:%s, replica number can't change from
%d to %d"
,
pDb
->
name
,
pDb
->
cfg
.
replications
,
replications
);
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
}
}
}
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
f4f75a0c
...
@@ -90,7 +90,7 @@ static int32_t mnodeDnodeActionDelete(SSdbOper *pOper) {
...
@@ -90,7 +90,7 @@ static int32_t mnodeDnodeActionDelete(SSdbOper *pOper) {
static
int32_t
mnodeDnodeActionUpdate
(
SSdbOper
*
pOper
)
{
static
int32_t
mnodeDnodeActionUpdate
(
SSdbOper
*
pOper
)
{
SDnodeObj
*
pDnode
=
pOper
->
pObj
;
SDnodeObj
*
pDnode
=
pOper
->
pObj
;
SDnodeObj
*
pSaved
=
mnodeGetDnode
(
pDnode
->
dnodeId
);
SDnodeObj
*
pSaved
=
mnodeGetDnode
(
pDnode
->
dnodeId
);
if
(
pDnode
!=
pSaved
)
{
if
(
pDnode
!=
pSaved
&&
pDnode
!=
NULL
&&
pSaved
!=
NULL
)
{
memcpy
(
pSaved
,
pDnode
,
pOper
->
rowSize
);
memcpy
(
pSaved
,
pDnode
,
pOper
->
rowSize
);
free
(
pDnode
);
free
(
pDnode
);
}
}
...
@@ -237,7 +237,9 @@ void mnodeUpdateDnode(SDnodeObj *pDnode) {
...
@@ -237,7 +237,9 @@ void mnodeUpdateDnode(SDnodeObj *pDnode) {
.
pObj
=
pDnode
.
pObj
=
pDnode
};
};
sdbUpdateRow
(
&
oper
);
if
(
sdbUpdateRow
(
&
oper
)
!=
0
)
{
mError
(
"dnodeId:%d, failed update"
,
pDnode
->
dnodeId
);
}
}
}
static
int32_t
mnodeProcessCfgDnodeMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessCfgDnodeMsg
(
SMnodeMsg
*
pMsg
)
{
...
@@ -383,7 +385,7 @@ static int32_t mnodeCreateDnode(char *ep) {
...
@@ -383,7 +385,7 @@ static int32_t mnodeCreateDnode(char *ep) {
pDnode
->
createdTime
=
taosGetTimestampMs
();
pDnode
->
createdTime
=
taosGetTimestampMs
();
pDnode
->
status
=
TAOS_DN_STATUS_OFFLINE
;
pDnode
->
status
=
TAOS_DN_STATUS_OFFLINE
;
pDnode
->
totalVnodes
=
TSDB_INVALID_VNODE_NUM
;
pDnode
->
totalVnodes
=
TSDB_INVALID_VNODE_NUM
;
strcpy
(
pDnode
->
dnodeEp
,
ep
);
tstrncpy
(
pDnode
->
dnodeEp
,
ep
,
TSDB_EP_LEN
);
taosGetFqdnPortFromEp
(
ep
,
pDnode
->
dnodeFqdn
,
&
pDnode
->
dnodePort
);
taosGetFqdnPortFromEp
(
ep
,
pDnode
->
dnodeFqdn
,
&
pDnode
->
dnodePort
);
SSdbOper
oper
=
{
SSdbOper
oper
=
{
...
...
src/mnode/src/mnodeMain.c
浏览文件 @
f4f75a0c
...
@@ -134,8 +134,12 @@ void mnodeStopSystem() {
...
@@ -134,8 +134,12 @@ void mnodeStopSystem() {
}
}
mnodeCleanupSystem
();
mnodeCleanupSystem
();
mPrint
(
"mnode file is removed"
);
remove
(
tsMnodeDir
);
if
(
remove
(
tsMnodeDir
)
!=
0
)
{
mPrint
(
"failed to remove mnode file, reason:%s"
,
strerror
(
errno
));
}
else
{
mPrint
(
"mnode file is removed"
);
}
}
}
static
void
mnodeInitTimer
()
{
static
void
mnodeInitTimer
()
{
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
f4f75a0c
...
@@ -97,7 +97,7 @@ SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port) {
...
@@ -97,7 +97,7 @@ SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port) {
.
connId
=
connId
,
.
connId
=
connId
,
.
stime
=
taosGetTimestampMs
()
.
stime
=
taosGetTimestampMs
()
};
};
strcpy
(
connObj
.
user
,
user
);
tstrncpy
(
connObj
.
user
,
user
,
TSDB_USER_LEN
);
char
key
[
10
];
char
key
[
10
];
sprintf
(
key
,
"%u"
,
connId
);
sprintf
(
key
,
"%u"
,
connId
);
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
f4f75a0c
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
#include "mnodeDnode.h"
#include "mnodeDnode.h"
#include "mnodeSdb.h"
#include "mnodeSdb.h"
#define SDB_TABLE_LEN 12
typedef
enum
{
typedef
enum
{
SDB_ACTION_INSERT
,
SDB_ACTION_INSERT
,
SDB_ACTION_DELETE
,
SDB_ACTION_DELETE
,
...
@@ -43,7 +45,7 @@ typedef enum {
...
@@ -43,7 +45,7 @@ typedef enum {
}
ESdbStatus
;
}
ESdbStatus
;
typedef
struct
_SSdbTable
{
typedef
struct
_SSdbTable
{
char
tableName
[
TSDB_DB_NAM
E_LEN
];
char
tableName
[
SDB_TABL
E_LEN
];
ESdbTable
tableId
;
ESdbTable
tableId
;
ESdbKey
keyType
;
ESdbKey
keyType
;
int32_t
hashSessions
;
int32_t
hashSessions
;
...
@@ -174,10 +176,10 @@ static void sdbRestoreTables() {
...
@@ -174,10 +176,10 @@ static void sdbRestoreTables() {
totalRows
+=
pTable
->
numOfRows
;
totalRows
+=
pTable
->
numOfRows
;
numOfTables
++
;
numOfTables
++
;
sdbTrace
(
"table:%s, is restored, numOfRows:%
d"
,
pTable
->
tableName
,
pTable
->
numOfRows
);
sdbTrace
(
"table:%s, is restored, numOfRows:%
"
PRId64
,
pTable
->
tableName
,
pTable
->
numOfRows
);
}
}
sdbTrace
(
"sdb is restored, version:%
d
totalRows:%d numOfTables:%d"
,
tsSdbObj
.
version
,
totalRows
,
numOfTables
);
sdbTrace
(
"sdb is restored, version:%
"
PRId64
"
totalRows:%d numOfTables:%d"
,
tsSdbObj
.
version
,
totalRows
,
numOfTables
);
}
}
void
sdbUpdateMnodeRoles
()
{
void
sdbUpdateMnodeRoles
()
{
...
@@ -449,7 +451,7 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbOper *pOper) {
...
@@ -449,7 +451,7 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbOper *pOper) {
pthread_mutex_unlock
(
&
pTable
->
mutex
);
pthread_mutex_unlock
(
&
pTable
->
mutex
);
sdbTrace
(
"table:%s, insert record:%s to hash, rowSize:%d vnumOfRows:%
d
version:%"
PRIu64
,
pTable
->
tableName
,
sdbTrace
(
"table:%s, insert record:%s to hash, rowSize:%d vnumOfRows:%
"
PRId64
"
version:%"
PRIu64
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
),
pOper
->
rowSize
,
pTable
->
numOfRows
,
sdbGetVersion
());
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
),
pOper
->
rowSize
,
pTable
->
numOfRows
,
sdbGetVersion
());
(
*
pTable
->
insertFp
)(
pOper
);
(
*
pTable
->
insertFp
)(
pOper
);
...
@@ -473,7 +475,7 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
...
@@ -473,7 +475,7 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
pTable
->
numOfRows
--
;
pTable
->
numOfRows
--
;
pthread_mutex_unlock
(
&
pTable
->
mutex
);
pthread_mutex_unlock
(
&
pTable
->
mutex
);
sdbTrace
(
"table:%s, delete record:%s from hash, numOfRows:%d
version:%"
PRIu64
,
pTable
->
tableName
,
sdbTrace
(
"table:%s, delete record:%s from hash, numOfRows:%d
"
PRId64
"
version:%"
PRIu64
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
sdbGetVersion
());
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
sdbGetVersion
());
int8_t
*
updateEnd
=
pOper
->
pObj
+
pTable
->
refCountPos
-
1
;
int8_t
*
updateEnd
=
pOper
->
pObj
+
pTable
->
refCountPos
-
1
;
...
@@ -484,7 +486,7 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
...
@@ -484,7 +486,7 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
}
}
static
int32_t
sdbUpdateHash
(
SSdbTable
*
pTable
,
SSdbOper
*
pOper
)
{
static
int32_t
sdbUpdateHash
(
SSdbTable
*
pTable
,
SSdbOper
*
pOper
)
{
sdbTrace
(
"table:%s, update record:%s in hash, numOfRows:%
d
version:%"
PRIu64
,
pTable
->
tableName
,
sdbTrace
(
"table:%s, update record:%s in hash, numOfRows:%
"
PRId64
"
version:%"
PRIu64
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
sdbGetVersion
());
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
sdbGetVersion
());
(
*
pTable
->
updateFp
)(
pOper
);
(
*
pTable
->
updateFp
)(
pOper
);
...
@@ -717,7 +719,7 @@ void *sdbOpenTable(SSdbTableDesc *pDesc) {
...
@@ -717,7 +719,7 @@ void *sdbOpenTable(SSdbTableDesc *pDesc) {
if
(
pTable
==
NULL
)
return
NULL
;
if
(
pTable
==
NULL
)
return
NULL
;
strcpy
(
pTable
->
tableName
,
pDesc
->
tableName
);
tstrncpy
(
pTable
->
tableName
,
pDesc
->
tableName
,
SDB_TABLE_LEN
);
pTable
->
keyType
=
pDesc
->
keyType
;
pTable
->
keyType
=
pDesc
->
keyType
;
pTable
->
tableId
=
pDesc
->
tableId
;
pTable
->
tableId
=
pDesc
->
tableId
;
pTable
->
hashSessions
=
pDesc
->
hashSessions
;
pTable
->
hashSessions
=
pDesc
->
hashSessions
;
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
f4f75a0c
...
@@ -324,6 +324,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
...
@@ -324,6 +324,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
connect_over:
connect_over:
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
rpcFreeCont
(
pConnectRsp
);
mLError
(
"user:%s login from %s, result:%s"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clientIp
),
tstrerror
(
code
));
mLError
(
"user:%s login from %s, result:%s"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clientIp
),
tstrerror
(
code
));
}
else
{
}
else
{
mLPrint
(
"user:%s login from %s, result:%s"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clientIp
),
tstrerror
(
code
));
mLPrint
(
"user:%s login from %s, result:%s"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clientIp
),
tstrerror
(
code
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录