Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ea240d61
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看板
未验证
提交
ea240d61
编写于
12月 16, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
12月 16, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9143 from taosdata/feature/dnode3
Feature/dnode3
上级
62f3c0f0
f496b324
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
681 addition
and
489 deletion
+681
-489
include/common/taosmsg.h
include/common/taosmsg.h
+92
-104
include/util/tdef.h
include/util/tdef.h
+3
-3
source/dnode/mgmt/impl/test/acct/acct.cpp
source/dnode/mgmt/impl/test/acct/acct.cpp
+11
-15
source/dnode/mgmt/impl/test/cluster/cluster.cpp
source/dnode/mgmt/impl/test/cluster/cluster.cpp
+7
-11
source/dnode/mgmt/impl/test/db/db.cpp
source/dnode/mgmt/impl/test/db/db.cpp
+152
-43
source/dnode/mgmt/impl/test/dnode/dnode.cpp
source/dnode/mgmt/impl/test/dnode/dnode.cpp
+33
-38
source/dnode/mgmt/impl/test/profile/profile.cpp
source/dnode/mgmt/impl/test/profile/profile.cpp
+7
-11
source/dnode/mgmt/impl/test/show/show.cpp
source/dnode/mgmt/impl/test/show/show.cpp
+7
-11
source/dnode/mgmt/impl/test/user/user.cpp
source/dnode/mgmt/impl/test/user/user.cpp
+34
-41
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+15
-16
source/dnode/mnode/impl/inc/mndDnode.h
source/dnode/mnode/impl/inc/mndDnode.h
+1
-0
source/dnode/mnode/impl/inc/mndVgroup.h
source/dnode/mnode/impl/inc/mndVgroup.h
+7
-4
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+190
-172
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+9
-0
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+113
-20
未找到文件。
include/common/taosmsg.h
浏览文件 @
ea240d61
...
...
@@ -215,8 +215,8 @@ typedef enum _mgmt_table {
extern
char
*
taosMsg
[];
typedef
struct
SBuildTableMetaInput
{
int32_t
vgId
;
char
*
tableFullName
;
int32_t
vgId
;
char
*
tableFullName
;
}
SBuildTableMetaInput
;
typedef
struct
SBuildUseDBInput
{
...
...
@@ -224,7 +224,6 @@ typedef struct SBuildUseDBInput {
int32_t
vgVersion
;
}
SBuildUseDBInput
;
#pragma pack(push, 1)
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
...
...
@@ -234,7 +233,7 @@ typedef struct {
}
SEpAddrMsg
;
typedef
struct
{
char
*
fqdn
;
char
*
fqdn
;
uint16_t
port
;
}
SEpAddr1
;
...
...
@@ -261,10 +260,10 @@ typedef struct SSubmitBlk {
// Submit message for this TSDB
typedef
struct
SSubmitMsg
{
SMsgHead
header
;
int32_t
length
;
int32_t
numOfBlocks
;
char
blocks
[];
SMsgHead
header
;
int32_t
length
;
int32_t
numOfBlocks
;
char
blocks
[];
}
SSubmitMsg
;
typedef
struct
{
...
...
@@ -343,7 +342,7 @@ typedef struct {
typedef
struct
{
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_FULL_DB_NAME_LEN
];
int16_t
type
;
/* operation type */
int16_t
type
;
/* operation type */
int16_t
numOfCols
;
/* number of schema */
int32_t
tagValLen
;
SSchema
schema
[];
...
...
@@ -352,17 +351,17 @@ typedef struct {
}
SAlterTableMsg
;
typedef
struct
{
SMsgHead
head
;
int64_t
uid
;
int32_t
tid
;
int16_t
tversion
;
int16_t
colId
;
int8_t
type
;
int16_t
bytes
;
int32_t
tagValLen
;
int16_t
numOfTags
;
int32_t
schemaLen
;
char
data
[];
SMsgHead
head
;
int64_t
uid
;
int32_t
tid
;
int16_t
tversion
;
int16_t
colId
;
int8_t
type
;
int16_t
bytes
;
int32_t
tagValLen
;
int16_t
numOfTags
;
int32_t
schemaLen
;
char
data
[];
}
SUpdateTableTagValMsg
;
typedef
struct
{
...
...
@@ -425,7 +424,7 @@ typedef struct {
int32_t
contLen
;
int32_t
vgId
;
uint64_t
uid
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
}
SDropSTableMsg
;
typedef
struct
SColIndex
{
...
...
@@ -438,7 +437,7 @@ typedef struct SColIndex {
typedef
struct
SColumnFilterInfo
{
int16_t
lowerRelOptr
;
int16_t
upperRelOptr
;
int16_t
filterstr
;
// denote if current column is char(binary/nchar)
int16_t
filterstr
;
// denote if current column is char(binary/nchar)
union
{
struct
{
...
...
@@ -457,9 +456,9 @@ typedef struct SColumnFilterInfo {
}
SColumnFilterInfo
;
typedef
struct
SColumnFilterList
{
int16_t
numOfFilters
;
union
{
int64_t
placeholder
;
int16_t
numOfFilters
;
union
{
int64_t
placeholder
;
SColumnFilterInfo
*
filterInfo
;
};
}
SColumnFilterList
;
...
...
@@ -468,10 +467,10 @@ typedef struct SColumnFilterList {
* But for data in vnode side, we need all the following information.
*/
typedef
struct
SColumnInfo
{
int16_t
colId
;
int16_t
type
;
int16_t
bytes
;
SColumnFilterList
flist
;
int16_t
colId
;
int16_t
type
;
int16_t
bytes
;
SColumnFilterList
flist
;
}
SColumnInfo
;
typedef
struct
STableIdInfo
{
...
...
@@ -485,14 +484,14 @@ typedef struct STimeWindow {
}
STimeWindow
;
typedef
struct
{
int32_t
tsOffset
;
// offset value in current msg body, NOTE: ts list is compressed
int32_t
tsLen
;
// total length of ts comp block
int32_t
tsNumOfBlocks
;
// ts comp block numbers
int32_t
tsOrder
;
// ts comp block order
int32_t
tsOffset
;
// offset value in current msg body, NOTE: ts list is compressed
int32_t
tsLen
;
// total length of ts comp block
int32_t
tsNumOfBlocks
;
// ts comp block numbers
int32_t
tsOrder
;
// ts comp block order
}
STsBufInfo
;
typedef
struct
SInterval
{
int32_t
tz
;
// query client timezone
int32_t
tz
;
// query client timezone
char
intervalUnit
;
char
slidingUnit
;
char
offsetUnit
;
...
...
@@ -502,51 +501,51 @@ typedef struct SInterval {
}
SInterval
;
typedef
struct
{
SMsgHead
head
;
char
version
[
TSDB_VERSION_LEN
];
SMsgHead
head
;
char
version
[
TSDB_VERSION_LEN
];
bool
stableQuery
;
// super table query or not
bool
topBotQuery
;
// TODO used bitwise flag
bool
interpQuery
;
// interp query or not
bool
groupbyColumn
;
// denote if this is a groupby normal column query
bool
hasTagResults
;
// if there are tag values in final result or not
bool
timeWindowInterpo
;
// if the time window start/end required interpolation
bool
queryBlockDist
;
// if query data block distribution
bool
stabledev
;
// super table stddev query
bool
tsCompQuery
;
// is tscomp query
bool
simpleAgg
;
bool
pointInterpQuery
;
// point interpolation query
bool
needReverseScan
;
// need reverse scan
bool
stateWindow
;
// state window flag
bool
stableQuery
;
// super table query or not
bool
topBotQuery
;
// TODO used bitwise flag
bool
interpQuery
;
// interp query or not
bool
groupbyColumn
;
// denote if this is a groupby normal column query
bool
hasTagResults
;
// if there are tag values in final result or not
bool
timeWindowInterpo
;
// if the time window start/end required interpolation
bool
queryBlockDist
;
// if query data block distribution
bool
stabledev
;
// super table stddev query
bool
tsCompQuery
;
// is tscomp query
bool
simpleAgg
;
bool
pointInterpQuery
;
// point interpolation query
bool
needReverseScan
;
// need reverse scan
bool
stateWindow
;
// state window flag
STimeWindow
window
;
int32_t
numOfTables
;
int16_t
order
;
int16_t
orderColId
;
int16_t
numOfCols
;
// the number of columns will be load from vnode
int16_t
numOfCols
;
// the number of columns will be load from vnode
SInterval
interval
;
// SSessionWindow sw; // session window
int16_t
tagCondLen
;
// tag length in current query
int16_t
colCondLen
;
// column length in current query
int16_t
numOfGroupCols
;
// num of group by columns
int16_t
orderByIdx
;
int16_t
orderType
;
// used in group by xx order by xxx
int64_t
vgroupLimit
;
// limit the number of rows for each table, used in order by + limit in stable projection query.
int16_t
prjOrder
;
// global order in super table projection query.
int64_t
limit
;
int64_t
offset
;
int32_t
queryType
;
// denote another query process
int16_t
numOfOutput
;
// final output columns numbers
int16_t
fillType
;
// interpolate type
int64_t
fillVal
;
// default value array list
int32_t
secondStageOutput
;
STsBufInfo
tsBuf
;
// tsBuf info
int32_t
numOfTags
;
// number of tags columns involved
int32_t
sqlstrLen
;
// sql query string
int32_t
prevResultLen
;
// previous result length
// SSessionWindow sw; // session window
int16_t
tagCondLen
;
// tag length in current query
int16_t
colCondLen
;
// column length in current query
int16_t
numOfGroupCols
;
// num of group by columns
int16_t
orderByIdx
;
int16_t
orderType
;
// used in group by xx order by xxx
int64_t
vgroupLimit
;
// limit the number of rows for each table, used in order by + limit in stable projection query.
int16_t
prjOrder
;
// global order in super table projection query.
int64_t
limit
;
int64_t
offset
;
int32_t
queryType
;
// denote another query process
int16_t
numOfOutput
;
// final output columns numbers
int16_t
fillType
;
// interpolate type
int64_t
fillVal
;
// default value array list
int32_t
secondStageOutput
;
STsBufInfo
tsBuf
;
// tsBuf info
int32_t
numOfTags
;
// number of tags columns involved
int32_t
sqlstrLen
;
// sql query string
int32_t
prevResultLen
;
// previous result length
int32_t
numOfOperator
;
int32_t
tableScanOperator
;
// table scan operator. -1 means no scan operator
int32_t
udfNum
;
// number of udf function
int32_t
tableScanOperator
;
// table scan operator. -1 means no scan operator
int32_t
udfNum
;
// number of udf function
int32_t
udfContentOffset
;
int32_t
udfContentLen
;
SColumnInfo
tableCols
[];
...
...
@@ -585,6 +584,7 @@ typedef struct SRetrieveTableRsp {
typedef
struct
{
char
db
[
TSDB_FULL_DB_NAME_LEN
];
int32_t
numOfVgroups
;
int32_t
cacheBlockSize
;
// MB
int32_t
totalBlocks
;
int32_t
daysPerFile
;
...
...
@@ -627,7 +627,6 @@ typedef struct {
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
int8_t
ignoreNotExists
;
int32_t
vgVersion
;
int32_t
reserve
[
8
];
}
SUseDbMsg
;
...
...
@@ -790,8 +789,8 @@ typedef struct {
}
SStbInfoMsg
;
typedef
struct
{
SMsgHead
msgHead
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
SMsgHead
msgHead
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
}
STableInfoMsg
;
typedef
struct
{
...
...
@@ -833,19 +832,19 @@ typedef struct {
}
SVgroupsMsg
,
SVgroupsInfo
;
typedef
struct
{
char
tbFname
[
TSDB_TABLE_FNAME_LEN
];
// table full name
char
stbFname
[
TSDB_TABLE_FNAME_LEN
];
int32_t
numOfTags
;
int32_t
numOfColumns
;
int8_t
precision
;
int8_t
tableType
;
int8_t
update
;
int32_t
sversion
;
int32_t
tversion
;
uint64_t
tuid
;
uint64_t
suid
;
int32_t
vgId
;
SSchema
pSchema
[];
char
tbFname
[
TSDB_TABLE_FNAME_LEN
];
// table full name
char
stbFname
[
TSDB_TABLE_FNAME_LEN
];
int32_t
numOfTags
;
int32_t
numOfColumns
;
int8_t
precision
;
int8_t
tableType
;
int8_t
update
;
int32_t
sversion
;
int32_t
tversion
;
uint64_t
tuid
;
uint64_t
suid
;
int32_t
vgId
;
SSchema
pSchema
[];
}
STableMetaMsg
;
typedef
struct
SMultiTableMeta
{
...
...
@@ -873,8 +872,6 @@ typedef struct {
SVgroupInfo
vgroupInfo
[];
}
SUseDbRsp
;
/*
* sql: show tables like '%a_%'
* payload is the query condition, e.g., '%a_%'
...
...
@@ -888,7 +885,7 @@ typedef struct {
}
SShowMsg
;
typedef
struct
{
char
db
[
TSDB_FULL_DB_NAME_LEN
];
char
db
[
TSDB_FULL_DB_NAME_LEN
];
int32_t
numOfVgroup
;
int32_t
vgid
[];
}
SCompactMsg
;
...
...
@@ -1009,45 +1006,37 @@ typedef struct {
}
SAuthMsg
,
SAuthRsp
;
typedef
struct
{
int8_t
finished
;
int8_t
reserved1
[
7
];
char
name
[
TSDB_STEP_NAME_LEN
];
char
desc
[
TSDB_STEP_DESC_LEN
];
int8_t
finished
;
int8_t
reserved1
[
7
];
char
name
[
TSDB_STEP_NAME_LEN
];
char
desc
[
TSDB_STEP_DESC_LEN
];
}
SStartupMsg
;
// mq related
typedef
struct
{
}
SMqConnectReq
;
typedef
struct
{
}
SMqConnectRsp
;
typedef
struct
{
}
SMqDisconnectReq
;
typedef
struct
{
}
SMqDisconnectRsp
;
typedef
struct
{
}
SMqAckReq
;
typedef
struct
{
}
SMqAckRsp
;
typedef
struct
{
}
SMqResetReq
;
typedef
struct
{
}
SMqResetRsp
;
//mq related end
//
mq related end
typedef
struct
{
/* data */
...
...
@@ -1101,7 +1090,6 @@ typedef struct {
/* data */
}
SUpdateTagValRsp
;
#pragma pack(pop)
#ifdef __cplusplus
...
...
include/util/tdef.h
浏览文件 @
ea240d61
...
...
@@ -233,8 +233,8 @@ do { \
#define TSDB_CQ_SQL_SIZE 1024
#define TSDB_MIN_VNODES 64
#define TSDB_MAX_VNODES 512
#define TSDB_MIN_VNODES_PER_DB
2
#define TSDB_MAX_VNODES_PER_DB
64
#define TSDB_MIN_VNODES_PER_DB
1
#define TSDB_MAX_VNODES_PER_DB
4096
#define TSDB_DNODE_ROLE_ANY 0
#define TSDB_DNODE_ROLE_MGMT 1
...
...
@@ -247,7 +247,7 @@ do { \
#define TSDB_RES_COL_ID (-5000)
#define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta
#define TSDB_MIN_CACHE_BLOCK_SIZE 1
#define TSDB_MAX_CACHE_BLOCK_SIZE 128 // 128MB for each vnode
#define TSDB_DEFAULT_CACHE_BLOCK_SIZE 16
...
...
source/dnode/mgmt/impl/test/acct/acct.cpp
浏览文件 @
ea240d61
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
/**
* @file vnodeApiTests.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module acct-msg tests
* @version 0.1
* @date 2021-12-15
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* @copyright Copyright (c) 2021
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
...
...
@@ -49,7 +45,7 @@ SServer* DndTestAcct::pServer;
SClient
*
DndTestAcct
::
pClient
;
int32_t
DndTestAcct
::
connId
;
TEST_F
(
DndTestAcct
,
CreateAcct
)
{
TEST_F
(
DndTestAcct
,
01
_
CreateAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SCreateAcctMsg
*
pReq
=
(
SCreateAcctMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateAcctMsg
));
...
...
@@ -65,7 +61,7 @@ TEST_F(DndTestAcct, CreateAcct) {
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_MSG_NOT_PROCESSED
);
}
TEST_F
(
DndTestAcct
,
AlterAcct
)
{
TEST_F
(
DndTestAcct
,
02
_
AlterAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SAlterAcctMsg
*
pReq
=
(
SAlterAcctMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterAcctMsg
));
...
...
@@ -81,7 +77,7 @@ TEST_F(DndTestAcct, AlterAcct) {
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_MSG_NOT_PROCESSED
);
}
TEST_F
(
DndTestAcct
,
DropAcct
)
{
TEST_F
(
DndTestAcct
,
03
_
DropAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SDropAcctMsg
*
pReq
=
(
SDropAcctMsg
*
)
rpcMallocCont
(
sizeof
(
SDropAcctMsg
));
...
...
@@ -97,7 +93,7 @@ TEST_F(DndTestAcct, DropAcct) {
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_MSG_NOT_PROCESSED
);
}
TEST_F
(
DndTestAcct
,
ShowAcct
)
{
TEST_F
(
DndTestAcct
,
04
_
ShowAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SShowMsg
*
pReq
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
...
...
source/dnode/mgmt/impl/test/cluster/cluster.cpp
浏览文件 @
ea240d61
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
/**
* @file vnodeApiTests.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module cluster-msg tests
* @version 0.1
* @date 2021-12-15
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* @copyright Copyright (c) 2021
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
...
...
source/dnode/mgmt/impl/test/db/db.cpp
浏览文件 @
ea240d61
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
/**
* @file vnodeApiTests.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module db-msg tests
* @version 0.1
* @date 2021-12-15
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* @copyright Copyright (c) 2021
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
...
...
@@ -30,7 +26,7 @@ class DndTestDb : public ::testing::Test {
const
char
*
firstEp
=
"localhost:9040"
;
pServer
=
CreateServer
(
"/tmp/dnode_test_db"
,
fqdn
,
9040
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9040
);
taosMsleep
(
3
00
);
taosMsleep
(
11
00
);
}
static
void
TearDownTestSuite
()
{
...
...
@@ -48,11 +44,12 @@ class DndTestDb : public ::testing::Test {
void
SetUp
()
override
{}
void
TearDown
()
override
{}
void
SendTheCheckShowMetaMsg
(
int8_t
showType
,
const
char
*
showName
,
int32_t
columns
)
{
void
SendTheCheckShowMetaMsg
(
int8_t
showType
,
const
char
*
showName
,
int32_t
columns
,
const
char
*
db
)
{
SShowMsg
*
pShow
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
pShow
->
type
=
showType
;
strcpy
(
pShow
->
db
,
""
);
if
(
db
!=
NULL
)
{
strcpy
(
pShow
->
db
,
db
);
}
SRpcMsg
showRpcMsg
=
{
0
};
showRpcMsg
.
pCont
=
pShow
;
showRpcMsg
.
contLen
=
sizeof
(
SShowMsg
);
...
...
@@ -183,31 +180,33 @@ SClient* DndTestDb::pClient;
int32_t
DndTestDb
::
connId
;
TEST_F
(
DndTestDb
,
01
_ShowDb
)
{
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
6
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
7
,
NULL
);
CheckSchema
(
0
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
-
1
+
VARSTR_HEADER_SIZE
,
"name"
);
CheckSchema
(
1
,
TSDB_DATA_TYPE_TIMESTAMP
,
8
,
"create time"
);
CheckSchema
(
2
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"replica"
);
CheckSchema
(
3
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"quorum"
);
CheckSchema
(
4
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"days"
);
CheckSchema
(
5
,
TSDB_DATA_TYPE_BINARY
,
24
+
VARSTR_HEADER_SIZE
,
"keep0,keep1,keep2"
);
CheckSchema
(
6
,
TSDB_DATA_TYPE_INT
,
4
,
"cache(MB)"
);
CheckSchema
(
7
,
TSDB_DATA_TYPE_INT
,
4
,
"blocks"
);
CheckSchema
(
8
,
TSDB_DATA_TYPE_INT
,
4
,
"minrows"
);
CheckSchema
(
9
,
TSDB_DATA_TYPE_INT
,
4
,
"maxrows"
);
CheckSchema
(
10
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"wallevel"
);
CheckSchema
(
11
,
TSDB_DATA_TYPE_INT
,
4
,
"fsync"
);
CheckSchema
(
12
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"comp"
);
CheckSchema
(
13
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"cachelast"
);
CheckSchema
(
14
,
TSDB_DATA_TYPE_BINARY
,
3
+
VARSTR_HEADER_SIZE
,
"precision"
);
CheckSchema
(
15
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"update"
);
CheckSchema
(
2
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"vgroups"
);
CheckSchema
(
3
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"replica"
);
CheckSchema
(
4
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"quorum"
);
CheckSchema
(
5
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"days"
);
CheckSchema
(
6
,
TSDB_DATA_TYPE_BINARY
,
24
+
VARSTR_HEADER_SIZE
,
"keep0,keep1,keep2"
);
CheckSchema
(
7
,
TSDB_DATA_TYPE_INT
,
4
,
"cache(MB)"
);
CheckSchema
(
8
,
TSDB_DATA_TYPE_INT
,
4
,
"blocks"
);
CheckSchema
(
9
,
TSDB_DATA_TYPE_INT
,
4
,
"minrows"
);
CheckSchema
(
10
,
TSDB_DATA_TYPE_INT
,
4
,
"maxrows"
);
CheckSchema
(
11
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"wallevel"
);
CheckSchema
(
12
,
TSDB_DATA_TYPE_INT
,
4
,
"fsync"
);
CheckSchema
(
13
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"comp"
);
CheckSchema
(
14
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"cachelast"
);
CheckSchema
(
15
,
TSDB_DATA_TYPE_BINARY
,
3
+
VARSTR_HEADER_SIZE
,
"precision"
);
CheckSchema
(
16
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"update"
);
SendThenCheckShowRetrieveMsg
(
0
);
}
TEST_F
(
DndTestDb
,
02
_CreateDb
)
{
TEST_F
(
DndTestDb
,
02
_Create
_Alter_Drop_
Db
)
{
{
SCreateDbMsg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDbMsg
));
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
totalBlocks
=
htonl
(
10
);
pReq
->
daysPerFile
=
htonl
(
10
);
...
...
@@ -238,10 +237,11 @@ TEST_F(DndTestDb, 02_CreateDb) {
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
6
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
7
,
NULL
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt16
(
1
);
// replica
CheckInt16
(
1
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -256,9 +256,22 @@ TEST_F(DndTestDb, 02_CreateDb) {
CheckInt8
(
0
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
}
TEST_F
(
DndTestDb
,
03
_AlterDb
)
{
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_VGROUP
,
"show vgroups"
,
4
,
"1.d1"
);
CheckSchema
(
0
,
TSDB_DATA_TYPE_INT
,
4
,
"vgId"
);
CheckSchema
(
1
,
TSDB_DATA_TYPE_INT
,
4
,
"tables"
);
CheckSchema
(
2
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"v1_dnode"
);
CheckSchema
(
3
,
TSDB_DATA_TYPE_BINARY
,
9
+
VARSTR_HEADER_SIZE
,
"v1_status"
);
SendThenCheckShowRetrieveMsg
(
2
);
CheckInt32
(
1
);
CheckInt32
(
2
);
CheckInt32
(
0
);
CheckInt32
(
0
);
CheckInt16
(
1
);
CheckInt16
(
1
);
CheckBinary
(
"master"
,
9
);
CheckBinary
(
"master"
,
9
);
{
SAlterDbMsg
*
pReq
=
(
SAlterDbMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterDbMsg
));
strcpy
(
pReq
->
db
,
"1.d1"
);
...
...
@@ -282,10 +295,11 @@ TEST_F(DndTestDb, 03_AlterDb) {
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
6
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
7
,
NULL
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -300,9 +314,8 @@ TEST_F(DndTestDb, 03_AlterDb) {
CheckInt8
(
1
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
}
TEST_F
(
DndTestDb
,
04
_RestartDnode
)
{
// restart
stopServer
(
pServer
);
pServer
=
NULL
;
...
...
@@ -314,10 +327,11 @@ TEST_F(DndTestDb, 04_RestartDnode) {
uInfo
(
"all server is running"
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
6
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
7
,
NULL
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -332,11 +346,9 @@ TEST_F(DndTestDb, 04_RestartDnode) {
CheckInt8
(
1
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
}
TEST_F
(
DndTestDb
,
05
_DropDb
)
{
{
SDropDbMsg
*
pReq
=
(
SDropDbMsg
*
)
rpcMallocCont
(
sizeof
(
S
Alter
DbMsg
));
SDropDbMsg
*
pReq
=
(
SDropDbMsg
*
)
rpcMallocCont
(
sizeof
(
S
Drop
DbMsg
));
strcpy
(
pReq
->
db
,
"1.d1"
);
SRpcMsg
rpcMsg
=
{
0
};
...
...
@@ -350,6 +362,103 @@ TEST_F(DndTestDb, 05_DropDb) {
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
6
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
1
7
,
NULL
);
SendThenCheckShowRetrieveMsg
(
0
);
}
\ No newline at end of file
}
TEST_F
(
DndTestDb
,
03
_Create_Use_Restart_Use_Db
)
{
{
SCreateDbMsg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDbMsg
));
strcpy
(
pReq
->
db
,
"1.d2"
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
totalBlocks
=
htonl
(
10
);
pReq
->
daysPerFile
=
htonl
(
10
);
pReq
->
daysToKeep0
=
htonl
(
3650
);
pReq
->
daysToKeep1
=
htonl
(
3650
);
pReq
->
daysToKeep2
=
htonl
(
3650
);
pReq
->
minRowsPerFileBlock
=
htonl
(
100
);
pReq
->
maxRowsPerFileBlock
=
htonl
(
4096
);
pReq
->
commitTime
=
htonl
(
3600
);
pReq
->
fsyncPeriod
=
htonl
(
3000
);
pReq
->
walLevel
=
1
;
pReq
->
precision
=
0
;
pReq
->
compression
=
2
;
pReq
->
replications
=
1
;
pReq
->
quorum
=
1
;
pReq
->
update
=
0
;
pReq
->
cacheLastRow
=
0
;
pReq
->
ignoreExist
=
1
;
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateDbMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_DB
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
17
,
NULL
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckBinary
(
"d2"
,
TSDB_DB_NAME_LEN
-
1
);
{
SUseDbMsg
*
pReq
=
(
SUseDbMsg
*
)
rpcMallocCont
(
sizeof
(
SUseDbMsg
));
strcpy
(
pReq
->
db
,
"1.d2"
);
pReq
->
vgVersion
=
htonl
(
-
1
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SUseDbMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_USE_DB
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
SUseDbRsp
*
pRsp
=
(
SUseDbRsp
*
)
pMsg
->
pCont
;
EXPECT_STREQ
(
pRsp
->
db
,
"1.d2"
);
pRsp
->
vgVersion
=
htonl
(
pRsp
->
vgVersion
);
pRsp
->
vgNum
=
htonl
(
pRsp
->
vgNum
);
pRsp
->
hashMethod
=
pRsp
->
hashMethod
;
EXPECT_EQ
(
pRsp
->
vgVersion
,
1
);
EXPECT_EQ
(
pRsp
->
vgNum
,
2
);
EXPECT_EQ
(
pRsp
->
hashMethod
,
1
);
{
SVgroupInfo
*
pInfo
=
&
pRsp
->
vgroupInfo
[
0
];
pInfo
->
vgId
=
htonl
(
pInfo
->
vgId
);
pInfo
->
hashBegin
=
htonl
(
pInfo
->
hashBegin
);
pInfo
->
hashEnd
=
htonl
(
pInfo
->
hashEnd
);
EXPECT_GT
(
pInfo
->
vgId
,
0
);
EXPECT_EQ
(
pInfo
->
hashBegin
,
0
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
INT32_MAX
/
2
-
1
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
SEpAddrMsg
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
pAddr
->
port
=
htons
(
pAddr
->
port
);
EXPECT_EQ
(
pAddr
->
port
,
9040
);
EXPECT_STREQ
(
pAddr
->
fqdn
,
"localhost"
);
}
{
SVgroupInfo
*
pInfo
=
&
pRsp
->
vgroupInfo
[
1
];
pInfo
->
vgId
=
htonl
(
pInfo
->
vgId
);
pInfo
->
hashBegin
=
htonl
(
pInfo
->
hashBegin
);
pInfo
->
hashEnd
=
htonl
(
pInfo
->
hashEnd
);
EXPECT_GT
(
pInfo
->
vgId
,
0
);
EXPECT_EQ
(
pInfo
->
hashBegin
,
INT32_MAX
/
2
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
INT32_MAX
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
SEpAddrMsg
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
pAddr
->
port
=
htons
(
pAddr
->
port
);
EXPECT_EQ
(
pAddr
->
port
,
9040
);
EXPECT_STREQ
(
pAddr
->
fqdn
,
"localhost"
);
}
}
}
source/dnode/mgmt/impl/test/dnode/dnode.cpp
浏览文件 @
ea240d61
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
/**
* @file vnodeApiTests.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module dnode-msg tests
* @version 0.1
* @date 2021-12-15
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* @copyright Copyright (c) 2021
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
...
...
@@ -224,19 +220,21 @@ TEST_F(DndTestDnode, 02_ConfigDnode) {
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
TEST_F
(
DndTestDnode
,
03
_CreateDnode
)
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9042"
);
TEST_F
(
DndTestDnode
,
03
_Create_Drop_Reatrt_Dnode
)
{
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9042"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateDnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_DNODE
;
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateDnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_DNODE
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
taosMsleep
(
1300
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DNODE
,
"show dnodes"
,
7
);
...
...
@@ -255,21 +253,21 @@ TEST_F(DndTestDnode, 03_CreateDnode) {
CheckTimestamp
();
CheckBinary
(
""
,
24
);
CheckBinary
(
""
,
24
);
}
TEST_F
(
DndTestDnode
,
04
_DropDnode
)
{
SDropDnodeMsg
*
pReq
=
(
SDropDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SDropDnodeMsg
));
pReq
->
dnodeId
=
htonl
(
2
);
{
SDropDnodeMsg
*
pReq
=
(
SDropDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SDropDnodeMsg
));
pReq
->
dnodeId
=
htonl
(
2
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SDropDnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_DNODE
;
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SDropDnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_DNODE
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DNODE
,
"show dnodes"
,
7
);
SendThenCheckShowRetrieveMsg
(
1
);
...
...
@@ -280,9 +278,7 @@ TEST_F(DndTestDnode, 04_DropDnode) {
CheckBinary
(
"ready"
,
10
);
CheckTimestamp
();
CheckBinary
(
""
,
24
);
}
TEST_F
(
DndTestDnode
,
05
_CreateDnode
)
{
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9043"
);
...
...
@@ -359,9 +355,8 @@ TEST_F(DndTestDnode, 05_CreateDnode) {
CheckBinary
(
""
,
24
);
CheckBinary
(
""
,
24
);
CheckBinary
(
""
,
24
);
}
TEST_F
(
DndTestDnode
,
06
_RestartDnode
)
{
// restart
uInfo
(
"stop all server"
);
stopServer
(
pServer1
);
stopServer
(
pServer2
);
...
...
source/dnode/mgmt/impl/test/profile/profile.cpp
浏览文件 @
ea240d61
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
/**
* @file vnodeApiTests.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module profile-msg tests
* @version 0.1
* @date 2021-12-15
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* @copyright Copyright (c) 2021
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
...
...
source/dnode/mgmt/impl/test/show/show.cpp
浏览文件 @
ea240d61
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
/**
* @file vnodeApiTests.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module show-msg tests
* @version 0.1
* @date 2021-12-15
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* @copyright Copyright (c) 2021
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
...
...
source/dnode/mgmt/impl/test/user/user.cpp
浏览文件 @
ea240d61
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
/**
* @file vnodeApiTests.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module user-msg tests
* @version 0.1
* @date 2021-12-15
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* @copyright Copyright (c) 2021
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
...
...
@@ -184,7 +180,7 @@ TEST_F(DndTestUser, 01_ShowUser) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
02
_CreateUser
)
{
TEST_F
(
DndTestUser
,
02
_Create
_Drop_Alter_
User
)
{
{
SCreateUserMsg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
...
...
@@ -231,23 +227,22 @@ TEST_F(DndTestUser, 02_CreateUser) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
03
_AlterUser
)
{
SAlterUserMsg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p2"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SAlterUserMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_ALTER_USER
;
{
SAlterUserMsg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p2"
);
sendMsg
(
pClient
,
&
rpcMsg
)
;
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
)
;
SRpcMsg
rpcMsg
=
{
0
}
;
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SAlterUserMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_ALTER_USER
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_USER
,
"show users"
,
4
);
SendThenCheckShowRetrieveMsg
(
3
);
CheckBinary
(
"u1"
,
TSDB_USER_LEN
);
...
...
@@ -262,22 +257,21 @@ TEST_F(DndTestUser, 03_AlterUser) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
04
_DropUser
)
{
SDropUserMsg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
sizeof
(
SDropUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SDropUserMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_USER
;
{
SDropUserMsg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
sizeof
(
SDropUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
sendMsg
(
pClient
,
&
rpcMsg
)
;
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
)
;
SRpcMsg
rpcMsg
=
{
0
}
;
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SDropUserMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_USER
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_USER
,
"show users"
,
4
);
SendThenCheckShowRetrieveMsg
(
2
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
...
...
@@ -288,9 +282,8 @@ TEST_F(DndTestUser, 04_DropUser) {
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
05
_RestartDnode
)
{
// restart
stopServer
(
pServer
);
pServer
=
NULL
;
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
ea240d61
...
...
@@ -42,13 +42,6 @@ extern int32_t mDebugFlag;
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
typedef
struct
SClusterObj
SClusterObj
;
typedef
struct
SMnodeObj
SMnodeObj
;
typedef
struct
SAcctObj
SAcctObj
;
typedef
struct
SVgObj
SVgObj
;
typedef
struct
SFuncObj
SFuncObj
;
typedef
struct
SOperObj
SOperObj
;
typedef
enum
{
MND_AUTH_ACCT_START
=
0
,
MND_AUTH_ACCT_USER
,
...
...
@@ -99,7 +92,7 @@ typedef enum {
DND_REASON_OTHERS
}
EDndReason
;
typedef
struct
STrans
{
typedef
struct
{
int32_t
id
;
ETrnStage
stage
;
ETrnPolicy
policy
;
...
...
@@ -111,7 +104,7 @@ typedef struct STrans {
SArray
*
undoActions
;
}
STrans
;
typedef
struct
SClusterObj
{
typedef
struct
{
int32_t
id
;
char
name
[
TSDB_CLUSTER_ID_LEN
];
int64_t
createdTime
;
...
...
@@ -139,7 +132,7 @@ typedef struct {
char
ep
[
TSDB_EP_LEN
];
}
SDnodeObj
;
typedef
struct
SMnodeObj
{
typedef
struct
{
int32_t
id
;
int64_t
createdTime
;
int64_t
updateTime
;
...
...
@@ -167,7 +160,7 @@ typedef struct {
int64_t
compStorage
;
// Compressed storage on disk
}
SAcctInfo
;
typedef
struct
SAcctObj
{
typedef
struct
{
char
acct
[
TSDB_USER_LEN
];
int64_t
createdTime
;
int64_t
updateTime
;
...
...
@@ -195,8 +188,8 @@ typedef struct {
int32_t
daysToKeep0
;
int32_t
daysToKeep1
;
int32_t
daysToKeep2
;
int32_t
minRows
PerFileBlock
;
int32_t
maxRows
PerFileBlock
;
int32_t
minRows
;
int32_t
maxRows
;
int32_t
commitTime
;
int32_t
fsyncPeriod
;
int8_t
walLevel
;
...
...
@@ -214,7 +207,10 @@ typedef struct {
int64_t
createdTime
;
int64_t
updateTime
;
int64_t
uid
;
int32_t
version
;
int32_t
cfgVersion
;
int32_t
vgVersion
;
int32_t
numOfVgroups
;
int8_t
hashMethod
;
// default is 1
SDbCfg
cfg
;
}
SDbObj
;
...
...
@@ -223,12 +219,15 @@ typedef struct {
ESyncState
role
;
}
SVnodeGid
;
typedef
struct
SVgObj
{
typedef
struct
{
int32_t
vgId
;
int64_t
createdTime
;
int64_t
updateTime
;
int32_t
version
;
int32_t
hashBegin
;
int32_t
hashEnd
;
char
dbName
[
TSDB_FULL_DB_NAME_LEN
];
int64_t
dbUid
;
int32_t
numOfTables
;
int32_t
numOfTimeSeries
;
int64_t
totalStorage
;
...
...
@@ -252,7 +251,7 @@ typedef struct {
SSchema
*
pSchema
;
}
SStbObj
;
typedef
struct
SFuncObj
{
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
int64_t
createdTime
;
int8_t
funcType
;
...
...
source/dnode/mnode/impl/inc/mndDnode.h
浏览文件 @
ea240d61
...
...
@@ -28,6 +28,7 @@ SDnodeObj *mndAcquireDnode(SMnode *pMnode, int32_t dnodeId);
void
mndReleaseDnode
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
);
SEpSet
mndGetDnodeEpset
(
SDnodeObj
*
pDnode
);
int32_t
mndGetDnodeSize
(
SMnode
*
pMnode
);
bool
mndIsDnodeInReadyStatus
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndVgroup.h
浏览文件 @
ea240d61
...
...
@@ -22,10 +22,13 @@
extern
"C"
{
#endif
int32_t
mndInitVgroup
(
SMnode
*
pMnode
);
void
mndCleanupVgroup
(
SMnode
*
pMnode
);
SVgObj
*
mndAcquireVgroup
(
SMnode
*
pMnode
,
int32_t
vgId
);
void
mndReleaseVgroup
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
);
int32_t
mndInitVgroup
(
SMnode
*
pMnode
);
void
mndCleanupVgroup
(
SMnode
*
pMnode
);
SVgObj
*
mndAcquireVgroup
(
SMnode
*
pMnode
,
int32_t
vgId
);
void
mndReleaseVgroup
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
);
int32_t
mndAllocVgroup
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SVgObj
**
ppVgroups
);
SSdbRaw
*
mndVgroupActionEncode
(
SVgObj
*
pVgroup
);
SSdbRow
*
mndVgroupActionDecode
(
SSdbRaw
*
pRaw
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
ea240d61
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
ea240d61
...
...
@@ -218,6 +218,15 @@ int32_t mndGetDnodeSize(SMnode *pMnode) {
return
sdbGetSize
(
pSdb
,
SDB_DNODE
);
}
bool
mndIsDnodeInReadyStatus
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
)
{
int64_t
ms
=
taosGetTimestampMs
();
int64_t
interval
=
ABS
(
pDnode
->
lastAccessTime
-
ms
);
if
(
interval
>
3000
*
pMnode
->
cfg
.
statusInterval
)
{
return
false
;
}
return
true
;
}
static
void
mndGetDnodeData
(
SMnode
*
pMnode
,
SDnodeEps
*
pEps
,
int32_t
numOfEps
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
ea240d61
...
...
@@ -24,11 +24,9 @@
#define TSDB_VGROUP_VER_NUM 1
#define TSDB_VGROUP_RESERVE_SIZE 64
static
SSdbRaw
*
mndVgroupActionEncode
(
SVgObj
*
pVgroup
);
static
SSdbRow
*
mndVgroupActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndVgroupActionInsert
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionDelete
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOldVgroup
,
SVgObj
*
pNewVgroup
);
static
int32_t
mndVgroupActionInsert
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionDelete
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOldVgroup
,
SVgObj
*
pNewVgroup
);
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
pMsg
);
...
...
@@ -70,8 +68,8 @@ int32_t mndInitVgroup(SMnode *pMnode) {
void
mndCleanupVgroup
(
SMnode
*
pMnode
)
{}
static
SSdbRaw
*
mndVgroupActionEncode
(
SVgObj
*
pVgroup
)
{
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_
DB
,
TSDB_VGROUP_VER_NUM
,
sizeof
(
SVgObj
)
+
TSDB_VGROUP_RESERVE_SIZE
);
SSdbRaw
*
mndVgroupActionEncode
(
SVgObj
*
pVgroup
)
{
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_
VGROUP
,
TSDB_VGROUP_VER_NUM
,
sizeof
(
SVgObj
)
+
TSDB_VGROUP_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
...
...
@@ -79,7 +77,10 @@ static SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pVgroup
->
createdTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pVgroup
->
updateTime
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pVgroup
->
version
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pVgroup
->
hashBegin
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pVgroup
->
hashEnd
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pVgroup
->
dbName
,
TSDB_FULL_DB_NAME_LEN
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pVgroup
->
dbUid
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pVgroup
->
replica
)
for
(
int8_t
i
=
0
;
i
<
pVgroup
->
replica
;
++
i
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
...
...
@@ -92,7 +93,7 @@ static SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup) {
return
pRaw
;
}
static
SSdbRow
*
mndVgroupActionDecode
(
SSdbRaw
*
pRaw
)
{
SSdbRow
*
mndVgroupActionDecode
(
SSdbRaw
*
pRaw
)
{
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
return
NULL
;
...
...
@@ -102,7 +103,7 @@ static SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
return
NULL
;
}
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
S
Db
Obj
));
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
S
Vg
Obj
));
SVgObj
*
pVgroup
=
sdbGetRowObj
(
pRow
);
if
(
pVgroup
==
NULL
)
return
NULL
;
...
...
@@ -111,7 +112,10 @@ static SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pVgroup
->
createdTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pVgroup
->
updateTime
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pVgroup
->
version
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pVgroup
->
hashBegin
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pVgroup
->
hashEnd
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pVgroup
->
dbName
,
TSDB_FULL_DB_NAME_LEN
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pVgroup
->
dbUid
)
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pVgroup
->
replica
)
for
(
int8_t
i
=
0
;
i
<
pVgroup
->
replica
;
++
i
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
...
...
@@ -133,12 +137,6 @@ static int32_t mndVgroupActionDelete(SSdb *pSdb, SVgObj *pVgroup) {
return
0
;
}
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessDropVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessSyncVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOldVgroup
,
SVgObj
*
pNewVgroup
)
{
mTrace
(
"vgId:%d, perform update action"
,
pOldVgroup
->
vgId
);
pOldVgroup
->
updateTime
=
pNewVgroup
->
updateTime
;
...
...
@@ -158,6 +156,105 @@ void mndReleaseVgroup(SMnode *pMnode, SVgObj *pVgroup) {
sdbRelease
(
pSdb
,
pVgroup
);
}
static
int32_t
mndGetDefaultVgroupSize
(
SMnode
*
pMnode
)
{
// todo
return
2
;
}
static
int32_t
mndGetAvailableDnode
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
allocedVnodes
=
0
;
void
*
pIter
=
NULL
;
while
(
allocedVnodes
<
pVgroup
->
replica
)
{
SDnodeObj
*
pDnode
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
);
if
(
pIter
==
NULL
)
break
;
// todo
if
(
mndIsDnodeInReadyStatus
(
pMnode
,
pDnode
))
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
allocedVnodes
];
pVgid
->
dnodeId
=
pDnode
->
id
;
if
(
pVgroup
->
replica
==
1
)
{
pVgid
->
role
=
TAOS_SYNC_STATE_LEADER
;
}
else
{
pVgid
->
role
=
TAOS_SYNC_STATE_FOLLOWER
;
}
allocedVnodes
++
;
}
sdbRelease
(
pSdb
,
pDnode
);
}
if
(
allocedVnodes
!=
pVgroup
->
replica
)
{
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
return
-
1
;
}
return
0
;
}
int32_t
mndAllocVgroup
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SVgObj
**
ppVgroups
)
{
if
(
pDb
->
numOfVgroups
!=
-
1
&&
(
pDb
->
numOfVgroups
<
TSDB_MIN_VNODES_PER_DB
||
pDb
->
numOfVgroups
>
TSDB_MAX_VNODES_PER_DB
))
{
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
return
-
1
;
}
if
(
pDb
->
numOfVgroups
==
-
1
)
{
pDb
->
numOfVgroups
=
mndGetDefaultVgroupSize
(
pMnode
);
if
(
pDb
->
numOfVgroups
<
0
)
{
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
return
-
1
;
}
}
SVgObj
*
pVgroups
=
calloc
(
pDb
->
numOfVgroups
,
sizeof
(
SVgObj
));
if
(
pVgroups
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
int32_t
alloceVgroups
=
0
;
int32_t
maxVgId
=
sdbGetMaxId
(
pMnode
->
pSdb
,
SDB_VGROUP
);
int32_t
hashMin
=
0
;
int32_t
hashMax
=
INT32_MAX
;
int32_t
hashInterval
=
(
hashMax
-
hashMin
)
/
pDb
->
numOfVgroups
;
for
(
int32_t
v
=
0
;
v
<
pDb
->
numOfVgroups
;
v
++
)
{
SVgObj
*
pVgroup
=
&
pVgroups
[
v
];
pVgroup
->
vgId
=
maxVgId
++
;
pVgroup
->
createdTime
=
taosGetTimestampMs
();
pVgroup
->
updateTime
=
pVgroups
->
createdTime
;
pVgroup
->
version
=
1
;
pVgroup
->
dbUid
=
pDb
->
uid
;
pVgroup
->
hashBegin
=
hashMin
+
hashInterval
*
v
;
if
(
v
==
pDb
->
numOfVgroups
-
1
)
{
pVgroup
->
hashEnd
=
hashMax
;
}
else
{
pVgroup
->
hashEnd
=
hashMin
+
hashInterval
*
(
v
+
1
)
-
1
;
}
memcpy
(
pVgroup
->
dbName
,
pDb
->
name
,
TSDB_FULL_DB_NAME_LEN
);
pVgroup
->
replica
=
pDb
->
cfg
.
replications
;
if
(
mndGetAvailableDnode
(
pMnode
,
pVgroup
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
free
(
pVgroups
);
return
-
1
;
}
alloceVgroups
++
;
}
*
ppVgroups
=
pVgroups
;
return
0
;
}
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessDropVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessSyncVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndGetVgroupMaxReplica
(
SMnode
*
pMnode
,
char
*
dbName
,
int8_t
*
pReplica
,
int32_t
*
pNumOfVgroups
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
@@ -213,7 +310,7 @@ static int32_t mndGetVgroupMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
cols
++
;
for
(
int32_t
i
=
0
;
i
<
pShow
->
replica
;
++
i
)
{
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
snprintf
(
pSchema
[
cols
].
name
,
TSDB_COL_NAME_LEN
,
"v%d_dnode"
,
i
+
1
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
@@ -273,10 +370,6 @@ static int32_t mndRetrieveVgroups(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
cols
++
;
}
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int8_t
*
)
pWrite
=
pVgroup
->
compact
;
cols
++
;
sdbRelease
(
pSdb
,
pVgroup
);
numOfRows
++
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录