Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5bc20e44
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
未验证
提交
5bc20e44
编写于
12月 15, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
12月 15, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9103 from taosdata/feature/dnode3
Feature/dnode3
上级
ac7bcea2
16a660d8
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
737 addition
and
292 deletion
+737
-292
include/common/taosmsg.h
include/common/taosmsg.h
+12
-7
include/util/taoserror.h
include/util/taoserror.h
+80
-84
include/util/tdef.h
include/util/tdef.h
+1
-0
source/dnode/mgmt/impl/test/CMakeLists.txt
source/dnode/mgmt/impl/test/CMakeLists.txt
+14
-1
source/dnode/mgmt/impl/test/acct/CMakeLists.txt
source/dnode/mgmt/impl/test/acct/CMakeLists.txt
+6
-6
source/dnode/mgmt/impl/test/acct/acct.cpp
source/dnode/mgmt/impl/test/acct/acct.cpp
+13
-10
source/dnode/mgmt/impl/test/db/CMakeLists.txt
source/dnode/mgmt/impl/test/db/CMakeLists.txt
+29
-0
source/dnode/mgmt/impl/test/db/db.cpp
source/dnode/mgmt/impl/test/db/db.cpp
+355
-0
source/dnode/mgmt/impl/test/dnode/CMakeLists.txt
source/dnode/mgmt/impl/test/dnode/CMakeLists.txt
+6
-6
source/dnode/mgmt/impl/test/dnode/dnode.cpp
source/dnode/mgmt/impl/test/dnode/dnode.cpp
+35
-35
source/dnode/mgmt/impl/test/user/CMakeLists.txt
source/dnode/mgmt/impl/test/user/CMakeLists.txt
+6
-6
source/dnode/mgmt/impl/test/user/user.cpp
source/dnode/mgmt/impl/test/user/user.cpp
+11
-11
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+8
-9
source/dnode/mnode/impl/inc/mndShow.h
source/dnode/mnode/impl/inc/mndShow.h
+1
-1
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+19
-19
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+1
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+82
-36
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+4
-3
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+1
-1
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+1
-1
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+2
-2
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+3
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+2
-2
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+8
-8
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-2
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+2
-2
source/util/src/terror.c
source/util/src/terror.c
+33
-38
未找到文件。
include/common/taosmsg.h
浏览文件 @
5bc20e44
...
...
@@ -168,8 +168,8 @@ typedef enum _mgmt_table {
TSDB_MGMT_TABLE_SCORES
,
TSDB_MGMT_TABLE_GRANTS
,
TSDB_MGMT_TABLE_VNODES
,
TSDB_MGMT_TABLE_STREAMTABLES
,
TSDB_MGMT_TABLE_CLUSTER
,
TSDB_MGMT_TABLE_STREAMTABLES
,
TSDB_MGMT_TABLE_TP
,
TSDB_MGMT_TABLE_FUNCTION
,
TSDB_MGMT_TABLE_MAX
,
...
...
@@ -396,17 +396,20 @@ typedef struct {
int32_t
maxDbs
;
int32_t
maxTimeSeries
;
int32_t
maxStreams
;
int64_t
maxStorage
;
// In unit of GB
int32_t
accessState
;
// Configured only by command
int64_t
maxStorage
;
// In unit of GB
int32_t
reserve
[
8
];
}
SCreateAcctMsg
,
SAlterAcctMsg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
int32_t
reserve
[
8
];
}
SDropUserMsg
,
SDropAcctMsg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
int32_t
reserve
[
8
];
}
SCreateUserMsg
,
SAlterUserMsg
;
typedef
struct
{
...
...
@@ -629,7 +632,6 @@ typedef struct {
int32_t
reserve
[
8
];
}
SUseDbMsg
;
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
int32_t
reserve
[
8
];
...
...
@@ -897,16 +899,19 @@ typedef struct SShowRsp {
}
SShowRsp
;
typedef
struct
{
char
ep
[
TSDB_EP_LEN
];
// end point, hostname:port
char
ep
[
TSDB_EP_LEN
];
// end point, hostname:port
int32_t
reserve
[
8
];
}
SCreateDnodeMsg
;
typedef
struct
{
int32_t
dnodeId
;
int32_t
reserve
[
8
];
}
SDropDnodeMsg
;
typedef
struct
{
int32_t
dnodeId
;
char
config
[
TSDB_DNODE_CONFIG_LEN
];
int32_t
reserve
[
8
];
}
SCfgDnodeMsg
;
typedef
struct
{
...
...
include/util/taoserror.h
浏览文件 @
5bc20e44
...
...
@@ -119,71 +119,91 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223) //"Value out of range")
#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0X0224) //"Invalid tsc input")
// mnode
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300)
#define TSDB_CODE_MND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0301)
#define TSDB_CODE_MND_ACTION_NEED_REPROCESSED TAOS_DEF_ERROR_CODE(0, 0x0302)
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0303)
#define TSDB_CODE_MND_INVALID_OPTIONS TAOS_DEF_ERROR_CODE(0, 0x0304)
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0305)
#define TSDB_CODE_MND_INVALID_MSG_VERSION TAOS_DEF_ERROR_CODE(0, 0x0306)
#define TSDB_CODE_MND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0307)
#define TSDB_CODE_MND_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0308)
#define TSDB_CODE_MND_TOO_MANY_SHELL_CONNS TAOS_DEF_ERROR_CODE(0, 0x0309)
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x030B)
#define TSDB_CODE_MND_INVALID_QUERY_ID TAOS_DEF_ERROR_CODE(0, 0x030C)
#define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x030D)
#define TSDB_CODE_MND_INVALID_CONN_ID TAOS_DEF_ERROR_CODE(0, 0x030E)
#define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0310)
#define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0311)
#define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0312)
#define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0313)
#define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0314)
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0320)
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0321)
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0322)
#define TSDB_CODE_SDB_OBJ_CREATING TAOS_DEF_ERROR_CODE(0, 0x0323)
#define TSDB_CODE_SDB_OBJ_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0324)
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325)
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0326)
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0327)
#define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0328)
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0329)
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x032A)
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x032B)
// mnode-common
#define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0300)
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0301)
#define TSDB_CODE_MND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0302)
#define TSDB_CODE_MND_ACTION_NEED_REPROCESSED TAOS_DEF_ERROR_CODE(0, 0x0303)
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0304)
#define TSDB_CODE_MND_INVALID_OPTIONS TAOS_DEF_ERROR_CODE(0, 0x0305)
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0306)
#define TSDB_CODE_MND_INVALID_MSG_VERSION TAOS_DEF_ERROR_CODE(0, 0x0307)
#define TSDB_CODE_MND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0308)
#define TSDB_CODE_MND_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0309)
#define TSDB_CODE_MND_TOO_MANY_SHELL_CONNS TAOS_DEF_ERROR_CODE(0, 0x030A)
// mnode-show
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x0310)
// mnode-profile
#define TSDB_CODE_MND_INVALID_QUERY_ID TAOS_DEF_ERROR_CODE(0, 0x0320)
#define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x0321)
#define TSDB_CODE_MND_INVALID_CONN_ID TAOS_DEF_ERROR_CODE(0, 0x0322)
#define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0323)
#define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0324)
#define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0325)
#define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0326)
#define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0327)
// mnode-sdb
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0330)
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0331)
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0332)
#define TSDB_CODE_SDB_OBJ_CREATING TAOS_DEF_ERROR_CODE(0, 0x0333)
#define TSDB_CODE_SDB_OBJ_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0334)
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0335)
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0336)
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0337)
#define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0338)
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0339)
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x033A)
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x033B)
// mnode-dnode
#define TSDB_CODE_MND_DNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03
3
0)
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03
3
1)
#define TSDB_CODE_MND_
NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x033
2)
#define TSDB_CODE_MND_
INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x033
3)
#define TSDB_CODE_MND_INVALID_CLUSTER_
ID TAOS_DEF_ERROR_CODE(0, 0x033
4)
#define TSDB_CODE_MND_INVALID_
DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x033
5)
#define TSDB_CODE_MND_INVALID_DNODE_
EP TAOS_DEF_ERROR_CODE(0, 0x033
6)
#define TSDB_CODE_MND_INVALID_DNODE_
ID TAOS_DEF_ERROR_CODE(0, 0x033
7)
// mnode-vgroup
#define TSDB_CODE_MND_VGROUP_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0332) //"VGroup does not exist")
#define TSDB_CODE_MND_
VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0338) //"Vgroup not in dnode"
)
#define TSDB_CODE_MND_
VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0339) //"Vgroup already in dnode"
)
#define TSDB_CODE_MND_
NOT_READY TAOS_DEF_ERROR_CODE(0, 0x033C) //"Cluster not ready"
)
#define TSDB_CODE_MND_DNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03
4
0)
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03
4
1)
#define TSDB_CODE_MND_
TOO_MANY_DNODES TAOS_DEF_ERROR_CODE(0, 0x034
2)
#define TSDB_CODE_MND_
NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x034
3)
#define TSDB_CODE_MND_INVALID_CLUSTER_
CFG TAOS_DEF_ERROR_CODE(0, 0x034
4)
#define TSDB_CODE_MND_INVALID_
CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x034
5)
#define TSDB_CODE_MND_INVALID_DNODE_
CFG TAOS_DEF_ERROR_CODE(0, 0x034
6)
#define TSDB_CODE_MND_INVALID_DNODE_
EP TAOS_DEF_ERROR_CODE(0, 0x034
7)
#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x0348)
// mnode-mnode
#define TSDB_CODE_MND_
MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0350
)
#define TSDB_CODE_MND_
MNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0351
)
#define TSDB_CODE_MND_
TOO_MANY_MNODES TAOS_DEF_ERROR_CODE(0, 0x0352
)
// mnode-acct
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340) //"Account already exists")
#define TSDB_CODE_MND_ACCT_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0341) //"Invalid account")
#define TSDB_CODE_MND_INVALID_ACCT_OPTION TAOS_DEF_ERROR_CODE(0, 0x0342) //"Invalid account options")
#define TSDB_CODE_MND_ACCT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0343) //"Account authorization has expired")
#define TSDB_CODE_MND_USER_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0350) //"User already exists")
#define TSDB_CODE_MND_USER_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0351) //"Invalid user")
#define TSDB_CODE_MND_INVALID_USER_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0352) //"Invalid user format")
#define TSDB_CODE_MND_INVALID_PASS_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0353) //"Invalid password format")
#define TSDB_CODE_MND_NO_USER_FROM_CONN TAOS_DEF_ERROR_CODE(0, 0x0354) //"Can not get user from conn")
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0355) //"Too many users")
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
#define TSDB_CODE_MND_ACCT_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0361)
#define TSDB_CODE_MND_TOO_MANY_ACCTS TAOS_DEF_ERROR_CODE(0, 0x0362)
#define TSDB_CODE_MND_INVALID_ACCT_OPTION TAOS_DEF_ERROR_CODE(0, 0x0363)
#define TSDB_CODE_MND_ACCT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0364)
// mnode-user
#define TSDB_CODE_MND_USER_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0370)
#define TSDB_CODE_MND_USER_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0371)
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0372)
#define TSDB_CODE_MND_INVALID_USER_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0373)
#define TSDB_CODE_MND_INVALID_PASS_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0374)
#define TSDB_CODE_MND_NO_USER_FROM_CONN TAOS_DEF_ERROR_CODE(0, 0x0375)
// mnode-db
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0380)
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0382)
#define TSDB_CODE_MND_DB_NOT_SELECTED TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0384)
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0385)
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0386)
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x0387)
#define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0348) //"Mnode already exists")
#define TSDB_CODE_MND_MNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0349) //"Mnode not there")
// mnode-vgroup
#define TSDB_CODE_MND_VGROUP_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0390)
#define TSDB_CODE_MND_VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0391)
#define TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0392)
// mnode-stable
#define TSDB_CODE_MND_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
...
...
@@ -224,30 +244,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_INVALID_TAG_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0376) //"invalid tag length")
#define TSDB_CODE_MND_INVALID_COLUMN_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0377) //"invalid column length")
#define TSDB_CODE_MND_DB_NOT_SELECTED TAOS_DEF_ERROR_CODE(0, 0x0380)
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0382)
#define TSDB_CODE_MND_INVALID_DB_CACHE_SIZE TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_TOTAL_BLOCKS TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_DAYS TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_KEEP0 TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_KEEP1 TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_KEEP2 TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_MIN_ROWS TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_MAX_ROWS TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_COMMIT_TIME TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_FSYNC_PERIOD TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_WAL_LEVEL TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_PRECISION TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_COMP TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_REPLICA TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_QUORUM TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_UPDATE TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_INVALID_DB_CACHE_LAST TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0385) //"Too many databases for account")
// dnode
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0400)
...
...
include/util/tdef.h
浏览文件 @
5bc20e44
...
...
@@ -211,6 +211,7 @@ do { \
#define TSDB_STEP_NAME_LEN 32
#define TSDB_STEP_DESC_LEN 128
#define TSDB_ERROR_MSG_LEN 1024
#define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_MQTT_HOSTNAME_LEN 64
...
...
source/dnode/mgmt/impl/test/CMakeLists.txt
浏览文件 @
5bc20e44
# add_subdirectory(acct)
add_subdirectory
(
acct
)
# add_subdirectory(auth)
# add_subdirectory(balance)
# add_subdirectory(cluster)
add_subdirectory
(
db
)
add_subdirectory
(
dnode
)
# add_subdirectory(func)
# add_subdirectory(mnode)
# add_subdirectory(profile)
# add_subdirectory(show)
# add_subdirectory(stb)
# add_subdirectory(sync)
# add_subdirectory(telem)
# add_subdirectory(trans)
add_subdirectory
(
user
)
# add_subdirectory(vgroup)
# add_subdirectory(common)
source/dnode/mgmt/impl/test/acct/CMakeLists.txt
浏览文件 @
5bc20e44
add_executable
(
dn
dTestA
cct
""
)
add_executable
(
dn
ode_test_a
cct
""
)
target_sources
(
dn
dTestA
cct
target_sources
(
dn
ode_test_a
cct
PRIVATE
"acct.cpp"
"../sut/deploy.cpp"
)
target_link_libraries
(
dn
dTestA
cct
dn
ode_test_a
cct
PUBLIC dnode
PUBLIC util
PUBLIC os
PUBLIC gtest_main
)
target_include_directories
(
dn
dTestA
cct
target_include_directories
(
dn
ode_test_a
cct
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
...
...
@@ -24,6 +24,6 @@ target_include_directories(dndTestAcct
enable_testing
()
add_test
(
NAME dn
dTestA
cct
COMMAND dn
dTestA
cct
NAME dn
ode_test_a
cct
COMMAND dn
ode_test_a
cct
)
source/dnode/mgmt/impl/test/acct/acct.cpp
浏览文件 @
5bc20e44
...
...
@@ -17,24 +17,27 @@
class
DndTestAcct
:
public
::
testing
::
Test
{
protected:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
static
SServer
*
CreateServer
(
const
char
*
path
,
const
char
*
fqdn
,
uint16_t
port
,
const
char
*
firstEp
)
{
SServer
*
pServer
=
createServer
(
path
,
fqdn
,
port
,
firstEp
);
ASSERT
(
pServer
);
return
pServer
;
}
static
void
SetUpTestSuite
()
{
const
char
*
user
=
"root"
;
const
char
*
pass
=
"taosdata"
;
const
char
*
path
=
"/tmp/dndTestAcct"
;
const
char
*
fqdn
=
"localhost"
;
uint16_t
port
=
9520
;
initLog
(
"/tmp/tdlog"
);
pServer
=
createServer
(
path
,
fqdn
,
port
);
ASSERT
(
pServer
);
pClient
=
createClient
(
user
,
pass
,
fqdn
,
port
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9012"
;
pServer
=
CreateServer
(
"/tmp/dnode_test_user"
,
fqdn
,
9012
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9012
);
taosMsleep
(
300
);
}
static
void
TearDownTestSuite
()
{
stopServer
(
pServer
);
dropClient
(
pClient
);
pServer
=
NULL
;
pClient
=
NULL
;
}
static
SServer
*
pServer
;
...
...
source/dnode/mgmt/impl/test/db/CMakeLists.txt
0 → 100644
浏览文件 @
5bc20e44
add_executable
(
dnode_test_db
""
)
target_sources
(
dnode_test_db
PRIVATE
"db.cpp"
"../sut/deploy.cpp"
)
target_link_libraries
(
dnode_test_db
PUBLIC dnode
PUBLIC util
PUBLIC os
PUBLIC gtest_main
)
target_include_directories
(
dnode_test_db
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../sut"
)
enable_testing
()
add_test
(
NAME dnode_test_db
COMMAND dnode_test_db
)
source/dnode/mgmt/impl/test/db/db.cpp
0 → 100644
浏览文件 @
5bc20e44
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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.
*
* 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"
class
DndTestDb
:
public
::
testing
::
Test
{
protected:
static
SServer
*
CreateServer
(
const
char
*
path
,
const
char
*
fqdn
,
uint16_t
port
,
const
char
*
firstEp
)
{
SServer
*
pServer
=
createServer
(
path
,
fqdn
,
port
,
firstEp
);
ASSERT
(
pServer
);
return
pServer
;
}
static
void
SetUpTestSuite
()
{
initLog
(
"/tmp/tdlog"
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9040"
;
pServer
=
CreateServer
(
"/tmp/dnode_test_db"
,
fqdn
,
9040
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9040
);
taosMsleep
(
300
);
}
static
void
TearDownTestSuite
()
{
stopServer
(
pServer
);
dropClient
(
pClient
);
pServer
=
NULL
;
pClient
=
NULL
;
}
static
SServer
*
pServer
;
static
SClient
*
pClient
;
static
int32_t
connId
;
public:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
void
SendTheCheckShowMetaMsg
(
int8_t
showType
,
const
char
*
showName
,
int32_t
columns
)
{
SShowMsg
*
pShow
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
pShow
->
type
=
showType
;
strcpy
(
pShow
->
db
,
""
);
SRpcMsg
showRpcMsg
=
{
0
};
showRpcMsg
.
pCont
=
pShow
;
showRpcMsg
.
contLen
=
sizeof
(
SShowMsg
);
showRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW
;
sendMsg
(
pClient
,
&
showRpcMsg
);
ASSERT_NE
(
pClient
->
pRsp
,
nullptr
);
ASSERT_EQ
(
pClient
->
pRsp
->
code
,
0
);
ASSERT_NE
(
pClient
->
pRsp
->
pCont
,
nullptr
);
SShowRsp
*
pShowRsp
=
(
SShowRsp
*
)
pClient
->
pRsp
->
pCont
;
ASSERT_NE
(
pShowRsp
,
nullptr
);
pShowRsp
->
showId
=
htonl
(
pShowRsp
->
showId
);
pMeta
=
&
pShowRsp
->
tableMeta
;
pMeta
->
numOfTags
=
htons
(
pMeta
->
numOfTags
);
pMeta
->
numOfColumns
=
htons
(
pMeta
->
numOfColumns
);
pMeta
->
sversion
=
htons
(
pMeta
->
sversion
);
pMeta
->
tversion
=
htons
(
pMeta
->
tversion
);
pMeta
->
tuid
=
htobe64
(
pMeta
->
tuid
);
pMeta
->
suid
=
htobe64
(
pMeta
->
suid
);
showId
=
pShowRsp
->
showId
;
EXPECT_NE
(
pShowRsp
->
showId
,
0
);
EXPECT_STREQ
(
pMeta
->
tbFname
,
showName
);
EXPECT_EQ
(
pMeta
->
numOfTags
,
0
);
EXPECT_EQ
(
pMeta
->
numOfColumns
,
columns
);
EXPECT_EQ
(
pMeta
->
precision
,
0
);
EXPECT_EQ
(
pMeta
->
tableType
,
0
);
EXPECT_EQ
(
pMeta
->
update
,
0
);
EXPECT_EQ
(
pMeta
->
sversion
,
0
);
EXPECT_EQ
(
pMeta
->
tversion
,
0
);
EXPECT_EQ
(
pMeta
->
tuid
,
0
);
EXPECT_EQ
(
pMeta
->
suid
,
0
);
}
void
CheckSchema
(
int32_t
index
,
int8_t
type
,
int32_t
bytes
,
const
char
*
name
)
{
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
index
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
type
);
EXPECT_EQ
(
pSchema
->
bytes
,
bytes
);
EXPECT_STREQ
(
pSchema
->
name
,
name
);
}
void
SendThenCheckShowRetrieveMsg
(
int32_t
rows
)
{
SRetrieveTableMsg
*
pRetrieve
=
(
SRetrieveTableMsg
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableMsg
));
pRetrieve
->
showId
=
htonl
(
showId
);
pRetrieve
->
free
=
0
;
SRpcMsg
retrieveRpcMsg
=
{
0
};
retrieveRpcMsg
.
pCont
=
pRetrieve
;
retrieveRpcMsg
.
contLen
=
sizeof
(
SRetrieveTableMsg
);
retrieveRpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW_RETRIEVE
;
sendMsg
(
pClient
,
&
retrieveRpcMsg
);
ASSERT_NE
(
pClient
->
pRsp
,
nullptr
);
ASSERT_EQ
(
pClient
->
pRsp
->
code
,
0
);
ASSERT_NE
(
pClient
->
pRsp
->
pCont
,
nullptr
);
pRetrieveRsp
=
(
SRetrieveTableRsp
*
)
pClient
->
pRsp
->
pCont
;
ASSERT_NE
(
pRetrieveRsp
,
nullptr
);
pRetrieveRsp
->
numOfRows
=
htonl
(
pRetrieveRsp
->
numOfRows
);
pRetrieveRsp
->
offset
=
htobe64
(
pRetrieveRsp
->
offset
);
pRetrieveRsp
->
useconds
=
htobe64
(
pRetrieveRsp
->
useconds
);
pRetrieveRsp
->
compLen
=
htonl
(
pRetrieveRsp
->
compLen
);
EXPECT_EQ
(
pRetrieveRsp
->
numOfRows
,
rows
);
EXPECT_EQ
(
pRetrieveRsp
->
offset
,
0
);
EXPECT_EQ
(
pRetrieveRsp
->
useconds
,
0
);
// EXPECT_EQ(pRetrieveRsp->completed, completed);
EXPECT_EQ
(
pRetrieveRsp
->
precision
,
TSDB_TIME_PRECISION_MILLI
);
EXPECT_EQ
(
pRetrieveRsp
->
compressed
,
0
);
EXPECT_EQ
(
pRetrieveRsp
->
reserved
,
0
);
EXPECT_EQ
(
pRetrieveRsp
->
compLen
,
0
);
pData
=
pRetrieveRsp
->
data
;
pos
=
0
;
}
void
CheckInt8
(
int8_t
val
)
{
int8_t
data
=
*
((
int8_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int8_t
);
EXPECT_EQ
(
data
,
val
);
}
void
CheckInt16
(
int16_t
val
)
{
int16_t
data
=
*
((
int16_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int16_t
);
EXPECT_EQ
(
data
,
val
);
}
void
CheckInt32
(
int32_t
val
)
{
int32_t
data
=
*
((
int32_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int32_t
);
EXPECT_EQ
(
data
,
val
);
}
void
CheckInt64
(
int64_t
val
)
{
int64_t
data
=
*
((
int64_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int64_t
);
EXPECT_EQ
(
data
,
val
);
}
void
CheckTimestamp
()
{
int64_t
data
=
*
((
int64_t
*
)(
pData
+
pos
));
pos
+=
sizeof
(
int64_t
);
EXPECT_GT
(
data
,
0
);
}
void
CheckBinary
(
const
char
*
val
,
int32_t
len
)
{
pos
+=
sizeof
(
VarDataLenT
);
char
*
data
=
(
char
*
)(
pData
+
pos
);
pos
+=
len
;
EXPECT_STREQ
(
data
,
val
);
}
int32_t
showId
;
STableMetaMsg
*
pMeta
;
SRetrieveTableRsp
*
pRetrieveRsp
;
char
*
pData
;
int32_t
pos
;
};
SServer
*
DndTestDb
::
pServer
;
SClient
*
DndTestDb
::
pClient
;
int32_t
DndTestDb
::
connId
;
TEST_F
(
DndTestDb
,
01
_ShowDb
)
{
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
16
);
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"
);
SendThenCheckShowRetrieveMsg
(
0
);
}
TEST_F
(
DndTestDb
,
02
_CreateDb
)
{
{
SCreateDbMsg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDbMsg
));
strcpy
(
pReq
->
db
,
"1.d1"
);
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"
,
16
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
1
);
// replica
CheckInt16
(
1
);
// quorum
CheckInt16
(
10
);
// days
CheckBinary
(
"3650,3650,3650"
,
24
);
// days
CheckInt32
(
16
);
// cache
CheckInt32
(
10
);
// blocks
CheckInt32
(
100
);
// minrows
CheckInt32
(
4096
);
// maxrows
CheckInt8
(
1
);
// wallevel
CheckInt32
(
3000
);
// fsync
CheckInt8
(
2
);
// comp
CheckInt8
(
0
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
}
TEST_F
(
DndTestDb
,
03
_AlterDb
)
{
{
SAlterDbMsg
*
pReq
=
(
SAlterDbMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterDbMsg
));
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
totalBlocks
=
htonl
(
12
);
pReq
->
daysToKeep0
=
htonl
(
300
);
pReq
->
daysToKeep1
=
htonl
(
400
);
pReq
->
daysToKeep2
=
htonl
(
500
);
pReq
->
fsyncPeriod
=
htonl
(
4000
);
pReq
->
walLevel
=
2
;
pReq
->
quorum
=
2
;
pReq
->
cacheLastRow
=
1
;
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SAlterDbMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_ALTER_DB
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
16
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
CheckBinary
(
"300,400,500"
,
24
);
// days
CheckInt32
(
16
);
// cache
CheckInt32
(
12
);
// blocks
CheckInt32
(
100
);
// minrows
CheckInt32
(
4096
);
// maxrows
CheckInt8
(
2
);
// wallevel
CheckInt32
(
4000
);
// fsync
CheckInt8
(
2
);
// comp
CheckInt8
(
1
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
}
TEST_F
(
DndTestDb
,
04
_RestartDnode
)
{
stopServer
(
pServer
);
pServer
=
NULL
;
uInfo
(
"start all server"
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9040"
;
pServer
=
startServer
(
"/tmp/dnode_test_db"
,
fqdn
,
9040
,
firstEp
);
uInfo
(
"all server is running"
);
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
16
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
CheckBinary
(
"300,400,500"
,
24
);
// days
CheckInt32
(
16
);
// cache
CheckInt32
(
12
);
// blocks
CheckInt32
(
100
);
// minrows
CheckInt32
(
4096
);
// maxrows
CheckInt8
(
2
);
// wallevel
CheckInt32
(
4000
);
// fsync
CheckInt8
(
2
);
// comp
CheckInt8
(
1
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
}
TEST_F
(
DndTestDb
,
05
_DropDb
)
{
{
SDropDbMsg
*
pReq
=
(
SDropDbMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterDbMsg
));
strcpy
(
pReq
->
db
,
"1.d1"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SDropDbMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_DB
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
"show databases"
,
16
);
SendThenCheckShowRetrieveMsg
(
0
);
}
\ No newline at end of file
source/dnode/mgmt/impl/test/dnode/CMakeLists.txt
浏览文件 @
5bc20e44
add_executable
(
dn
dTestD
node
""
)
add_executable
(
dn
ode_test_d
node
""
)
target_sources
(
dn
dTestD
node
target_sources
(
dn
ode_test_d
node
PRIVATE
"dnode.cpp"
"../sut/deploy.cpp"
)
target_link_libraries
(
dn
dTestD
node
dn
ode_test_d
node
PUBLIC dnode
PUBLIC util
PUBLIC os
PUBLIC gtest_main
)
target_include_directories
(
dn
dTestD
node
target_include_directories
(
dn
ode_test_d
node
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
...
...
@@ -24,6 +24,6 @@ target_include_directories(dndTestDnode
enable_testing
()
add_test
(
NAME dn
dTestD
node
COMMAND dn
dTestD
node
NAME dn
ode_test_d
node
COMMAND dn
ode_test_d
node
)
source/dnode/mgmt/impl/test/dnode/dnode.cpp
浏览文件 @
5bc20e44
...
...
@@ -24,16 +24,16 @@ class DndTestDnode : public ::testing::Test {
}
static
void
SetUpTestSuite
()
{
initLog
(
"/tmp/
dndTestDnode
"
);
initLog
(
"/tmp/
tdlog
"
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9
52
1"
;
pServer1
=
CreateServer
(
"/tmp/dn
dTestDnode1"
,
fqdn
,
952
1
,
firstEp
);
pServer2
=
CreateServer
(
"/tmp/dn
dTestDnode2"
,
fqdn
,
952
2
,
firstEp
);
pServer3
=
CreateServer
(
"/tmp/dn
dTestDnode3"
,
fqdn
,
952
3
,
firstEp
);
pServer4
=
CreateServer
(
"/tmp/dn
dTestDnode4"
,
fqdn
,
952
4
,
firstEp
);
pServer5
=
CreateServer
(
"/tmp/dn
dTestDnode5"
,
fqdn
,
952
5
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9
52
1
);
const
char
*
firstEp
=
"localhost:9
04
1"
;
pServer1
=
CreateServer
(
"/tmp/dn
ode_test_dnode1"
,
fqdn
,
904
1
,
firstEp
);
pServer2
=
CreateServer
(
"/tmp/dn
ode_test_dnode2"
,
fqdn
,
904
2
,
firstEp
);
pServer3
=
CreateServer
(
"/tmp/dn
ode_test_dnode3"
,
fqdn
,
904
3
,
firstEp
);
pServer4
=
CreateServer
(
"/tmp/dn
ode_test_dnode4"
,
fqdn
,
904
4
,
firstEp
);
pServer5
=
CreateServer
(
"/tmp/dn
ode_test_dnode5"
,
fqdn
,
904
5
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9
04
1
);
taosMsleep
(
300
);
}
...
...
@@ -188,7 +188,7 @@ SServer* DndTestDnode::pServer4;
SServer
*
DndTestDnode
::
pServer5
;
SClient
*
DndTestDnode
::
pClient
;
TEST_F
(
DndTestDnode
,
ShowDnode
)
{
TEST_F
(
DndTestDnode
,
01
_
ShowDnode
)
{
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DNODE
,
"show dnodes"
,
7
);
CheckSchema
(
0
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"id"
);
CheckSchema
(
1
,
TSDB_DATA_TYPE_BINARY
,
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
"end point"
);
...
...
@@ -200,7 +200,7 @@ TEST_F(DndTestDnode, ShowDnode) {
SendThenCheckShowRetrieveMsg
(
1
);
CheckInt16
(
1
);
CheckBinary
(
"localhost:9
52
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
1"
,
TSDB_EP_LEN
);
CheckInt16
(
0
);
CheckInt16
(
1
);
CheckBinary
(
"ready"
,
10
);
...
...
@@ -208,7 +208,7 @@ TEST_F(DndTestDnode, ShowDnode) {
CheckBinary
(
""
,
24
);
}
TEST_F
(
DndTestDnode
,
ConfigDnode_01
)
{
TEST_F
(
DndTestDnode
,
02
_ConfigDnode
)
{
SCfgDnodeMsg
*
pReq
=
(
SCfgDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCfgDnodeMsg
));
pReq
->
dnodeId
=
htonl
(
1
);
strcpy
(
pReq
->
config
,
"ddebugflag 131"
);
...
...
@@ -224,9 +224,9 @@ TEST_F(DndTestDnode, ConfigDnode_01) {
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
TEST_F
(
DndTestDnode
,
CreateDnode_01
)
{
TEST_F
(
DndTestDnode
,
03
_CreateDnode
)
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9
52
2"
);
strcpy
(
pReq
->
ep
,
"localhost:9
04
2"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
...
...
@@ -243,8 +243,8 @@ TEST_F(DndTestDnode, CreateDnode_01) {
SendThenCheckShowRetrieveMsg
(
2
);
CheckInt16
(
1
);
CheckInt16
(
2
);
CheckBinary
(
"localhost:9
52
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
52
2"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
2"
,
TSDB_EP_LEN
);
CheckInt16
(
0
);
CheckInt16
(
0
);
CheckInt16
(
1
);
...
...
@@ -257,7 +257,7 @@ TEST_F(DndTestDnode, CreateDnode_01) {
CheckBinary
(
""
,
24
);
}
TEST_F
(
DndTestDnode
,
DropDnode_01
)
{
TEST_F
(
DndTestDnode
,
04
_DropDnode
)
{
SDropDnodeMsg
*
pReq
=
(
SDropDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SDropDnodeMsg
));
pReq
->
dnodeId
=
htonl
(
2
);
...
...
@@ -274,7 +274,7 @@ TEST_F(DndTestDnode, DropDnode_01) {
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_DNODE
,
"show dnodes"
,
7
);
SendThenCheckShowRetrieveMsg
(
1
);
CheckInt16
(
1
);
CheckBinary
(
"localhost:9
52
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
1"
,
TSDB_EP_LEN
);
CheckInt16
(
0
);
CheckInt16
(
1
);
CheckBinary
(
"ready"
,
10
);
...
...
@@ -282,10 +282,10 @@ TEST_F(DndTestDnode, DropDnode_01) {
CheckBinary
(
""
,
24
);
}
TEST_F
(
DndTestDnode
,
CreateDnode_02
)
{
TEST_F
(
DndTestDnode
,
05
_CreateDnode
)
{
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9
52
3"
);
strcpy
(
pReq
->
ep
,
"localhost:9
04
3"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
...
...
@@ -300,7 +300,7 @@ TEST_F(DndTestDnode, CreateDnode_02) {
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9
52
4"
);
strcpy
(
pReq
->
ep
,
"localhost:9
04
4"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
...
...
@@ -315,7 +315,7 @@ TEST_F(DndTestDnode, CreateDnode_02) {
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9
52
5"
);
strcpy
(
pReq
->
ep
,
"localhost:9
04
5"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
...
...
@@ -335,10 +335,10 @@ TEST_F(DndTestDnode, CreateDnode_02) {
CheckInt16
(
3
);
CheckInt16
(
4
);
CheckInt16
(
5
);
CheckBinary
(
"localhost:9
52
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
52
3"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
52
4"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
52
5"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
3"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
4"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
5"
,
TSDB_EP_LEN
);
CheckInt16
(
0
);
CheckInt16
(
0
);
CheckInt16
(
0
);
...
...
@@ -361,7 +361,7 @@ TEST_F(DndTestDnode, CreateDnode_02) {
CheckBinary
(
""
,
24
);
}
TEST_F
(
DndTestDnode
,
RestartDnode_01
)
{
TEST_F
(
DndTestDnode
,
06
_RestartDnode
)
{
uInfo
(
"stop all server"
);
stopServer
(
pServer1
);
stopServer
(
pServer2
);
...
...
@@ -377,11 +377,11 @@ TEST_F(DndTestDnode, RestartDnode_01) {
uInfo
(
"start all server"
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9
52
1"
;
pServer1
=
startServer
(
"/tmp/dn
dTestDnode1"
,
fqdn
,
952
1
,
firstEp
);
pServer3
=
startServer
(
"/tmp/dn
dTestDnode3"
,
fqdn
,
952
3
,
firstEp
);
pServer4
=
startServer
(
"/tmp/dn
dTestDnode4"
,
fqdn
,
952
4
,
firstEp
);
pServer5
=
startServer
(
"/tmp/dn
dTestDnode5"
,
fqdn
,
952
5
,
firstEp
);
const
char
*
firstEp
=
"localhost:9
04
1"
;
pServer1
=
startServer
(
"/tmp/dn
ode_test_dnode1"
,
fqdn
,
904
1
,
firstEp
);
pServer3
=
startServer
(
"/tmp/dn
ode_test_dnode3"
,
fqdn
,
904
3
,
firstEp
);
pServer4
=
startServer
(
"/tmp/dn
ode_test_dnode4"
,
fqdn
,
904
4
,
firstEp
);
pServer5
=
startServer
(
"/tmp/dn
ode_test_dnode5"
,
fqdn
,
904
5
,
firstEp
);
uInfo
(
"all server is running"
);
...
...
@@ -392,10 +392,10 @@ TEST_F(DndTestDnode, RestartDnode_01) {
CheckInt16
(
3
);
CheckInt16
(
4
);
CheckInt16
(
5
);
CheckBinary
(
"localhost:9
52
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
52
3"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
52
4"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
52
5"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
1"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
3"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
4"
,
TSDB_EP_LEN
);
CheckBinary
(
"localhost:9
04
5"
,
TSDB_EP_LEN
);
CheckInt16
(
0
);
CheckInt16
(
0
);
CheckInt16
(
0
);
...
...
source/dnode/mgmt/impl/test/user/CMakeLists.txt
浏览文件 @
5bc20e44
add_executable
(
dn
dTestU
ser
""
)
add_executable
(
dn
ode_test_u
ser
""
)
target_sources
(
dn
dTestU
ser
target_sources
(
dn
ode_test_u
ser
PRIVATE
"user.cpp"
"../sut/deploy.cpp"
)
target_link_libraries
(
dn
dTestU
ser
dn
ode_test_u
ser
PUBLIC dnode
PUBLIC util
PUBLIC os
PUBLIC gtest_main
)
target_include_directories
(
dn
dTestU
ser
target_include_directories
(
dn
ode_test_u
ser
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
...
...
@@ -24,6 +24,6 @@ target_include_directories(dndTestUser
enable_testing
()
add_test
(
NAME dn
dTestU
ser
COMMAND dn
dTestU
ser
NAME dn
ode_test_u
ser
COMMAND dn
ode_test_u
ser
)
source/dnode/mgmt/impl/test/user/user.cpp
浏览文件 @
5bc20e44
...
...
@@ -24,12 +24,12 @@ class DndTestUser : public ::testing::Test {
}
static
void
SetUpTestSuite
()
{
initLog
(
"/tmp/
dndTestUser
"
);
initLog
(
"/tmp/
tdlog
"
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9
53
0"
;
pServer
=
CreateServer
(
"/tmp/dn
dTestUser"
,
fqdn
,
953
0
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9
53
0
);
const
char
*
firstEp
=
"localhost:9
14
0"
;
pServer
=
CreateServer
(
"/tmp/dn
ode_test_user"
,
fqdn
,
914
0
,
firstEp
);
pClient
=
createClient
(
"root"
,
"taosdata"
,
fqdn
,
9
14
0
);
taosMsleep
(
300
);
}
...
...
@@ -170,7 +170,7 @@ SServer* DndTestUser::pServer;
SClient
*
DndTestUser
::
pClient
;
int32_t
DndTestUser
::
connId
;
TEST_F
(
DndTestUser
,
ShowUser
)
{
TEST_F
(
DndTestUser
,
01
_
ShowUser
)
{
SendTheCheckShowMetaMsg
(
TSDB_MGMT_TABLE_USER
,
"show users"
,
4
);
CheckSchema
(
0
,
TSDB_DATA_TYPE_BINARY
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
"name"
);
CheckSchema
(
1
,
TSDB_DATA_TYPE_BINARY
,
10
+
VARSTR_HEADER_SIZE
,
"privilege"
);
...
...
@@ -184,7 +184,7 @@ TEST_F(DndTestUser, ShowUser) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
CreateUser_01
)
{
TEST_F
(
DndTestUser
,
02
_CreateUser
)
{
{
SCreateUserMsg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
...
...
@@ -233,7 +233,7 @@ TEST_F(DndTestUser, CreateUser_01) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
AlterUser_01
)
{
TEST_F
(
DndTestUser
,
03
_AlterUser
)
{
SAlterUserMsg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p2"
);
...
...
@@ -264,7 +264,7 @@ TEST_F(DndTestUser, AlterUser_01) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
DropUser_01
)
{
TEST_F
(
DndTestUser
,
04
_DropUser
)
{
SDropUserMsg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
sizeof
(
SDropUserMsg
));
strcpy
(
pReq
->
user
,
"u1"
);
...
...
@@ -290,15 +290,15 @@ TEST_F(DndTestUser, DropUser_01) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
DndTestUser
,
RestartDnode
)
{
TEST_F
(
DndTestUser
,
05
_
RestartDnode
)
{
stopServer
(
pServer
);
pServer
=
NULL
;
uInfo
(
"start all server"
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9
53
0"
;
pServer
=
startServer
(
"/tmp/dn
dTestUser"
,
fqdn
,
953
0
,
firstEp
);
const
char
*
firstEp
=
"localhost:9
14
0"
;
pServer
=
startServer
(
"/tmp/dn
ode_test_user"
,
fqdn
,
914
0
,
firstEp
);
uInfo
(
"all server is running"
);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
5bc20e44
...
...
@@ -17,14 +17,16 @@
#define _TD_MND_DEF_H_
#include "os.h"
#include "cJSON.h"
#include "sync.h"
#include "taosmsg.h"
#include "thash.h"
#include "tlog.h"
#include "trpc.h"
#include "ttimer.h"
#include "thash.h"
#include "cJSON.h"
#include "mnode.h"
#include "sync.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -41,11 +43,8 @@ extern int32_t mDebugFlag;
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
typedef
struct
SClusterObj
SClusterObj
;
typedef
struct
SDnodeObj
SDnodeObj
;
typedef
struct
SMnodeObj
SMnodeObj
;
typedef
struct
SAcctObj
SAcctObj
;
typedef
struct
SUserObj
SUserObj
;
typedef
struct
SDbObj
SDbObj
;
typedef
struct
SVgObj
SVgObj
;
typedef
struct
SFuncObj
SFuncObj
;
typedef
struct
SOperObj
SOperObj
;
...
...
@@ -119,7 +118,7 @@ typedef struct SClusterObj {
int64_t
updateTime
;
}
SClusterObj
;
typedef
struct
SDnodeObj
{
typedef
struct
{
int32_t
id
;
int64_t
createdTime
;
int64_t
updateTime
;
...
...
@@ -178,7 +177,7 @@ typedef struct SAcctObj {
SAcctInfo
info
;
}
SAcctObj
;
typedef
struct
SUserObj
{
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
char
acct
[
TSDB_USER_LEN
];
...
...
@@ -209,7 +208,7 @@ typedef struct {
int8_t
cacheLastRow
;
}
SDbCfg
;
typedef
struct
SDbObj
{
typedef
struct
{
char
name
[
TSDB_FULL_DB_NAME_LEN
];
char
acct
[
TSDB_USER_LEN
];
int64_t
createdTime
;
...
...
source/dnode/mnode/impl/inc/mndShow.h
浏览文件 @
5bc20e44
...
...
@@ -27,7 +27,7 @@ void mndCleanupShow(SMnode *pMnode);
void
mndAddShowMetaHandle
(
SMnode
*
pMnode
,
EShowType
showType
,
ShowMetaFp
fp
);
void
mndAddShowRetrieveHandle
(
SMnode
*
pMnode
,
EShowType
showType
,
ShowRetrieveFp
fp
);
void
mndAddShowFreeIterHandle
(
SMnode
*
pMnode
,
EShowType
msgType
,
ShowFreeIterFp
fp
);
void
mn
ode
VacuumResult
(
char
*
data
,
int32_t
numOfCols
,
int32_t
rows
,
int32_t
capacity
,
SShowObj
*
pShow
);
void
mn
d
VacuumResult
(
char
*
data
,
int32_t
numOfCols
,
int32_t
rows
,
int32_t
capacity
,
SShowObj
*
pShow
);
char
*
mndShowStr
(
int32_t
showType
);
#ifdef __cplusplus
...
...
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
5bc20e44
...
...
@@ -19,12 +19,12 @@
#define SDB_ACCT_VER 1
static
int32_t
mn
ode
CreateDefaultAcct
(
SMnode
*
pMnode
);
static
SSdbRaw
*
mn
ode
AcctActionEncode
(
SAcctObj
*
pAcct
);
static
SSdbRow
*
mn
ode
AcctActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mn
ode
AcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mn
ode
AcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mn
ode
AcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOldAcct
,
SAcctObj
*
pNewAcct
);
static
int32_t
mn
d
CreateDefaultAcct
(
SMnode
*
pMnode
);
static
SSdbRaw
*
mn
d
AcctActionEncode
(
SAcctObj
*
pAcct
);
static
SSdbRow
*
mn
d
AcctActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mn
d
AcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mn
d
AcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mn
d
AcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOldAcct
,
SAcctObj
*
pNewAcct
);
static
int32_t
mndProcessCreateAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
static
int32_t
mndProcessAlterAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
static
int32_t
mndProcessDropAcctMsg
(
SMnodeMsg
*
pMnodeMsg
);
...
...
@@ -32,12 +32,12 @@ static int32_t mndProcessDropAcctMsg(SMnodeMsg *pMnodeMsg);
int32_t
mndInitAcct
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_ACCT
,
.
keyType
=
SDB_KEY_BINARY
,
.
deployFp
=
mn
ode
CreateDefaultAcct
,
.
encodeFp
=
(
SdbEncodeFp
)
mn
ode
AcctActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mn
ode
AcctActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mn
ode
AcctActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mn
ode
AcctActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mn
ode
AcctActionDelete
};
.
deployFp
=
mn
d
CreateDefaultAcct
,
.
encodeFp
=
(
SdbEncodeFp
)
mn
d
AcctActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mn
d
AcctActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mn
d
AcctActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mn
d
AcctActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mn
d
AcctActionDelete
};
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_CREATE_ACCT
,
mndProcessCreateAcctMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_ALTER_ACCT
,
mndProcessAlterAcctMsg
);
...
...
@@ -48,7 +48,7 @@ int32_t mndInitAcct(SMnode *pMnode) {
void
mndCleanupAcct
(
SMnode
*
pMnode
)
{}
static
int32_t
mn
ode
CreateDefaultAcct
(
SMnode
*
pMnode
)
{
static
int32_t
mn
d
CreateDefaultAcct
(
SMnode
*
pMnode
)
{
SAcctObj
acctObj
=
{
0
};
tstrncpy
(
acctObj
.
acct
,
TSDB_DEFAULT_USER
,
TSDB_USER_LEN
);
acctObj
.
createdTime
=
taosGetTimestampMs
();
...
...
@@ -61,7 +61,7 @@ static int32_t mnodeCreateDefaultAcct(SMnode *pMnode) {
.
maxStorage
=
INT64_MAX
,
.
accessState
=
TSDB_VN_ALL_ACCCESS
};
SSdbRaw
*
pRaw
=
mn
ode
AcctActionEncode
(
&
acctObj
);
SSdbRaw
*
pRaw
=
mn
d
AcctActionEncode
(
&
acctObj
);
if
(
pRaw
==
NULL
)
return
-
1
;
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
...
...
@@ -69,7 +69,7 @@ static int32_t mnodeCreateDefaultAcct(SMnode *pMnode) {
return
sdbWrite
(
pMnode
->
pSdb
,
pRaw
);
}
static
SSdbRaw
*
mn
ode
AcctActionEncode
(
SAcctObj
*
pAcct
)
{
static
SSdbRaw
*
mn
d
AcctActionEncode
(
SAcctObj
*
pAcct
)
{
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_ACCT
,
SDB_ACCT_VER
,
sizeof
(
SAcctObj
));
if
(
pRaw
==
NULL
)
return
NULL
;
...
...
@@ -90,7 +90,7 @@ static SSdbRaw *mnodeAcctActionEncode(SAcctObj *pAcct) {
return
pRaw
;
}
static
SSdbRow
*
mn
ode
AcctActionDecode
(
SSdbRaw
*
pRaw
)
{
static
SSdbRow
*
mn
d
AcctActionDecode
(
SSdbRaw
*
pRaw
)
{
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
return
NULL
;
...
...
@@ -120,18 +120,18 @@ static SSdbRow *mnodeAcctActionDecode(SSdbRaw *pRaw) {
return
pRow
;
}
static
int32_t
mn
ode
AcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
)
{
static
int32_t
mn
d
AcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
)
{
mTrace
(
"acct:%s, perform insert action"
,
pAcct
->
acct
);
memset
(
&
pAcct
->
info
,
0
,
sizeof
(
SAcctInfo
));
return
0
;
}
static
int32_t
mn
ode
AcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
)
{
static
int32_t
mn
d
AcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
)
{
mTrace
(
"acct:%s, perform delete action"
,
pAcct
->
acct
);
return
0
;
}
static
int32_t
mn
ode
AcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOldAcct
,
SAcctObj
*
pNewAcct
)
{
static
int32_t
mn
d
AcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOldAcct
,
SAcctObj
*
pNewAcct
)
{
mTrace
(
"acct:%s, perform update action"
,
pOldAcct
->
acct
);
memcpy
(
pOldAcct
->
acct
,
pNewAcct
->
acct
,
TSDB_USER_LEN
);
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
5bc20e44
...
...
@@ -203,7 +203,7 @@ static int32_t mndRetrieveClusters(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
numOfRows
++
;
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
5bc20e44
...
...
@@ -65,7 +65,7 @@ int32_t mndInitDb(SMnode *pMnode) {
void
mndCleanupDb
(
SMnode
*
pMnode
)
{}
static
SSdbRaw
*
mndDbActionEncode
(
SDbObj
*
pDb
)
{
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_DB
,
TSDB_DB_VER_NUM
,
sizeof
(
SDbObj
));
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_DB
,
TSDB_DB_VER_NUM
,
sizeof
(
SDbObj
)
+
TSDB_DB_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
...
...
@@ -151,7 +151,8 @@ static int32_t mndDbActionDelete(SSdb *pSdb, SDbObj *pDb) {
static
int32_t
mndDbActionUpdate
(
SSdb
*
pSdb
,
SDbObj
*
pOldDb
,
SDbObj
*
pNewDb
)
{
mTrace
(
"db:%s, perform update action"
,
pOldDb
->
name
);
memcpy
(
pOldDb
,
pNewDb
,
sizeof
(
SDbObj
));
pOldDb
->
updateTime
=
pNewDb
->
createdTime
;
memcpy
(
&
pOldDb
->
cfg
,
&
pNewDb
->
cfg
,
sizeof
(
SDbCfg
));
return
0
;
}
...
...
@@ -165,109 +166,146 @@ void mndReleaseDb(SMnode *pMnode, SDbObj *pDb) {
sdbRelease
(
pSdb
,
pDb
);
}
static
int32_t
mndCheckDbCfg
(
SMnode
*
pMnode
,
SDbCfg
*
pCfg
)
{
static
int32_t
mndCheckDbName
(
char
*
dbName
,
SUserObj
*
pUser
)
{
char
*
pos
=
strstr
(
dbName
,
TS_PATH_DELIMITER
);
if
(
pos
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB
;
return
-
1
;
}
int32_t
acctId
=
atoi
(
dbName
);
if
(
acctId
!=
pUser
->
acctId
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_ACCT
;
return
-
1
;
}
return
0
;
}
static
int32_t
mndCheckDbCfg
(
SMnode
*
pMnode
,
SDbCfg
*
pCfg
,
char
*
errMsg
,
int32_t
len
)
{
if
(
pCfg
->
cacheBlockSize
<
TSDB_MIN_CACHE_BLOCK_SIZE
||
pCfg
->
cacheBlockSize
>
TSDB_MAX_CACHE_BLOCK_SIZE
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_CACHE_SIZE
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database cache block size option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
totalBlocks
<
TSDB_MIN_TOTAL_BLOCKS
||
pCfg
->
totalBlocks
>
TSDB_MAX_TOTAL_BLOCKS
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_TOTAL_BLOCKS
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database total blocks option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_DAYS
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database days option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
daysToKeep0
<
pCfg
->
daysPerFile
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_KEEP0
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database days option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
daysToKeep0
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep0
>
TSDB_MAX_KEEP
||
pCfg
->
daysToKeep0
>
pCfg
->
daysToKeep1
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_KEEP0
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database keep0 option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
daysToKeep1
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep1
>
TSDB_MAX_KEEP
||
pCfg
->
daysToKeep1
>
pCfg
->
daysToKeep2
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_KEEP1
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database keep1 option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
daysToKeep2
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep2
>
TSDB_MAX_KEEP
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_KEEP1
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database keep2 option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
minRowsPerFileBlock
<
TSDB_MIN_MIN_ROW_FBLOCK
||
pCfg
->
minRowsPerFileBlock
>
TSDB_MAX_MIN_ROW_FBLOCK
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_MIN_ROWS
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database minrows option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
maxRowsPerFileBlock
<
TSDB_MIN_MAX_ROW_FBLOCK
||
pCfg
->
maxRowsPerFileBlock
>
TSDB_MAX_MAX_ROW_FBLOCK
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_MAX_ROWS
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database maxrows option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
minRowsPerFileBlock
>
pCfg
->
maxRowsPerFileBlock
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_MIN_ROWS
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database minrows option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
commitTime
<
TSDB_MIN_COMMIT_TIME
||
pCfg
->
commitTime
>
TSDB_MAX_COMMIT_TIME
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_COMMIT_TIME
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database commit option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
fsyncPeriod
<
TSDB_MIN_FSYNC_PERIOD
||
pCfg
->
fsyncPeriod
>
TSDB_MAX_FSYNC_PERIOD
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_FSYNC_PERIOD
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database fsync option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
walLevel
<
TSDB_MIN_WAL_LEVEL
||
pCfg
->
walLevel
>
TSDB_MAX_WAL_LEVEL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_WAL_LEVEL
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database wal level option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
precision
<
TSDB_MIN_PRECISION
&&
pCfg
->
precision
>
TSDB_MAX_PRECISION
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_PRECISION
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid precision option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
compression
<
TSDB_MIN_COMP_LEVEL
||
pCfg
->
compression
>
TSDB_MAX_COMP_LEVEL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_COMP
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database compression option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
replications
<
TSDB_MIN_DB_REPLICA_OPTION
||
pCfg
->
replications
>
TSDB_MAX_DB_REPLICA_OPTION
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_REPLICA
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database replication option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
replications
>
mndGetDnodeSize
(
pMnode
))
{
terrno
=
TSDB_CODE_MND_INVALID_DB_REPLICA
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database replication option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
quorum
<
TSDB_MIN_DB_QUORUM_OPTION
||
pCfg
->
quorum
>
TSDB_MAX_DB_QUORUM_OPTION
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_QUORUM
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database quorum option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
quorum
>
pCfg
->
replications
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_QUORUM
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database quorum option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
update
<
TSDB_MIN_DB_UPDATE
||
pCfg
->
update
>
TSDB_MAX_DB_UPDATE
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_UPDATE
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database update option"
,
len
);
return
-
1
;
}
if
(
pCfg
->
cacheLastRow
<
TSDB_MIN_DB_CACHE_LAST_ROW
||
pCfg
->
cacheLastRow
>
TSDB_MAX_DB_CACHE_LAST_ROW
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB_CACHE_LAST
;
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
tstrncpy
(
errMsg
,
"Invalid database cachelast option"
,
len
);
return
-
1
;
}
...
...
@@ -294,13 +332,13 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
cacheLastRow
<
0
)
pCfg
->
cacheLastRow
=
TSDB_DEFAULT_CACHE_LAST_ROW
;
}
static
int32_t
mndCreateDb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateDbMsg
*
pCreate
,
char
*
acct
)
{
static
int32_t
mndCreateDb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateDbMsg
*
pCreate
,
SUserObj
*
pUser
)
{
SDbObj
dbObj
=
{
0
};
tstrncpy
(
dbObj
.
name
,
pCreate
->
db
,
TSDB_FULL_DB_NAME_LEN
);
tstrncpy
(
dbObj
.
acct
,
acct
,
TSDB_USER_LEN
);
tstrncpy
(
dbObj
.
acct
,
pUser
->
acct
,
TSDB_USER_LEN
);
dbObj
.
createdTime
=
taosGetTimestampMs
();
dbObj
.
updateTime
=
dbObj
.
createdTime
;
dbObj
.
uid
=
1234
;
dbObj
.
uid
=
mndGenerateUid
(
dbObj
.
name
,
TSDB_FULL_DB_NAME_LEN
)
;
dbObj
.
cfg
=
(
SDbCfg
){.
cacheBlockSize
=
pCreate
->
cacheBlockSize
,
.
totalBlocks
=
pCreate
->
totalBlocks
,
.
daysPerFile
=
pCreate
->
daysPerFile
,
...
...
@@ -321,7 +359,13 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pMsg, SCreateDbMsg *pCreat
mndSetDefaultDbCfg
(
&
dbObj
.
cfg
);
if
(
mndCheckDbCfg
(
pMnode
,
&
dbObj
.
cfg
)
!=
0
)
{
if
(
mndCheckDbName
(
dbObj
.
name
,
pUser
)
!=
0
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
}
char
errMsg
[
TSDB_ERROR_MSG_LEN
]
=
{
0
};
if
(
mndCheckDbCfg
(
pMnode
,
&
dbObj
.
cfg
,
errMsg
,
TSDB_ERROR_MSG_LEN
)
!=
0
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
}
...
...
@@ -403,11 +447,10 @@ static int32_t mndProcessCreateDbMsg(SMnodeMsg *pMsg) {
return
-
1
;
}
int32_t
code
=
mndCreateDb
(
pMnode
,
pMsg
,
pCreate
,
pOperUser
->
acct
);
int32_t
code
=
mndCreateDb
(
pMnode
,
pMsg
,
pCreate
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pOperUser
);
if
(
code
!=
0
)
{
terrno
=
code
;
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
}
...
...
@@ -415,7 +458,7 @@ static int32_t mndProcessCreateDbMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mn
ode
SetDbCfgFromAlterDbMsg
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
)
{
static
int32_t
mn
d
SetDbCfgFromAlterDbMsg
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
)
{
bool
changed
=
false
;
if
(
pAlter
->
totalBlocks
>=
0
&&
pAlter
->
totalBlocks
!=
pDb
->
cfg
.
totalBlocks
)
{
...
...
@@ -521,7 +564,7 @@ static int32_t mndProcessAlterDbMsg(SMnodeMsg *pMsg) {
SDbObj
dbObj
=
{
0
};
memcpy
(
&
dbObj
,
pDb
,
sizeof
(
SDbObj
));
int32_t
code
=
mn
ode
SetDbCfgFromAlterDbMsg
(
&
dbObj
,
pAlter
);
int32_t
code
=
mn
d
SetDbCfgFromAlterDbMsg
(
&
dbObj
,
pAlter
);
if
(
code
!=
0
)
{
mndReleaseDb
(
pMnode
,
pDb
);
mError
(
"db:%s, failed to alter since %s"
,
pAlter
->
db
,
tstrerror
(
code
));
...
...
@@ -603,7 +646,6 @@ static int32_t mndProcessDropDbMsg(SMnodeMsg *pMsg) {
mndReleaseDb
(
pMnode
,
pDb
);
if
(
code
!=
0
)
{
terrno
=
code
;
mError
(
"db:%s, failed to drop since %s"
,
pDrop
->
db
,
terrstr
());
return
code
;
}
...
...
@@ -772,10 +814,14 @@ static int32_t mndGetDbMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *pMe
return
0
;
}
char
*
mn
ode
GetDbStr
(
char
*
src
)
{
char
*
mnGetDbStr
(
char
*
src
)
{
char
*
pos
=
strstr
(
src
,
TS_PATH_DELIMITER
);
if
(
pos
!=
NULL
)
++
pos
;
if
(
pos
==
NULL
)
{
return
src
;
}
return
pos
;
}
...
...
@@ -794,7 +840,7 @@ static int32_t mndRetrieveDbs(SMnodeMsg *pMsg, SShowObj *pShow, char *data, int3
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
char
*
name
=
mn
ode
GetDbStr
(
pDb
->
name
);
char
*
name
=
mnGetDbStr
(
pDb
->
name
);
if
(
name
!=
NULL
)
{
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
name
,
pShow
->
bytes
[
cols
]);
}
else
{
...
...
@@ -887,7 +933,7 @@ static int32_t mndRetrieveDbs(SMnodeMsg *pMsg, SShowObj *pShow, char *data, int3
sdbRelease
(
pSdb
,
pDb
);
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
5bc20e44
...
...
@@ -108,7 +108,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
}
static
SSdbRaw
*
mndDnodeActionEncode
(
SDnodeObj
*
pDnode
)
{
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_DNODE
,
TSDB_DNODE_VER
,
sizeof
(
SDnodeObj
));
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_DNODE
,
TSDB_DNODE_VER
,
sizeof
(
SDnodeObj
)
+
TSDB_DNODE_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
...
...
@@ -175,6 +175,7 @@ static int32_t mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode) {
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOldDnode
,
SDnodeObj
*
pNewDnode
)
{
mTrace
(
"dnode:%d, perform update action"
,
pOldDnode
->
id
);
pOldDnode
->
updateTime
=
pNewDnode
->
updateTime
;
return
0
;
}
...
...
@@ -611,7 +612,7 @@ static int32_t mndRetrieveConfigs(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
cols
++
;
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
...
...
@@ -733,7 +734,7 @@ static int32_t mndRetrieveDnodes(SMnodeMsg *pMsg, SShowObj *pShow, char *data, i
sdbRelease
(
pSdb
,
pDnode
);
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
5bc20e44
...
...
@@ -500,7 +500,7 @@ static int32_t mndRetrieveFuncs(SMnodeMsg *pMsg, SShowObj *pShow, char *data, in
sdbRelease
(
pSdb
,
pFunc
);
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
5bc20e44
...
...
@@ -457,7 +457,7 @@ static int32_t mndRetrieveMnodes(SMnodeMsg *pMsg, SShowObj *pShow, char *data, i
sdbRelease
(
pSdb
,
pMnodeObj
);
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
5bc20e44
...
...
@@ -252,7 +252,7 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
return
0
;
}
static
int32_t
mn
ode
SaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatMsg
*
pMsg
)
{
static
int32_t
mn
d
SaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatMsg
*
pMsg
)
{
pConn
->
numOfQueries
=
0
;
pConn
->
numOfStreams
=
0
;
int32_t
numOfQueries
=
htonl
(
pMsg
->
numOfQueries
);
...
...
@@ -338,7 +338,7 @@ static int32_t mndProcessHeartBeatMsg(SMnodeMsg *pMsg) {
return
-
1
;
}
mn
ode
SaveQueryStreamList
(
pConn
,
pReq
);
mn
d
SaveQueryStreamList
(
pConn
,
pReq
);
if
(
pConn
->
killed
!=
0
)
{
pRsp
->
killConnection
=
1
;
}
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
5bc20e44
...
...
@@ -296,6 +296,8 @@ char *mndShowStr(int32_t showType) {
return
"show streamtables"
;
case
TSDB_MGMT_TABLE_TP
:
return
"show topics"
;
case
TSDB_MGMT_TABLE_FUNCTION
:
return
"show functions"
;
default:
return
"undefined"
;
}
...
...
@@ -308,7 +310,7 @@ static bool mndCheckRetrieveFinished(SShowObj *pShow) {
return
false
;
}
void
mn
ode
VacuumResult
(
char
*
data
,
int32_t
numOfCols
,
int32_t
rows
,
int32_t
capacity
,
SShowObj
*
pShow
)
{
void
mn
d
VacuumResult
(
char
*
data
,
int32_t
numOfCols
,
int32_t
rows
,
int32_t
capacity
,
SShowObj
*
pShow
)
{
if
(
rows
<
capacity
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
memmove
(
data
+
pShow
->
offset
[
i
]
*
rows
,
data
+
pShow
->
offset
[
i
]
*
capacity
,
pShow
->
bytes
[
i
]
*
rows
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
5bc20e44
...
...
@@ -605,7 +605,7 @@ static int32_t mndGetStbMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *pM
return
0
;
}
static
void
mn
ode
ExtractTableName
(
char
*
tableId
,
char
*
name
)
{
static
void
mn
d
ExtractTableName
(
char
*
tableId
,
char
*
name
)
{
int
pos
=
-
1
;
int
num
=
0
;
for
(
pos
=
0
;
tableId
[
pos
]
!=
0
;
++
pos
)
{
...
...
@@ -665,7 +665,7 @@ static int32_t mndRetrieveStb(SMnodeMsg *pMsg, SShowObj *pShow, char *data, int3
}
pShow
->
numOfReads
+=
numOfRows
;
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
return
numOfRows
;
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
5bc20e44
...
...
@@ -20,7 +20,8 @@
#include "mndTrans.h"
#include "tkey.h"
#define SDB_USER_VER 1
#define TSDB_USER_VER 1
#define TSDB_USER_RESERVE_SIZE 64
static
int32_t
mndCreateDefaultUsers
(
SMnode
*
pMnode
);
static
SSdbRaw
*
mndUserActionEncode
(
SUserObj
*
pUser
);
...
...
@@ -93,7 +94,7 @@ static int32_t mndCreateDefaultUsers(SMnode *pMnode) {
}
static
SSdbRaw
*
mndUserActionEncode
(
SUserObj
*
pUser
)
{
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_USER
,
SDB_USER_VER
,
sizeof
(
SUserObj
)
);
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_USER
,
TSDB_USER_VER
,
sizeof
(
SUserObj
)
+
TSDB_USER_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
...
...
@@ -103,6 +104,7 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
createdTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
updateTime
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
superUser
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_USER_RESERVE_SIZE
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
);
return
pRaw
;
...
...
@@ -112,7 +114,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
return
NULL
;
if
(
sver
!=
SDB_USER_VER
)
{
if
(
sver
!=
T
SDB_USER_VER
)
{
mError
(
"failed to decode user since %s"
,
terrstr
());
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
return
NULL
;
...
...
@@ -129,6 +131,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
createdTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
updateTime
)
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
superUser
)
SDB_GET_RESERVE
(
pRaw
,
pRow
,
dataPos
,
TSDB_USER_RESERVE_SIZE
)
return
pRow
;
}
...
...
@@ -166,12 +169,8 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pOldUser
,
SUserObj
*
pNewUser
)
{
mTrace
(
"user:%s, perform update action"
,
pOldUser
->
user
);
memcpy
(
pOldUser
->
user
,
pNewUser
->
user
,
TSDB_USER_LEN
);
memcpy
(
pOldUser
->
pass
,
pNewUser
->
pass
,
TSDB_PASSWORD_LEN
);
memcpy
(
pOldUser
->
acct
,
pNewUser
->
acct
,
TSDB_USER_LEN
);
pOldUser
->
createdTime
=
pNewUser
->
createdTime
;
pOldUser
->
updateTime
=
pNewUser
->
updateTime
;
pOldUser
->
superUser
=
pNewUser
->
superUser
;
return
0
;
}
...
...
@@ -325,6 +324,7 @@ static int32_t mndProcessAlterUserMsg(SMnodeMsg *pMsg) {
memcpy
(
&
newUser
,
pUser
,
sizeof
(
SUserObj
));
memset
(
pUser
->
pass
,
0
,
sizeof
(
pUser
->
pass
));
taosEncryptPass
((
uint8_t
*
)
pAlter
->
pass
,
strlen
(
pAlter
->
pass
),
pUser
->
pass
);
newUser
.
updateTime
=
taosGetTimestampMs
();
int32_t
code
=
mndUpdateUser
(
pMnode
,
pUser
,
&
newUser
,
pMsg
);
sdbRelease
(
pMnode
->
pSdb
,
pOperUser
);
...
...
@@ -486,7 +486,7 @@ static int32_t mndRetrieveUsers(SMnodeMsg *pMsg, SShowObj *pShow, char *data, in
sdbRelease
(
pSdb
,
pUser
);
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
5bc20e44
...
...
@@ -284,7 +284,7 @@ static int32_t mndRetrieveVgroups(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
numOfRows
++
;
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
...
...
@@ -374,7 +374,7 @@ static int32_t mndRetrieveVnodes(SMnodeMsg *pMsg, SShowObj *pShow, char *data, i
sdbRelease
(
pSdb
,
pVgroup
);
}
mn
ode
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
mn
d
VacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
}
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
5bc20e44
...
...
@@ -69,7 +69,7 @@ static void mndCleanupTimer(SMnode *pMnode) {
}
}
static
int32_t
mn
ode
CreateDir
(
SMnode
*
pMnode
,
const
char
*
path
)
{
static
int32_t
mn
d
CreateDir
(
SMnode
*
pMnode
,
const
char
*
path
)
{
pMnode
->
path
=
strdup
(
path
);
if
(
pMnode
->
path
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -245,7 +245,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
return
NULL
;
}
int32_t
code
=
mn
ode
CreateDir
(
pMnode
,
path
);
int32_t
code
=
mn
d
CreateDir
(
pMnode
,
path
);
if
(
code
!=
0
)
{
code
=
terrno
;
mError
(
"failed to open mnode since %s"
,
terrstr
());
...
...
source/util/src/terror.c
浏览文件 @
5bc20e44
...
...
@@ -129,7 +129,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_JSON_TYPE, "Invalid JSON data typ
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
,
"Value out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_INPUT
,
"Invalid tsc input"
)
// mnode
// mnode-common
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NOT_READY
,
"Cluster not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MSG_NOT_PROCESSED
,
"Message not processed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACTION_IN_PROGRESS
,
"Message is progressing"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACTION_NEED_REPROCESSED
,
"Message need to be reprocessed"
)
...
...
@@ -140,7 +141,11 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_MSG_VERSION, "Incompatible protocol
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_MSG_LEN
,
"Invalid message length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_MSG_TYPE
,
"Invalid message type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_SHELL_CONNS
,
"Too many connections"
)
// mnode-show
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_SHOWOBJ
,
"Data expired"
)
// mnode-profile
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_QUERY_ID
,
"Invalid query id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_STREAM_ID
,
"Invalid stream id"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CONN_ID
,
"Invalid connection id"
)
...
...
@@ -150,6 +155,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_FAILED_TO_START_SYNC, "failed to start sync"
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_FAILED_TO_CREATE_DIR
,
"failed to create mnode dir"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_FAILED_TO_INIT_STEP
,
"failed to init components"
)
// mnode-sdb
TAOS_DEFINE_ERROR
(
TSDB_CODE_SDB_APP_ERROR
,
"Unexpected generic error in sdb"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SDB_OBJ_ALREADY_THERE
,
"Object already there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SDB_OBJ_NOT_THERE
,
"Object not there"
)
...
...
@@ -164,36 +170,50 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_DATA_LEN, "Invalid raw data len"
TAOS_DEFINE_ERROR
(
TSDB_CODE_SDB_INVALID_DATA_CONTENT
,
"Invalid raw data content"
)
// mnode-dnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_ALREADY_EXIST
,
"DNode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_EXIST
,
"DNode does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_ENOUGH_DNODES
,
"Out of DNodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_ALREADY_EXIST
,
"Dnode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_EXIST
,
"Dnode does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_DNODES
,
"Too many dnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_ENOUGH_DNODES
,
"Out of dnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CLUSTER_CFG
,
"Cluster cfg inconsistent"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CLUSTER_ID
,
"Cluster id not match"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_CFG
,
"Invalid dnode cfg"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_EP
,
"Invalid dnode end point"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_ID
,
"Invalid dnode id"
)
// mnode-vgroup
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_EXIST
,
"VGroup does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_IN_DNODE
,
"Vgroup not in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE
,
"Vgroup already in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NOT_READY
,
"Cluster not ready"
)
// mnode-mnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MNODE_ALREADY_EXIST
,
"Mnode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MNODE_NOT_EXIST
,
"Mnode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_MNODES
,
"Too many mnodes"
)
// mnode-acct
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_ALREADY_EXIST
,
"Account already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_NOT_EXIST
,
"Invalid account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_ACCTS
,
"Too many accounts"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_ACCT_OPTION
,
"Invalid account options"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_EXPIRED
,
"Account authorization has expired"
)
// mnode-user
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_USER_ALREADY_EXIST
,
"User already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_USER_NOT_EXIST
,
"Invalid user"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_USERS
,
"Too many users"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_USER_FORMAT
,
"Invalid user format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_PASS_FORMAT
,
"Invalid password format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_USER_FROM_CONN
,
"Can not get user from conn"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_USERS
,
"Too many users"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MNODE_ALREADY_EXIST
,
"Mnode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MNODE_NOT_EXIST
,
"Mnode not there"
)
// mnode-db
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_ALREADY_EXIST
,
"Database already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_NOT_EXIST
,
"Database not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_DATABASES
,
"Too many databases for account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_NOT_SELECTED
,
"Database not specified or available"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB
,
"Invalid database name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_OPTION
,
"Invalid database options"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_ACCT
,
"Invalid database account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_OPTION_UNCHANGED
,
"Database options not changed"
)
// mnode-vgroup
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE
,
"Vgroup already in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_IN_DNODE
,
"Vgroup not in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_EXIST
,
"VGroup does not exist"
)
// mnode-stable
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_STB_ALREADY_EXIST
,
"Stable already exists"
)
...
...
@@ -203,7 +223,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TABLE_TYPE, "Invalid table type in
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_TAGS
,
"Too many tags"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_COLUMNS
,
"Too many columns"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_TIMESERIES
,
"Too many time series"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NOT_SUPER_TABLE
,
"Not super table"
)
// operation only available for super table
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NOT_SUPER_TABLE
,
"Not super table"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_COL_NAME_TOO_LONG
,
"Tag name too long"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_ALREAY_EXIST
,
"Tag already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_NOT_EXIST
,
"Tag does not exist"
)
...
...
@@ -224,31 +244,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_BUFSIZE, "Invalid func bufSize"
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_TAG_LENGTH
,
"invalid tag length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_COLUMN_LENGTH
,
"invalid column length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_NOT_SELECTED
,
"Database not specified or available"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_NOT_EXIST
,
"Database not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_ALREADY_EXIST
,
"Database already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB
,
"Invalid database name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_OPTION
,
"Invalid database options"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_CACHE_SIZE
,
"Invalid database cache block size option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_TOTAL_BLOCKS
,
"Invalid database total blocks option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_DAYS
,
"Invalid database days option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_KEEP0
,
"Invalid database keep0 option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_KEEP1
,
"Invalid database keep1 option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_KEEP2
,
"Invalid database keep2 option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_MIN_ROWS
,
"Invalid database min rows option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_MAX_ROWS
,
"Invalid database max rows option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_COMMIT_TIME
,
"Invalid database commit time option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_FSYNC_PERIOD
,
"Invalid database fsync periodoptions"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_WAL_LEVEL
,
"Invalid database wal level option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_PRECISION
,
"Invalid database precisin option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_COMP
,
"Invalid database compression option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_REPLICA
,
"Invalid database replication option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_QUORUM
,
"Invalid database quorum option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_UPDATE
,
"Invalid database update option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_CACHE_LAST
,
"Invalid database cache last option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_OPTION_UNCHANGED
,
"Database options not changed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_DATABASES
,
"Too many databases for account"
)
// dnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_ACTION_IN_PROGRESS
,
"Action in progress"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_EXITING
,
"Dnode is exiting"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录