Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fc5af249
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看板
未验证
提交
fc5af249
编写于
10月 19, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17444 from taosdata/enh/TD-19622
refact: remove bnode codes
上级
510a7458
3a7d89a6
变更
68
隐藏空白更改
内联
并排
Showing
68 changed file
with
178 addition
and
1933 deletion
+178
-1933
include/common/systable.h
include/common/systable.h
+1
-1
include/common/tglobal.h
include/common/tglobal.h
+0
-1
include/common/tmsg.h
include/common/tmsg.h
+4
-5
include/common/tmsgdef.h
include/common/tmsgdef.h
+5
-6
include/dnode/bnode/bnode.h
include/dnode/bnode/bnode.h
+0
-77
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+0
-1
include/util/tdef.h
include/util/tdef.h
+0
-1
source/common/src/systable.c
source/common/src/systable.c
+0
-7
source/common/src/tglobal.c
source/common/src/tglobal.c
+0
-9
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-2
source/dnode/CMakeLists.txt
source/dnode/CMakeLists.txt
+0
-1
source/dnode/bnode/CMakeLists.txt
source/dnode/bnode/CMakeLists.txt
+0
-14
source/dnode/bnode/inc/bndInt.h
source/dnode/bnode/inc/bndInt.h
+0
-40
source/dnode/bnode/src/bnode.c
source/dnode/bnode/src/bnode.c
+0
-28
source/dnode/mgmt/CMakeLists.txt
source/dnode/mgmt/CMakeLists.txt
+0
-1
source/dnode/mgmt/mgmt_bnode/CMakeLists.txt
source/dnode/mgmt/mgmt_bnode/CMakeLists.txt
+0
-9
source/dnode/mgmt/mgmt_bnode/inc/bmInt.h
source/dnode/mgmt/mgmt_bnode/inc/bmInt.h
+0
-53
source/dnode/mgmt/mgmt_bnode/src/bmHandle.c
source/dnode/mgmt/mgmt_bnode/src/bmHandle.c
+0
-105
source/dnode/mgmt/mgmt_bnode/src/bmInt.c
source/dnode/mgmt/mgmt_bnode/src/bmInt.c
+0
-79
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
+0
-150
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+0
-2
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+0
-6
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+1
-5
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
+2
-2
source/dnode/mgmt/mgmt_snode/src/smHandle.c
source/dnode/mgmt/mgmt_snode/src/smHandle.c
+2
-2
source/dnode/mgmt/node_mgmt/CMakeLists.txt
source/dnode/mgmt/node_mgmt/CMakeLists.txt
+1
-1
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
+0
-1
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+0
-1
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
+0
-17
source/dnode/mgmt/node_mgmt/src/dmNodes.c
source/dnode/mgmt/node_mgmt/src/dmNodes.c
+0
-2
source/dnode/mgmt/node_util/CMakeLists.txt
source/dnode/mgmt/node_util/CMakeLists.txt
+1
-1
source/dnode/mgmt/node_util/inc/dmUtil.h
source/dnode/mgmt/node_util/inc/dmUtil.h
+1
-2
source/dnode/mgmt/node_util/src/dmUtil.c
source/dnode/mgmt/node_util/src/dmUtil.c
+0
-6
source/dnode/mgmt/test/CMakeLists.txt
source/dnode/mgmt/test/CMakeLists.txt
+0
-1
source/dnode/mgmt/test/bnode/CMakeLists.txt
source/dnode/mgmt/test/bnode/CMakeLists.txt
+0
-10
source/dnode/mgmt/test/bnode/dbnode.cpp
source/dnode/mgmt/test/bnode/dbnode.cpp
+0
-152
source/dnode/mgmt/test/mnode/dmnode.cpp
source/dnode/mgmt/test/mnode/dmnode.cpp
+6
-6
source/dnode/mgmt/test/qnode/dqnode.cpp
source/dnode/mgmt/test/qnode/dqnode.cpp
+18
-18
source/dnode/mgmt/test/snode/dsnode.cpp
source/dnode/mgmt/test/snode/dsnode.cpp
+18
-18
source/dnode/mnode/impl/inc/mndBnode.h
source/dnode/mnode/impl/inc/mndBnode.h
+0
-32
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+0
-9
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+0
-447
source/dnode/mnode/impl/src/mndDump.c
source/dnode/mnode/impl/src/mndDump.c
+0
-5
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+0
-2
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+4
-4
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+8
-8
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+0
-2
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+8
-8
source/dnode/mnode/impl/test/CMakeLists.txt
source/dnode/mnode/impl/test/CMakeLists.txt
+0
-1
source/dnode/mnode/impl/test/bnode/CMakeLists.txt
source/dnode/mnode/impl/test/bnode/CMakeLists.txt
+0
-11
source/dnode/mnode/impl/test/bnode/mbnode.cpp
source/dnode/mnode/impl/test/bnode/mbnode.cpp
+0
-293
source/dnode/mnode/impl/test/mnode/mnode.cpp
source/dnode/mnode/impl/test/mnode/mnode.cpp
+26
-26
source/dnode/mnode/impl/test/qnode/qnode.cpp
source/dnode/mnode/impl/test/qnode/qnode.cpp
+28
-28
source/dnode/mnode/impl/test/snode/snode.cpp
source/dnode/mnode/impl/test/snode/snode.cpp
+28
-28
source/dnode/mnode/impl/test/trans/trans1.cpp
source/dnode/mnode/impl/test/trans/trans1.cpp
+10
-10
source/dnode/mnode/sdb/inc/sdb.h
source/dnode/mnode/sdb/inc/sdb.h
+0
-1
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+0
-2
source/libs/monitor/src/monMain.c
source/libs/monitor/src/monMain.c
+0
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+2
-2
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+0
-19
source/libs/parser/test/parInitialDTest.cpp
source/libs/parser/test/parInitialDTest.cpp
+0
-6
source/util/src/terror.c
source/util/src/terror.c
+0
-2
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+0
-3
tests/script/tmp/monitor.sim
tests/script/tmp/monitor.sim
+0
-1
tests/script/tsim/bnode/basic1.sim
tests/script/tsim/bnode/basic1.sim
+0
-135
tests/script/tsim/testsuit.sim
tests/script/tsim/testsuit.sim
+1
-2
tests/script/tsim/user/privilege_sysinfo.sim
tests/script/tsim/user/privilege_sysinfo.sim
+0
-1
tests/system-test/0-others/taosdMonitor.py
tests/system-test/0-others/taosdMonitor.py
+1
-1
未找到文件。
include/common/systable.h
浏览文件 @
fc5af249
...
...
@@ -27,7 +27,7 @@ extern "C" {
#define TSDB_INS_TABLE_MNODES "ins_mnodes"
#define TSDB_INS_TABLE_MODULES "ins_modules"
#define TSDB_INS_TABLE_QNODES "ins_qnodes"
#define TSDB_INS_TABLE_BNODES "ins_bnodes"
#define TSDB_INS_TABLE_BNODES "ins_bnodes"
// no longer used
#define TSDB_INS_TABLE_SNODES "ins_snodes"
#define TSDB_INS_TABLE_CLUSTER "ins_cluster"
#define TSDB_INS_TABLE_DATABASES "ins_databases"
...
...
include/common/tglobal.h
浏览文件 @
fc5af249
...
...
@@ -51,7 +51,6 @@ extern int32_t tsMnodeShmSize;
extern
int32_t
tsVnodeShmSize
;
extern
int32_t
tsQnodeShmSize
;
extern
int32_t
tsSnodeShmSize
;
extern
int32_t
tsBnodeShmSize
;
extern
int32_t
tsNumOfShmThreads
;
// queue & threads
...
...
include/common/tmsg.h
浏览文件 @
fc5af249
...
...
@@ -95,7 +95,7 @@ typedef enum _mgmt_table {
TSDB_MGMT_TABLE_MODULE
,
TSDB_MGMT_TABLE_QNODE
,
TSDB_MGMT_TABLE_SNODE
,
TSDB_MGMT_TABLE_BNODE
,
TSDB_MGMT_TABLE_BNODE
,
// no longer used
TSDB_MGMT_TABLE_CLUSTER
,
TSDB_MGMT_TABLE_DB
,
TSDB_MGMT_TABLE_FUNC
,
...
...
@@ -1485,11 +1485,10 @@ int32_t tDeserializeSDCfgDnodeReq(void* buf, int32_t bufLen, SDCfgDnodeReq* pReq
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
,
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
,
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
;
int32_t
tSerializeSCreateDropMQS
B
NodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
int32_t
tDeserializeSCreateDropMQS
B
NodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
int32_t
tSerializeSCreateDropMQSNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
int32_t
tDeserializeSCreateDropMQSNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
typedef
struct
{
int8_t
replica
;
...
...
include/common/tmsgdef.h
浏览文件 @
fc5af249
...
...
@@ -74,8 +74,8 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_QNODE
,
"dnode-drop-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_SNODE
,
"dnode-create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_SNODE
,
"dnode-drop-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_BNODE
,
"dnode-create-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_BNODE
,
"dnode-drop-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_BNODE
,
"dnode-create-bnode"
,
NULL
,
NULL
)
// no longer used
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_BNODE
,
"dnode-drop-bnode"
,
NULL
,
NULL
)
// no longer used
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_VNODE
,
"create-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_VNODE
,
"drop-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_SERVER_STATUS
,
"server-status"
,
NULL
,
NULL
)
...
...
@@ -107,9 +107,9 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_SNODE
,
"create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_SNODE
,
"alter-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_SNODE
,
"drop-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_BNODE
,
"create-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_BNODE
,
"alter-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_BNODE
,
"drop-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_BNODE
,
"create-bnode"
,
NULL
,
NULL
)
// no longer used
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_BNODE
,
"alter-bnode"
,
NULL
,
NULL
)
// no longer used
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_BNODE
,
"drop-bnode"
,
NULL
,
NULL
)
// no longer used
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_DB
,
"create-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_DB
,
"drop-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_USE_DB
,
"use-db"
,
NULL
,
NULL
)
...
...
@@ -243,7 +243,6 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MON_VM_INFO
,
"monitor-vinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_QM_INFO
,
"monitor-qinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_SM_INFO
,
"monitor-sinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_BM_INFO
,
"monitor-binfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_VM_LOAD
,
"monitor-vload"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_MM_LOAD
,
"monitor-mload"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_QM_LOAD
,
"monitor-qload"
,
NULL
,
NULL
)
...
...
include/dnode/bnode/bnode.h
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#ifndef _TD_BNODE_H_
#define _TD_BNODE_H_
#include "tmsgcb.h"
#ifdef __cplusplus
extern
"C"
{
#endif
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SBnode
SBnode
;
typedef
struct
{
#ifdef WINDOWS
size_t
avoidCompilationErrors
;
#endif
}
SBnodeLoad
;
typedef
struct
{
SMsgCb
msgCb
;
}
SBnodeOpt
;
/* ------------------------ SBnode ------------------------ */
/**
* @brief Start one Bnode in Dnode.
*
* @param path Path of the bnode.
* @param pOption Option of the bnode.
* @return SBnode* The bnode object.
*/
SBnode
*
bndOpen
(
const
char
*
path
,
const
SBnodeOpt
*
pOption
);
/**
* @brief Stop Bnode in Dnode.
*
* @param pBnode The bnode object to close.
*/
void
bndClose
(
SBnode
*
pBnode
);
/**
* @brief Get the statistical information of Bnode
*
* @param pBnode The bnode object.
* @param pLoad Statistics of the bnode.
* @return int32_t 0 for success, -1 for failure.
*/
int32_t
bndGetLoad
(
SBnode
*
pBnode
,
SBnodeLoad
*
pLoad
);
/**
* @brief Process a query message.
*
* @param pBnode The bnode object.
* @param pMsgs The array of SRpcMsg
* @return int32_t 0 for success, -1 for failure
*/
int32_t
bndProcessWMsgs
(
SBnode
*
pBnode
,
SArray
*
pMsgs
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_BNODE_H_*/
\ No newline at end of file
include/libs/monitor/monitor.h
浏览文件 @
fc5af249
...
...
@@ -80,7 +80,6 @@ typedef struct {
int8_t
has_mnode
;
int8_t
has_qnode
;
int8_t
has_snode
;
int8_t
has_bnode
;
SMonDiskDesc
logdir
;
SMonDiskDesc
tempdir
;
}
SMonDnodeInfo
;
...
...
include/util/tdef.h
浏览文件 @
fc5af249
...
...
@@ -483,7 +483,6 @@ enum {
#define QNODE_HANDLE -1
#define SNODE_HANDLE -2
#define VNODE_HANDLE -3
#define BNODE_HANDLE -4
#define CLIENT_HANDLE -5
#define TSDB_CONFIG_OPTION_LEN 32
...
...
source/common/src/systable.c
浏览文件 @
fc5af249
...
...
@@ -62,12 +62,6 @@ static const SSysDbTableSchema snodesSchema[] = {
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
};
static
const
SSysDbTableSchema
bnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
,
.
sysInfo
=
true
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
};
static
const
SSysDbTableSchema
clusterSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
,
.
sysInfo
=
true
},
{.
name
=
"name"
,
.
bytes
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
...
...
@@ -277,7 +271,6 @@ static const SSysTableMeta infosMeta[] = {
{
TSDB_INS_TABLE_MODULES
,
modulesSchema
,
tListLen
(
modulesSchema
),
true
},
{
TSDB_INS_TABLE_QNODES
,
qnodesSchema
,
tListLen
(
qnodesSchema
),
true
},
// {TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
// {TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)},
{
TSDB_INS_TABLE_CLUSTER
,
clusterSchema
,
tListLen
(
clusterSchema
),
true
},
{
TSDB_INS_TABLE_DATABASES
,
userDBSchema
,
tListLen
(
userDBSchema
),
false
},
{
TSDB_INS_TABLE_FUNCTIONS
,
userFuncSchema
,
tListLen
(
userFuncSchema
),
false
},
...
...
source/common/src/tglobal.c
浏览文件 @
fc5af249
...
...
@@ -46,7 +46,6 @@ int32_t tsMnodeShmSize = TSDB_MAX_MSG_SIZE * 2 + 1024;
int32_t
tsVnodeShmSize
=
TSDB_MAX_MSG_SIZE
*
10
+
1024
;
int32_t
tsQnodeShmSize
=
TSDB_MAX_MSG_SIZE
*
4
+
1024
;
int32_t
tsSnodeShmSize
=
TSDB_MAX_MSG_SIZE
*
4
+
1024
;
int32_t
tsBnodeShmSize
=
TSDB_MAX_MSG_SIZE
*
4
+
1024
;
int32_t
tsNumOfShmThreads
=
1
;
// queue & threads
...
...
@@ -358,7 +357,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"vnodeShmSize"
,
tsVnodeShmSize
,
TSDB_MAX_MSG_SIZE
*
2
+
1024
,
INT32_MAX
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"qnodeShmSize"
,
tsQnodeShmSize
,
TSDB_MAX_MSG_SIZE
*
2
+
1024
,
INT32_MAX
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"snodeShmSize"
,
tsSnodeShmSize
,
TSDB_MAX_MSG_SIZE
*
2
+
1024
,
INT32_MAX
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"bnodeShmSize"
,
tsBnodeShmSize
,
TSDB_MAX_MSG_SIZE
*
2
+
1024
,
INT32_MAX
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"numOfShmThreads"
,
tsNumOfShmThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfRpcThreads
=
tsNumOfCores
/
2
;
...
...
@@ -707,7 +705,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsVnodeShmSize
=
cfgGetItem
(
pCfg
,
"vnodeShmSize"
)
->
i32
;
tsQnodeShmSize
=
cfgGetItem
(
pCfg
,
"qnodeShmSize"
)
->
i32
;
tsSnodeShmSize
=
cfgGetItem
(
pCfg
,
"snodeShmSize"
)
->
i32
;
tsBnodeShmSize
=
cfgGetItem
(
pCfg
,
"bnodeShmSize"
)
->
i32
;
tsNumOfRpcThreads
=
cfgGetItem
(
pCfg
,
"numOfRpcThreads"
)
->
i32
;
tsNumOfCommitThreads
=
cfgGetItem
(
pCfg
,
"numOfCommitThreads"
)
->
i32
;
...
...
@@ -780,12 +777,6 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
}
break
;
}
case
'b'
:
{
if
(
strcasecmp
(
"bnodeShmSize"
,
name
)
==
0
)
{
tsBnodeShmSize
=
cfgGetItem
(
pCfg
,
"bnodeShmSize"
)
->
i32
;
}
break
;
}
case
'c'
:
{
if
(
strcasecmp
(
"charset"
,
name
)
==
0
)
{
const
char
*
locale
=
cfgGetItem
(
pCfg
,
"locale"
)
->
str
;
...
...
source/common/src/tmsg.c
浏览文件 @
fc5af249
...
...
@@ -1448,7 +1448,7 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) {
taosHashCleanup
(
pRsp
->
writeDbs
);
}
int32_t
tSerializeSCreateDropMQS
B
NodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tSerializeSCreateDropMQSNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
...
@@ -1461,7 +1461,7 @@ int32_t tSerializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnod
return
tlen
;
}
int32_t
tDeserializeSCreateDropMQS
B
NodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tDeserializeSCreateDropMQSNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
...
...
source/dnode/CMakeLists.txt
浏览文件 @
fc5af249
...
...
@@ -2,5 +2,4 @@ add_subdirectory(mnode)
add_subdirectory
(
vnode
)
add_subdirectory
(
qnode
)
add_subdirectory
(
snode
)
add_subdirectory
(
bnode
)
add_subdirectory
(
mgmt
)
\ No newline at end of file
source/dnode/bnode/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
510a7458
aux_source_directory
(
src BNODE_SRC
)
add_library
(
bnode STATIC
${
BNODE_SRC
}
)
target_include_directories
(
bnode
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/dnode/bnode"
private
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
bnode
PRIVATE transport
PRIVATE os
PRIVATE common
PRIVATE util
)
\ No newline at end of file
source/dnode/bnode/inc/bndInt.h
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#ifndef _TD_BNODE_INT_H_
#define _TD_BNODE_INT_H_
#include "os.h"
#include "tarray.h"
#include "tlog.h"
#include "tmsg.h"
#include "trpc.h"
#include "bnode.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SBnode
{
SMsgCb
msgCb
;
}
SBnode
;
#ifdef __cplusplus
}
#endif
#endif
/*_TD_BNODE_INT_H_*/
\ No newline at end of file
source/dnode/bnode/src/bnode.c
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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 "bndInt.h"
SBnode
*
bndOpen
(
const
char
*
path
,
const
SBnodeOpt
*
pOption
)
{
SBnode
*
pBnode
=
taosMemoryCalloc
(
1
,
sizeof
(
SBnode
));
pBnode
->
msgCb
=
pOption
->
msgCb
;
return
pBnode
;
}
void
bndClose
(
SBnode
*
pBnode
)
{
taosMemoryFree
(
pBnode
);
}
int32_t
bndGetLoad
(
SBnode
*
pBnode
,
SBnodeLoad
*
pLoad
)
{
return
0
;
}
int32_t
bndProcessWMsgs
(
SBnode
*
pBnode
,
SArray
*
pMsgs
)
{
return
0
;
}
source/dnode/mgmt/CMakeLists.txt
浏览文件 @
fc5af249
add_subdirectory
(
node_mgmt
)
add_subdirectory
(
node_util
)
add_subdirectory
(
mgmt_bnode
)
add_subdirectory
(
mgmt_mnode
)
add_subdirectory
(
mgmt_qnode
)
add_subdirectory
(
mgmt_snode
)
...
...
source/dnode/mgmt/mgmt_bnode/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
510a7458
aux_source_directory
(
src MGMT_BNODE
)
add_library
(
mgmt_bnode STATIC
${
MGMT_BNODE
}
)
target_include_directories
(
mgmt_bnode
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
mgmt_bnode node_util
)
\ No newline at end of file
source/dnode/mgmt/mgmt_bnode/inc/bmInt.h
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#ifndef _TD_DND_BNODE_INT_H_
#define _TD_DND_BNODE_INT_H_
#include "dmUtil.h"
#include "bnode.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SBnodeMgmt
{
SDnodeData
*
pData
;
SBnode
*
pBnode
;
SMsgCb
msgCb
;
const
char
*
path
;
const
char
*
name
;
SMultiWorker
writeWorker
;
SSingleWorker
monitorWorker
;
}
SBnodeMgmt
;
// bmHandle.c
SArray
*
bmGetMsgHandles
();
int32_t
bmProcessCreateReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
);
int32_t
bmProcessDropReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
);
int32_t
bmProcessGetMonBmInfoReq
(
SBnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
// bmWorker.c
int32_t
bmStartWorker
(
SBnodeMgmt
*
pMgmt
);
void
bmStopWorker
(
SBnodeMgmt
*
pMgmt
);
int32_t
bmPutNodeMsgToWriteQueue
(
SBnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
bmPutNodeMsgToMonitorQueue
(
SBnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_DND_BNODE_INT_H_*/
\ No newline at end of file
source/dnode/mgmt/mgmt_bnode/src/bmHandle.c
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "bmInt.h"
void
bmGetMonitorInfo
(
SBnodeMgmt
*
pMgmt
,
SMonBmInfo
*
bmInfo
)
{}
int32_t
bmProcessGetMonBmInfoReq
(
SBnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SMonBmInfo
bmInfo
=
{
0
};
bmGetMonitorInfo
(
pMgmt
,
&
bmInfo
);
dmGetMonitorSystemInfo
(
&
bmInfo
.
sys
);
monGetLogs
(
&
bmInfo
.
log
);
int32_t
rspLen
=
tSerializeSMonBmInfo
(
NULL
,
0
,
&
bmInfo
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonBmInfo
(
pRsp
,
rspLen
,
&
bmInfo
);
pMsg
->
info
.
rsp
=
pRsp
;
pMsg
->
info
.
rspLen
=
rspLen
;
tFreeSMonBmInfo
(
&
bmInfo
);
return
0
;
}
int32_t
bmProcessCreateReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
)
{
SDCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pInput
->
pData
->
dnodeId
!=
0
&&
createReq
.
dnodeId
!=
pInput
->
pData
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create bnode since %s, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
pInput
->
pData
->
dnodeId
);
return
-
1
;
}
bool
deployed
=
true
;
if
(
dmWriteFile
(
pInput
->
path
,
pInput
->
name
,
deployed
)
!=
0
)
{
dError
(
"failed to write bnode file since %s"
,
terrstr
());
return
-
1
;
}
return
0
;
}
int32_t
bmProcessDropReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
)
{
SDDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pInput
->
pData
->
dnodeId
!=
0
&&
dropReq
.
dnodeId
!=
pInput
->
pData
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop bnode since %s"
,
terrstr
());
return
-
1
;
}
bool
deployed
=
false
;
if
(
dmWriteFile
(
pInput
->
path
,
pInput
->
name
,
deployed
)
!=
0
)
{
dError
(
"failed to write bnode file since %s"
,
terrstr
());
return
-
1
;
}
return
0
;
}
SArray
*
bmGetMsgHandles
()
{
int32_t
code
=
-
1
;
SArray
*
pArray
=
taosArrayInit
(
2
,
sizeof
(
SMgmtHandle
));
if
(
pArray
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MON_BM_INFO
,
bmPutNodeMsgToMonitorQueue
,
0
)
==
NULL
)
goto
_OVER
;
code
=
0
;
_OVER:
if
(
code
!=
0
)
{
taosArrayDestroy
(
pArray
);
return
NULL
;
}
else
{
return
pArray
;
}
}
source/dnode/mgmt/mgmt_bnode/src/bmInt.c
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "bmInt.h"
static
int32_t
bmRequire
(
const
SMgmtInputOpt
*
pInput
,
bool
*
required
)
{
return
dmReadFile
(
pInput
->
path
,
pInput
->
name
,
required
);
}
static
void
bmInitOption
(
SBnodeMgmt
*
pMgmt
,
SBnodeOpt
*
pOption
)
{
pOption
->
msgCb
=
pMgmt
->
msgCb
;
}
static
void
bmClose
(
SBnodeMgmt
*
pMgmt
)
{
if
(
pMgmt
->
pBnode
!=
NULL
)
{
bmStopWorker
(
pMgmt
);
bndClose
(
pMgmt
->
pBnode
);
pMgmt
->
pBnode
=
NULL
;
}
taosMemoryFree
(
pMgmt
);
}
int32_t
bmOpen
(
SMgmtInputOpt
*
pInput
,
SMgmtOutputOpt
*
pOutput
)
{
SBnodeMgmt
*
pMgmt
=
taosMemoryCalloc
(
1
,
sizeof
(
SBnodeMgmt
));
if
(
pMgmt
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pMgmt
->
pData
=
pInput
->
pData
;
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
SBnodeOpt
option
=
{
0
};
bmInitOption
(
pMgmt
,
&
option
);
pMgmt
->
pBnode
=
bndOpen
(
pMgmt
->
path
,
&
option
);
if
(
pMgmt
->
pBnode
==
NULL
)
{
dError
(
"failed to open bnode since %s"
,
terrstr
());
bmClose
(
pMgmt
);
return
-
1
;
}
tmsgReportStartup
(
"bnode-impl"
,
"initialized"
);
if
(
bmStartWorker
(
pMgmt
)
!=
0
)
{
dError
(
"failed to start bnode worker since %s"
,
terrstr
());
bmClose
(
pMgmt
);
return
-
1
;
}
tmsgReportStartup
(
"bnode-worker"
,
"initialized"
);
pOutput
->
pMgmt
=
pMgmt
;
return
0
;
}
SMgmtFunc
bmGetMgmtFunc
()
{
SMgmtFunc
mgmtFunc
=
{
0
};
mgmtFunc
.
openFp
=
bmOpen
;
mgmtFunc
.
closeFp
=
(
NodeCloseFp
)
bmClose
;
mgmtFunc
.
createFp
=
(
NodeCreateFp
)
bmProcessCreateReq
;
mgmtFunc
.
dropFp
=
(
NodeDropFp
)
bmProcessDropReq
;
mgmtFunc
.
requiredFp
=
bmRequire
;
mgmtFunc
.
getHandlesFp
=
bmGetMsgHandles
;
return
mgmtFunc
;
}
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "bmInt.h"
static
void
bmSendErrorRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
code
=
code
,
.
info
=
pMsg
->
info
};
tmsgSendRsp
(
&
rsp
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
static
void
bmSendErrorRsps
(
STaosQall
*
qall
,
int32_t
numOfMsgs
,
int32_t
code
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
if
(
pMsg
!=
NULL
)
{
bmSendErrorRsp
(
pMsg
,
code
);
}
}
}
static
inline
void
bmSendRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{
.
code
=
code
,
.
pCont
=
pMsg
->
info
.
rsp
,
.
contLen
=
pMsg
->
info
.
rspLen
,
.
info
=
pMsg
->
info
,
};
tmsgSendRsp
(
&
rsp
);
}
static
void
bmProcessMonitorQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
dTrace
(
"msg:%p, get from bnode-monitor queue"
,
pMsg
);
if
(
pMsg
->
msgType
==
TDMT_MON_BM_INFO
)
{
code
=
bmProcessGetMonBmInfoReq
(
pMgmt
,
pMsg
);
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
IsReq
(
pMsg
))
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
bmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
static
void
bmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
if
(
pArray
==
NULL
)
{
bmSendErrorRsps
(
qall
,
numOfMsgs
,
TSDB_CODE_OUT_OF_MEMORY
);
return
;
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
if
(
pMsg
!=
NULL
)
{
dTrace
(
"msg:%p, get from bnode-write queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
bmSendErrorRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
}
}
}
bndProcessWMsgs
(
pMgmt
->
pBnode
,
pArray
);
for
(
size_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SRpcMsg
*
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
if
(
pMsg
!=
NULL
)
{
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
}
taosArrayDestroy
(
pArray
);
}
int32_t
bmPutNodeMsgToWriteQueue
(
SBnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SMultiWorker
*
pWorker
=
&
pMgmt
->
writeWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
int32_t
bmPutNodeMsgToMonitorQueue
(
SBnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
int32_t
bmStartWorker
(
SBnodeMgmt
*
pMgmt
)
{
SMultiWorkerCfg
cfg
=
{
.
max
=
1
,
.
name
=
"bnode-write"
,
.
fp
=
(
FItems
)
bmProcessWriteQueue
,
.
param
=
pMgmt
,
};
if
(
tMultiWorkerInit
(
&
pMgmt
->
writeWorker
,
&
cfg
)
!=
0
)
{
dError
(
"failed to start bnode-write worker since %s"
,
terrstr
());
return
-
1
;
}
SSingleWorkerCfg
mCfg
=
{
.
min
=
1
,
.
max
=
1
,
.
name
=
"bnode-monitor"
,
.
fp
=
(
FItem
)
bmProcessMonitorQueue
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start bnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
dDebug
(
"bnode workers are initialized"
);
return
0
;
}
void
bmStopWorker
(
SBnodeMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
monitorWorker
);
tMultiWorkerCleanup
(
&
pMgmt
->
writeWorker
);
dDebug
(
"bnode workers are closed"
);
}
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
fc5af249
...
...
@@ -326,8 +326,6 @@ SArray *dmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_QNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_SNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_SNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_BNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_BNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SERVER_STATUS
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SYSTABLE_RETRIEVE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
fc5af249
...
...
@@ -132,12 +132,6 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
case
TDMT_DND_DROP_SNODE
:
code
=
(
*
pMgmt
->
processDropNodeFp
)(
SNODE
,
pMsg
);
break
;
case
TDMT_DND_CREATE_BNODE
:
code
=
(
*
pMgmt
->
processCreateNodeFp
)(
BNODE
,
pMsg
);
break
;
case
TDMT_DND_DROP_BNODE
:
code
=
(
*
pMgmt
->
processDropNodeFp
)(
BNODE
,
pMsg
);
break
;
case
TDMT_DND_SERVER_STATUS
:
code
=
dmProcessServerRunStatus
(
pMgmt
,
pMsg
);
break
;
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
fc5af249
...
...
@@ -105,7 +105,7 @@ int32_t mmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) {
int32_t
mmProcessDropReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
)
{
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
SDDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -136,8 +136,6 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_QNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_SNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_SNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_BNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_BNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_VNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_VNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
@@ -163,8 +161,6 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DNODE_LIST
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_SNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_SNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_BNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_BNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_USE_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
浏览文件 @
fc5af249
...
...
@@ -56,7 +56,7 @@ int32_t qmProcessGetMonitorInfoReq(SQnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t
qmProcessCreateReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
)
{
SDCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -78,7 +78,7 @@ int32_t qmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) {
int32_t
qmProcessDropReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
)
{
SDDropQnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
source/dnode/mgmt/mgmt_snode/src/smHandle.c
浏览文件 @
fc5af249
...
...
@@ -45,7 +45,7 @@ int32_t smProcessGetMonitorInfoReq(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t
smProcessCreateReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
)
{
SDCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -67,7 +67,7 @@ int32_t smProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) {
int32_t
smProcessDropReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
)
{
SDDropSnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
source/dnode/mgmt/node_mgmt/CMakeLists.txt
浏览文件 @
fc5af249
aux_source_directory
(
src IMPLEMENT_SRC
)
add_library
(
dnode STATIC
${
IMPLEMENT_SRC
}
)
target_link_libraries
(
dnode mgmt_
bnode mgmt_
mnode mgmt_qnode mgmt_snode mgmt_vnode mgmt_dnode
dnode mgmt_mnode mgmt_qnode mgmt_snode mgmt_vnode mgmt_dnode
)
target_include_directories
(
dnode
...
...
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
浏览文件 @
fc5af249
...
...
@@ -23,7 +23,6 @@ extern "C" {
#endif
SMgmtFunc
dmGetMgmtFunc
();
SMgmtFunc
bmGetMgmtFunc
();
SMgmtFunc
qmGetMgmtFunc
();
SMgmtFunc
smGetMgmtFunc
();
SMgmtFunc
vmGetMgmtFunc
();
...
...
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
fc5af249
...
...
@@ -141,7 +141,6 @@ int32_t dmInitDnode(SDnode *pDnode, EDndNodeType rtype) {
pDnode
->
wrappers
[
VNODE
].
func
=
vmGetMgmtFunc
();
pDnode
->
wrappers
[
QNODE
].
func
=
qmGetMgmtFunc
();
pDnode
->
wrappers
[
SNODE
].
func
=
smGetMgmtFunc
();
pDnode
->
wrappers
[
BNODE
].
func
=
bmGetMgmtFunc
();
for
(
EDndNodeType
ntype
=
DNODE
;
ntype
<
NODE_END
;
++
ntype
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
ntype
];
...
...
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
浏览文件 @
fc5af249
...
...
@@ -41,7 +41,6 @@ static void dmGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
pInfo
->
has_mnode
=
pDnode
->
wrappers
[
MNODE
].
required
;
pInfo
->
has_qnode
=
pDnode
->
wrappers
[
QNODE
].
required
;
pInfo
->
has_snode
=
pDnode
->
wrappers
[
SNODE
].
required
;
pInfo
->
has_bnode
=
pDnode
->
wrappers
[
BNODE
].
required
;
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
pInfo
->
logdir
.
size
=
tsLogSpace
.
size
;
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
...
...
@@ -116,21 +115,6 @@ static void dmGetSmMonitorInfo(SDnode *pDnode) {
}
}
static
void
dmGetBmMonitorInfo
(
SDnode
*
pDnode
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
BNODE
];
if
(
dmMarkWrapper
(
pWrapper
)
==
0
)
{
SMonBmInfo
bmInfo
=
{
0
};
if
(
tsMultiProcess
)
{
dmSendLocalRecv
(
pDnode
,
TDMT_MON_BM_INFO
,
tDeserializeSMonBmInfo
,
&
bmInfo
);
}
else
if
(
pWrapper
->
pMgmt
!=
NULL
)
{
bmGetMonitorInfo
(
pWrapper
->
pMgmt
,
&
bmInfo
);
}
dmReleaseWrapper
(
pWrapper
);
monSetBmInfo
(
&
bmInfo
);
tFreeSMonBmInfo
(
&
bmInfo
);
}
}
void
dmSendMonitorReport
()
{
if
(
!
tsEnableMonitor
||
tsMonitorFqdn
[
0
]
==
0
||
tsMonitorPort
==
0
)
return
;
dTrace
(
"send monitor report to %s:%u"
,
tsMonitorFqdn
,
tsMonitorPort
);
...
...
@@ -141,7 +125,6 @@ void dmSendMonitorReport() {
dmGetVmMonitorInfo
(
pDnode
);
dmGetQmMonitorInfo
(
pDnode
);
dmGetSmMonitorInfo
(
pDnode
);
dmGetBmMonitorInfo
(
pDnode
);
monSendReport
();
}
...
...
source/dnode/mgmt/node_mgmt/src/dmNodes.c
浏览文件 @
fc5af249
...
...
@@ -26,8 +26,6 @@ static int32_t dmCreateShm(SMgmtWrapper *pWrapper) {
shmsize
=
tsSnodeShmSize
;
}
else
if
(
pWrapper
->
ntype
==
MNODE
)
{
shmsize
=
tsMnodeShmSize
;
}
else
if
(
pWrapper
->
ntype
==
BNODE
)
{
shmsize
=
tsBnodeShmSize
;
}
else
{
return
-
1
;
}
...
...
source/dnode/mgmt/node_util/CMakeLists.txt
浏览文件 @
fc5af249
...
...
@@ -6,5 +6,5 @@ target_include_directories(
PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
node_util cjson mnode vnode qnode snode
bnode
wal sync taos_static tfs monitor
node_util cjson mnode vnode qnode snode wal sync taos_static tfs monitor
)
\ No newline at end of file
source/dnode/mgmt/node_util/inc/dmUtil.h
浏览文件 @
fc5af249
...
...
@@ -68,8 +68,7 @@ typedef enum {
VNODE
=
2
,
QNODE
=
3
,
SNODE
=
4
,
BNODE
=
5
,
NODE_END
=
6
,
NODE_END
=
5
,
}
EDndNodeType
;
typedef
enum
{
...
...
source/dnode/mgmt/node_util/src/dmUtil.c
浏览文件 @
fc5af249
...
...
@@ -39,8 +39,6 @@ const char *dmNodeLogName(EDndNodeType ntype) {
return
"snode"
;
case
MNODE
:
return
"mnode"
;
case
BNODE
:
return
"bnode"
;
default:
return
"taosd"
;
}
...
...
@@ -56,8 +54,6 @@ const char *dmNodeProcName(EDndNodeType ntype) {
return
"taoss"
;
case
MNODE
:
return
"taosm"
;
case
BNODE
:
return
"taosb"
;
default:
return
"taosd"
;
}
...
...
@@ -73,8 +69,6 @@ const char *dmNodeName(EDndNodeType ntype) {
return
"snode"
;
case
MNODE
:
return
"mnode"
;
case
BNODE
:
return
"bnode"
;
default:
return
"dnode"
;
}
...
...
source/dnode/mgmt/test/CMakeLists.txt
浏览文件 @
fc5af249
if
(
${
BUILD_TEST
}
)
enable_testing
()
add_subdirectory
(
qnode
)
add_subdirectory
(
bnode
)
add_subdirectory
(
snode
)
#add_subdirectory(mnode)
add_subdirectory
(
vnode
)
...
...
source/dnode/mgmt/test/bnode/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
510a7458
aux_source_directory
(
. DND_BNODE_TEST_SRC
)
add_executable
(
dbnodeTest
${
DND_BNODE_TEST_SRC
}
)
target_link_libraries
(
dbnodeTest sut
)
add_test
(
NAME dbnodeTest
COMMAND dbnodeTest
)
source/dnode/mgmt/test/bnode/dbnode.cpp
已删除
100644 → 0
浏览文件 @
510a7458
/**
* @file dbnode.cpp
* @author slguan (slguan@taosdata.com)
* @brief DNODE module bnode tests
* @version 1.0
* @date 2022-01-05
*
* @copyright Copyright (c) 2022
*
*/
#include "sut.h"
class
DndTestBnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
TD_TMP_DIR_PATH
"dbnodeTest"
,
9112
);
taosMsleep
(
1100
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
public:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
};
Testbase
DndTestBnode
::
test
;
TEST_F
(
DndTestBnode
,
01
_Create_Bnode
)
{
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_ALREADY_DEPLOYED
);
}
// test.Restart();
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_ALREADY_DEPLOYED
);
}
}
TEST_F
(
DndTestBnode
,
02
_Drop_Bnode
)
{
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_NOT_DEPLOYED
);
}
// test.Restart();
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_NOT_DEPLOYED
);
}
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
}
source/dnode/mgmt/test/mnode/dmnode.cpp
浏览文件 @
fc5af249
...
...
@@ -139,9 +139,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -152,9 +152,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -165,9 +165,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/qnode/dqnode.cpp
浏览文件 @
fc5af249
...
...
@@ -30,9 +30,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -43,9 +43,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -56,9 +56,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -71,9 +71,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -87,9 +87,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq dropReq = {0};
dropReq.dnodeId = 2;
int32_t contLen = tSerializeSCreateDropMQS
B
NodeReq(NULL, 0, &dropReq);
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq);
void* pReq = rpcMallocCont(contLen);
tSerializeSCreateDropMQS
B
NodeReq(pReq, contLen, &dropReq);
tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
ASSERT_NE(pRsp, nullptr);
...
...
@@ -101,9 +101,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -114,9 +114,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -129,9 +129,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -142,9 +142,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/snode/dsnode.cpp
浏览文件 @
fc5af249
...
...
@@ -30,9 +30,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -43,9 +43,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -56,9 +56,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -71,9 +71,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -87,9 +87,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq dropReq = {0};
dropReq.dnodeId = 2;
int32_t contLen = tSerializeSCreateDropMQS
B
NodeReq(NULL, 0, &dropReq);
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq);
void* pReq = rpcMallocCont(contLen);
tSerializeSCreateDropMQS
B
NodeReq(pReq, contLen, &dropReq);
tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
ASSERT_NE(pRsp, nullptr);
...
...
@@ -101,9 +101,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -114,9 +114,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -129,9 +129,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -142,9 +142,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/inc/mndBnode.h
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#ifndef _TD_MND_BNODE_H_
#define _TD_MND_BNODE_H_
#include "mndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
mndInitBnode
(
SMnode
*
pMnode
);
void
mndCleanupBnode
(
SMnode
*
pMnode
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MND_BNODE_H_*/
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
fc5af249
...
...
@@ -43,8 +43,6 @@ typedef enum {
MND_OPER_CREATE_USER
,
MND_OPER_DROP_USER
,
MND_OPER_ALTER_USER
,
MND_OPER_CREATE_BNODE
,
MND_OPER_DROP_BNODE
,
MND_OPER_CREATE_DNODE
,
MND_OPER_DROP_DNODE
,
MND_OPER_CONFIG_DNODE
,
...
...
@@ -226,13 +224,6 @@ typedef struct {
SDnodeObj
*
pDnode
;
}
SSnodeObj
;
typedef
struct
{
int32_t
id
;
int64_t
createdTime
;
int64_t
updateTime
;
SDnodeObj
*
pDnode
;
}
SBnodeObj
;
typedef
struct
{
int32_t
maxUsers
;
int32_t
maxDbs
;
...
...
source/dnode/mnode/impl/src/mndBnode.c
已删除
100644 → 0
浏览文件 @
510a7458
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "mndBnode.h"
#include "mndDnode.h"
#include "mndPrivilege.h"
#include "mndShow.h"
#include "mndTrans.h"
#include "mndUser.h"
#define BNODE_VER_NUMBER 1
#define BNODE_RESERVE_SIZE 64
static
SSdbRaw
*
mndBnodeActionEncode
(
SBnodeObj
*
pObj
);
static
SSdbRow
*
mndBnodeActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndBnodeActionInsert
(
SSdb
*
pSdb
,
SBnodeObj
*
pObj
);
static
int32_t
mndBnodeActionUpdate
(
SSdb
*
pSdb
,
SBnodeObj
*
pOld
,
SBnodeObj
*
pNew
);
static
int32_t
mndBnodeActionDelete
(
SSdb
*
pSdb
,
SBnodeObj
*
pObj
);
static
int32_t
mndProcessCreateBnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDropBnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndRetrieveBnodes
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextBnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitBnode
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{
.
sdbType
=
SDB_BNODE
,
.
keyType
=
SDB_KEY_INT32
,
.
encodeFp
=
(
SdbEncodeFp
)
mndBnodeActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mndBnodeActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mndBnodeActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mndBnodeActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndBnodeActionDelete
,
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_BNODE
,
mndProcessCreateBnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_BNODE
,
mndProcessDropBnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_BNODE_RSP
,
mndTransProcessRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_DROP_BNODE_RSP
,
mndTransProcessRsp
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_BNODE
,
mndRetrieveBnodes
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_BNODE
,
mndCancelGetNextBnode
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
void
mndCleanupBnode
(
SMnode
*
pMnode
)
{}
static
SBnodeObj
*
mndAcquireBnode
(
SMnode
*
pMnode
,
int32_t
bnodeId
)
{
SBnodeObj
*
pObj
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_BNODE
,
&
bnodeId
);
if
(
pObj
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_BNODE_NOT_EXIST
;
}
return
pObj
;
}
static
void
mndReleaseBnode
(
SMnode
*
pMnode
,
SBnodeObj
*
pObj
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbRelease
(
pSdb
,
pObj
);
}
static
SSdbRaw
*
mndBnodeActionEncode
(
SBnodeObj
*
pObj
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_BNODE
,
BNODE_VER_NUMBER
,
sizeof
(
SBnodeObj
)
+
BNODE_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_SET_INT32
(
pRaw
,
dataPos
,
pObj
->
id
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
createdTime
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
updateTime
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
BNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"bnode:%d, failed to encode to raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
return
NULL
;
}
mTrace
(
"bnode:%d, encode to raw:%p, row:%p"
,
pObj
->
id
,
pRaw
,
pObj
);
return
pRaw
;
}
static
SSdbRow
*
mndBnodeActionDecode
(
SSdbRaw
*
pRaw
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
BNODE_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
_OVER
;
}
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
SBnodeObj
));
if
(
pRow
==
NULL
)
goto
_OVER
;
SBnodeObj
*
pObj
=
sdbGetRowObj
(
pRow
);
if
(
pObj
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pObj
->
id
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
createdTime
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
updateTime
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
BNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"bnode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
taosMemoryFreeClear
(
pRow
);
return
NULL
;
}
mTrace
(
"bnode:%d, decode from raw:%p, row:%p"
,
pObj
->
id
,
pRaw
,
pObj
);
return
pRow
;
}
static
int32_t
mndBnodeActionInsert
(
SSdb
*
pSdb
,
SBnodeObj
*
pObj
)
{
mTrace
(
"bnode:%d, perform insert action, row:%p"
,
pObj
->
id
,
pObj
);
pObj
->
pDnode
=
sdbAcquire
(
pSdb
,
SDB_DNODE
,
&
pObj
->
id
);
if
(
pObj
->
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
mError
(
"bnode:%d, failed to perform insert action since %s"
,
pObj
->
id
,
terrstr
());
return
-
1
;
}
return
0
;
}
static
int32_t
mndBnodeActionDelete
(
SSdb
*
pSdb
,
SBnodeObj
*
pObj
)
{
mTrace
(
"bnode:%d, perform delete action, row:%p"
,
pObj
->
id
,
pObj
);
if
(
pObj
->
pDnode
!=
NULL
)
{
sdbRelease
(
pSdb
,
pObj
->
pDnode
);
pObj
->
pDnode
=
NULL
;
}
return
0
;
}
static
int32_t
mndBnodeActionUpdate
(
SSdb
*
pSdb
,
SBnodeObj
*
pOld
,
SBnodeObj
*
pNew
)
{
mTrace
(
"bnode:%d, perform update action, old row:%p new row:%p"
,
pOld
->
id
,
pOld
,
pNew
);
pOld
->
updateTime
=
pNew
->
updateTime
;
return
0
;
}
static
int32_t
mndSetCreateBnodeRedoLogs
(
STrans
*
pTrans
,
SBnodeObj
*
pObj
)
{
SSdbRaw
*
pRedoRaw
=
mndBnodeActionEncode
(
pObj
);
if
(
pRedoRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_CREATING
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
mndSetCreateBnodeUndoLogs
(
STrans
*
pTrans
,
SBnodeObj
*
pObj
)
{
SSdbRaw
*
pUndoRaw
=
mndBnodeActionEncode
(
pObj
);
if
(
pUndoRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendUndolog
(
pTrans
,
pUndoRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pUndoRaw
,
SDB_STATUS_DROPPED
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
mndSetCreateBnodeCommitLogs
(
STrans
*
pTrans
,
SBnodeObj
*
pObj
)
{
SSdbRaw
*
pCommitRaw
=
mndBnodeActionEncode
(
pObj
);
if
(
pCommitRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_READY
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
mndSetCreateBnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_CREATE_BNODE
;
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
return
-
1
;
}
return
0
;
}
static
int32_t
mndSetCreateBnodeUndoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_BNODE
;
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
return
-
1
;
}
return
0
;
}
static
int32_t
mndCreateBnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateBnodeReq
*
pCreate
)
{
int32_t
code
=
-
1
;
SBnodeObj
bnodeObj
=
{
0
};
bnodeObj
.
id
=
pDnode
->
id
;
bnodeObj
.
createdTime
=
taosGetTimestampMs
();
bnodeObj
.
updateTime
=
bnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"create-bnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mInfo
(
"trans:%d, used to create bnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
if
(
mndSetCreateBnodeRedoLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateBnodeUndoLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateBnodeCommitLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateBnodeRedoActions
(
pTrans
,
pDnode
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateBnodeUndoActions
(
pTrans
,
pDnode
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
static
int32_t
mndProcessCreateBnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
SBnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SMCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
mInfo
(
"bnode:%d, start to create"
,
createReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CREATE_BNODE
)
!=
0
)
{
goto
_OVER
;
}
pObj
=
mndAcquireBnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pObj
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_BNODE_ALREADY_EXIST
;
goto
_OVER
;
}
else
if
(
terrno
!=
TSDB_CODE_MND_BNODE_NOT_EXIST
)
{
goto
_OVER
;
}
pDnode
=
mndAcquireDnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
goto
_OVER
;
}
code
=
mndCreateBnode
(
pMnode
,
pReq
,
pDnode
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"bnode:%d, failed to create since %s"
,
createReq
.
dnodeId
,
terrstr
());
}
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
return
code
;
}
static
int32_t
mndSetDropBnodeRedoLogs
(
STrans
*
pTrans
,
SBnodeObj
*
pObj
)
{
SSdbRaw
*
pRedoRaw
=
mndBnodeActionEncode
(
pObj
);
if
(
pRedoRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_DROPPING
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
mndSetDropBnodeCommitLogs
(
STrans
*
pTrans
,
SBnodeObj
*
pObj
)
{
SSdbRaw
*
pCommitRaw
=
mndBnodeActionEncode
(
pObj
);
if
(
pCommitRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_DROPPED
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
mndSetDropBnodeRedoActions
(
STrans
*
pTrans
,
SDnodeObj
*
pDnode
,
SBnodeObj
*
pObj
)
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_BNODE
;
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
return
-
1
;
}
return
0
;
}
static
int32_t
mndDropBnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SBnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
pReq
,
"drop-bnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mInfo
(
"trans:%d, used to drop bnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSetDropBnodeRedoLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropBnodeCommitLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropBnodeRedoActions
(
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
static
int32_t
mndProcessDropBnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
SBnodeObj
*
pObj
=
NULL
;
SMDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
mInfo
(
"bnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_BNODE
)
!=
0
)
{
goto
_OVER
;
}
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
pObj
=
mndAcquireBnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pObj
==
NULL
)
{
goto
_OVER
;
}
code
=
mndDropBnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"bnode:%d, failed to drop since %s"
,
dropReq
.
dnodeId
,
terrstr
());
}
mndReleaseBnode
(
pMnode
,
pObj
);
return
code
;
}
static
int32_t
mndRetrieveBnodes
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
SBnodeObj
*
pObj
=
NULL
;
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_BNODE
,
pShow
->
pIter
,
(
void
**
)
&
pObj
);
if
(
pShow
->
pIter
==
NULL
)
break
;
cols
=
0
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
char
buf
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
pObj
->
pDnode
->
ep
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
buf
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
createdTime
,
false
);
numOfRows
++
;
sdbRelease
(
pSdb
,
pObj
);
}
pShow
->
numOfRows
+=
numOfRows
;
return
numOfRows
;
}
static
void
mndCancelGetNextBnode
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
}
source/dnode/mnode/impl/src/mndDump.c
浏览文件 @
fc5af249
...
...
@@ -447,10 +447,6 @@ void dumpDnode(SSdb *pSdb, SJson *json) {
}
}
void
dumpBnode
(
SSdb
*
pSdb
,
SJson
*
json
)
{
// not implemented yet
}
void
dumpSnode
(
SSdb
*
pSdb
,
SJson
*
json
)
{
void
*
pIter
=
NULL
;
SJson
*
items
=
tjsonAddArrayToObject
(
json
,
"snodes"
);
...
...
@@ -616,7 +612,6 @@ void mndDumpSdb() {
dumpAuth
(
pSdb
,
json
);
dumpUser
(
pSdb
,
json
);
dumpDnode
(
pSdb
,
json
);
dumpBnode
(
pSdb
,
json
);
dumpSnode
(
pSdb
,
json
);
dumpQnode
(
pSdb
,
json
);
dumpMnode
(
pSdb
,
json
);
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
fc5af249
...
...
@@ -15,7 +15,6 @@
#define _DEFAULT_SOURCE
#include "mndAcct.h"
#include "mndBnode.h"
#include "mndCluster.h"
#include "mndConsumer.h"
#include "mndDb.h"
...
...
@@ -296,7 +295,6 @@ static int32_t mndInitSteps(SMnode *pMnode) {
if
(
mndAllocStep
(
pMnode
,
"mnode-mnode"
,
mndInitMnode
,
mndCleanupMnode
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-qnode"
,
mndInitQnode
,
mndCleanupQnode
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-snode"
,
mndInitSnode
,
mndCleanupSnode
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-bnode"
,
mndInitBnode
,
mndCleanupBnode
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-dnode"
,
mndInitDnode
,
mndCleanupDnode
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-user"
,
mndInitUser
,
mndCleanupUser
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-grant"
,
mndInitGrant
,
mndCleanupGrant
)
!=
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
fc5af249
...
...
@@ -324,9 +324,9 @@ static int32_t mndBuildAlterMnodeRedoAction(STrans *pTrans, SDCreateMnodeReq *pA
}
static
int32_t
mndBuildDropMnodeRedoAction
(
STrans
*
pTrans
,
SDDropMnodeReq
*
pDropReq
,
SEpSet
*
pDroprEpSet
)
{
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
pDropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
pDropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
pDropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
pDropReq
);
STransAction
action
=
{
.
epSet
=
*
pDroprEpSet
,
...
...
@@ -410,7 +410,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
SDnodeObj
*
pDnode
=
NULL
;
SMCreateMnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -533,7 +533,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
SMnodeObj
*
pObj
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
fc5af249
...
...
@@ -190,13 +190,13 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -217,13 +217,13 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -273,7 +273,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
SDnodeObj
*
pDnode
=
NULL
;
SMCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -330,13 +330,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -384,7 +384,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) {
SQnodeObj
*
pObj
=
NULL
;
SMDropQnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
fc5af249
...
...
@@ -60,8 +60,6 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
type
=
TSDB_MGMT_TABLE_MODULE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_QNODES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_QNODE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_BNODES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_BNODE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_SNODES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_SNODE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_CLUSTER
,
len
)
==
0
)
{
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
fc5af249
...
...
@@ -195,13 +195,13 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -222,13 +222,13 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -282,7 +282,7 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
SDnodeObj
*
pDnode
=
NULL
;
SMCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -341,13 +341,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -398,7 +398,7 @@ static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
SSnodeObj
*
pObj
=
NULL
;
SMDropSnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQS
B
NodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
source/dnode/mnode/impl/test/CMakeLists.txt
浏览文件 @
fc5af249
enable_testing
()
add_subdirectory
(
acct
)
add_subdirectory
(
bnode
)
add_subdirectory
(
db
)
#add_subdirectory(dnode)
add_subdirectory
(
func
)
...
...
source/dnode/mnode/impl/test/bnode/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
510a7458
# aux_source_directory(. MNODE_BNODE_TEST_SRC)
# add_executable(mbnodeTest ${MNODE_BNODE_TEST_SRC})
# target_link_libraries(
# mbnodeTest
# PUBLIC sut
# )
# add_test(
# NAME mbnodeTest
# COMMAND mbnodeTest
# )
source/dnode/mnode/impl/test/bnode/mbnode.cpp
已删除
100644 → 0
浏览文件 @
510a7458
/**
* @file bnode.cpp
* @author slguan (slguan@taosdata.com)
* @brief MNODE module bnode tests
* @version 1.0
* @date 2022-01-05
*
* @copyright Copyright (c) 2022
*
*/
#include "sut.h"
class
MndTestBnode
:
public
::
testing
::
Test
{
public:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
public:
static
void
SetUpTestSuite
()
{
test
.
Init
(
TD_TMP_DIR_PATH
"mnode_test_bnode1"
,
9018
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9018"
;
server2
.
Start
(
TD_TMP_DIR_PATH
"mnode_test_bnode2"
,
9019
);
taosMsleep
(
300
);
}
static
void
TearDownTestSuite
()
{
server2
.
Stop
();
test
.
Cleanup
();
}
static
Testbase
test
;
static
TestServer
server2
;
};
Testbase
MndTestBnode
::
test
;
TestServer
MndTestBnode
::
server2
;
TEST_F
(
MndTestBnode
,
01
_Show_Bnode
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_BNODE
,
"bnodes"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
}
TEST_F
(
MndTestBnode
,
02
_Create_Bnode
)
{
{
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_DNODE_NOT_EXIST
);
}
{
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_BNODE
,
"bnodes"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
{
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_BNODE_ALREADY_EXIST
);
}
}
TEST_F
(
MndTestBnode
,
03
_Drop_Bnode
)
{
{
SCreateDnodeReq
createReq
=
{
0
};
strcpy
(
createReq
.
fqdn
,
"localhost"
);
createReq
.
port
=
9019
;
int32_t
contLen
=
tSerializeSCreateDnodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDnodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_DNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
taosMsleep
(
1300
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DNODE
,
"dnodes"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
{
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_BNODE
,
"bnodes"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
{
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_BNODE
,
"bnodes"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
{
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_BNODE_NOT_EXIST
);
}
}
TEST_F
(
MndTestBnode
,
03
_Create_Bnode_Rollback
)
{
{
// send message first, then dnode2 crash, result is returned, and rollback is started
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_RPC_NETWORK_UNAVAIL
);
}
{
// continue send message, bnode is creating
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_SDB_OBJ_CREATING
);
}
{
// continue send message, bnode is creating
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_SDB_OBJ_CREATING
);
}
{
// server start, wait until the rollback finished
server2
.
DoStart
();
taosMsleep
(
1000
);
int32_t
retry
=
0
;
int32_t
retryMax
=
20
;
for
(
retry
=
0
;
retry
<
retryMax
;
retry
++
)
{
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
if
(
pRsp
->
code
==
0
)
break
;
taosMsleep
(
1000
);
}
ASSERT_NE
(
retry
,
retryMax
);
}
}
TEST_F
(
MndTestBnode
,
04
_Drop_Bnode_Rollback
)
{
{
// send message first, then dnode2 crash, result is returned, and rollback is started
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_RPC_NETWORK_UNAVAIL
);
}
{
// continue send message, bnode is dropping
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_SDB_OBJ_DROPPING
);
}
{
// continue send message, bnode is dropping
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_SDB_OBJ_DROPPING
);
}
{
// server start, wait until the rollback finished
server2
.
DoStart
();
taosMsleep
(
1000
);
int32_t
retry
=
0
;
int32_t
retryMax
=
20
;
for
(
retry
=
0
;
retry
<
retryMax
;
retry
++
)
{
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
if
(
pRsp
->
code
==
0
)
break
;
taosMsleep
(
1000
);
}
ASSERT_NE
(
retry
,
retryMax
);
}
}
source/dnode/mnode/impl/test/mnode/mnode.cpp
浏览文件 @
fc5af249
...
...
@@ -48,9 +48,9 @@ TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -63,9 +63,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Invalid_Id) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -98,9 +98,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -115,9 +115,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -132,9 +132,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -148,9 +148,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
...
...
@@ -163,9 +163,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -177,9 +177,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -198,9 +198,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -218,9 +218,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
...
...
@@ -233,9 +233,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -247,9 +247,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -268,9 +268,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/test/qnode/qnode.cpp
浏览文件 @
fc5af249
...
...
@@ -48,9 +48,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -61,9 +61,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -77,9 +77,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -110,9 +110,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -126,9 +126,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -142,9 +142,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -158,9 +158,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
taosMsleep
(
1000
);
...
...
@@ -176,9 +176,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -190,9 +190,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -212,9 +212,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -231,9 +231,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
...
...
@@ -246,9 +246,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_SDB_OBJ_DROPPING
);
...
...
@@ -259,9 +259,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -280,9 +280,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
if
(
pRsp
->
code
==
0
)
break
;
...
...
source/dnode/mnode/impl/test/snode/snode.cpp
浏览文件 @
fc5af249
...
...
@@ -48,9 +48,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -61,9 +61,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -77,9 +77,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -110,9 +110,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -126,9 +126,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -142,9 +142,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -158,9 +158,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
...
...
@@ -173,9 +173,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -187,9 +187,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -208,9 +208,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -228,9 +228,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
...
...
@@ -243,9 +243,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -257,9 +257,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -278,9 +278,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/test/trans/trans1.cpp
浏览文件 @
fc5af249
...
...
@@ -112,9 +112,9 @@ TEST_F(MndTestTrans1, 02_Create_Qnode1_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -129,9 +129,9 @@ TEST_F(MndTestTrans1, 02_Create_Qnode1_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -165,9 +165,9 @@ TEST_F(MndTestTrans1, 03_Create_Qnode2_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
...
...
@@ -209,9 +209,9 @@ TEST_F(MndTestTrans1, 03_Create_Qnode2_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -232,9 +232,9 @@ TEST_F(MndTestTrans1, 03_Create_Qnode2_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeSCreateDropMQS
B
NodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDropMQSNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateDropMQS
B
NodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeSCreateDropMQSNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/sdb/inc/sdb.h
浏览文件 @
fc5af249
...
...
@@ -132,7 +132,6 @@ typedef enum {
SDB_MNODE
=
2
,
SDB_QNODE
=
3
,
SDB_SNODE
=
4
,
SDB_BNODE
=
5
,
SDB_DNODE
=
6
,
SDB_USER
=
7
,
SDB_AUTH
=
8
,
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
fc5af249
...
...
@@ -30,8 +30,6 @@ const char *sdbTableName(ESdbType type) {
return
"qnode"
;
case
SDB_SNODE
:
return
"snode"
;
case
SDB_BNODE
:
return
"bnode"
;
case
SDB_DNODE
:
return
"dnode"
;
case
SDB_USER
:
...
...
source/libs/monitor/src/monMain.c
浏览文件 @
fc5af249
...
...
@@ -401,7 +401,6 @@ static void monGenDnodeJson(SMonInfo *pMonitor) {
tjsonAddDoubleToObject
(
pJson
,
"has_mnode"
,
pInfo
->
has_mnode
);
tjsonAddDoubleToObject
(
pJson
,
"has_qnode"
,
pInfo
->
has_qnode
);
tjsonAddDoubleToObject
(
pJson
,
"has_snode"
,
pInfo
->
has_snode
);
tjsonAddDoubleToObject
(
pJson
,
"has_bnode"
,
pInfo
->
has_bnode
);
}
static
void
monGenDiskJson
(
SMonInfo
*
pMonitor
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
fc5af249
...
...
@@ -5166,7 +5166,7 @@ static int16_t getCreateComponentNodeMsgType(ENodeType type) {
static
int32_t
translateCreateComponentNode
(
STranslateContext
*
pCxt
,
SCreateComponentNodeStmt
*
pStmt
)
{
SMCreateQnodeReq
createReq
=
{.
dnodeId
=
pStmt
->
dnodeId
};
return
buildCmdMsg
(
pCxt
,
getCreateComponentNodeMsgType
(
nodeType
(
pStmt
)),
(
FSerializeFunc
)
tSerializeSCreateDropMQS
B
NodeReq
,
&
createReq
);
(
FSerializeFunc
)
tSerializeSCreateDropMQSNodeReq
,
&
createReq
);
}
static
int16_t
getDropComponentNodeMsgType
(
ENodeType
type
)
{
...
...
@@ -5188,7 +5188,7 @@ static int16_t getDropComponentNodeMsgType(ENodeType type) {
static
int32_t
translateDropComponentNode
(
STranslateContext
*
pCxt
,
SDropComponentNodeStmt
*
pStmt
)
{
SDDropQnodeReq
dropReq
=
{.
dnodeId
=
pStmt
->
dnodeId
};
return
buildCmdMsg
(
pCxt
,
getDropComponentNodeMsgType
(
nodeType
(
pStmt
)),
(
FSerializeFunc
)
tSerializeSCreateDropMQS
B
NodeReq
,
&
dropReq
);
(
FSerializeFunc
)
tSerializeSCreateDropMQSNodeReq
,
&
dropReq
);
}
static
int32_t
checkTopicQuery
(
STranslateContext
*
pCxt
,
SSelectStmt
*
pSelect
)
{
...
...
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
fc5af249
...
...
@@ -27,25 +27,6 @@ TEST_F(ParserInitialCTest, createAccount) {
run
(
"CREATE ACCOUNT ac_wxy PASS '123456'"
,
TSDB_CODE_PAR_EXPRIE_STATEMENT
,
PARSER_STAGE_PARSE
);
}
TEST_F
(
ParserInitialCTest
,
createBnode
)
{
useDb
(
"root"
,
"test"
);
SMCreateQnodeReq
expect
=
{
0
};
auto
setCreateQnodeReq
=
[
&
](
int32_t
dnodeId
)
{
expect
.
dnodeId
=
dnodeId
;
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_CREATE_BNODE_STMT
);
SMCreateQnodeReq
req
=
{
0
};
ASSERT_TRUE
(
TSDB_CODE_SUCCESS
==
tDeserializeSCreateDropMQSBNodeReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
));
ASSERT_EQ
(
req
.
dnodeId
,
expect
.
dnodeId
);
});
setCreateQnodeReq
(
1
);
run
(
"CREATE BNODE ON DNODE 1"
);
}
/*
* CREATE DATABASE [IF NOT EXISTS] db_name [database_options]
*
...
...
source/libs/parser/test/parInitialDTest.cpp
浏览文件 @
fc5af249
...
...
@@ -52,12 +52,6 @@ TEST_F(ParserInitialDTest, describe) {
// todo describe
// todo DROP account
TEST_F
(
ParserInitialDTest
,
dropBnode
)
{
useDb
(
"root"
,
"test"
);
run
(
"DROP BNODE ON DNODE 1"
);
}
// DROP CONSUMER GROUP [ IF EXISTS ] cgroup_name ON topic_name
TEST_F
(
ParserInitialDTest
,
dropConsumerGroup
)
{
useDb
(
"root"
,
"test"
);
...
...
source/util/src/terror.c
浏览文件 @
fc5af249
...
...
@@ -238,8 +238,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_QNODE_ALREADY_EXIST, "Qnode already exists"
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_QNODE_NOT_EXIST
,
"Qnode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SNODE_ALREADY_EXIST
,
"Snode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SNODE_NOT_EXIST
,
"Snode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_ALREADY_EXIST
,
"Bnode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_NOT_EXIST
,
"Bnode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_FEW_MNODES
,
"The replica of mnode cannot less than 1"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_MNODES
,
"The replica of mnode cannot exceed 3"
)
...
...
tests/script/jenkins/basic.txt
浏览文件 @
fc5af249
...
...
@@ -187,9 +187,6 @@
# ---- snode ----
# unsupport ./test.sh -f tsim/snode/basic1.sim
# ---- bnode
./test.sh -f tsim/bnode/basic1.sim
# ---- mnode
./test.sh -f tsim/mnode/basic1.sim
./test.sh -f tsim/mnode/basic2.sim
...
...
tests/script/tmp/monitor.sim
浏览文件 @
fc5af249
...
...
@@ -23,5 +23,4 @@ sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 bin
print =============== create drop qnode 1
sql create qnode on dnode 1
#sql create snode on dnode 1
#sql create bnode on dnode 1
tests/script/tsim/bnode/basic1.sim
已删除
100644 → 0
浏览文件 @
510a7458
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sql connect
print =============== select * from information_schema.ins_dnodes
sql select * from information_schema.ins_dnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql select * from information_schema.ins_mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != leader then
return -1
endi
print =============== create dnodes
sql create dnode $hostname port 7200
sleep 2000
sql select * from information_schema.ins_dnodes;
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
print $data02
if $data02 != 0 then
return -1
endi
if $data12 != 0 then
return -1
endi
if $data04 != ready then
return -1
endi
if $data14 != ready then
return -1
endi
sql select * from information_schema.ins_mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != leader then
return -1
endi
#print =============== create drop bnode 1
#sql create bnode on dnode 1
#sql show bnodes
#if $rows != 1 then
# return -1
#endi
#if $data00 != 1 then
# return -1
#endi
#sql_error create bnode on dnode 1
#
#sql drop bnode on dnode 1
#sql show bnodes
#if $rows != 0 then
# return -1
#endi
#sql_error drop bnode on dnode 1
#
#print =============== create drop bnode 2
#sql create bnode on dnode 2
#sql show bnodes
#if $rows != 1 then
# return -1
#endi
#if $data00 != 2 then
# return -1
#endi
#sql_error create bnode on dnode 2
#
#sql drop bnode on dnode 2
#sql show bnodes
#if $rows != 0 then
# return -1
#endi
#sql_error drop bnode on dnode 2
#
#print =============== create drop bnodes
#sql create bnode on dnode 1
#sql create bnode on dnode 2
#sql show bnodes
#if $rows != 2 then
# return -1
#endi
#print =============== restart
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
#system sh/exec.sh -n dnode2 -s stop -x SIGINT
#system sh/exec.sh -n dnode1 -s start
#system sh/exec.sh -n dnode2 -s start
#
#sleep 2000
#sql show bnodes
#if $rows != 2 then
# return -1
#endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
tests/script/tsim/testsuit.sim
浏览文件 @
fc5af249
...
...
@@ -128,5 +128,4 @@ run tsim/sync/threeReplica1VgElectWihtInsert.sim
run tsim/sma/tsmaCreateInsertQuery.sim
run tsim/sma/rsmaCreateInsertQuery.sim
run tsim/valgrind/basic.sim
run tsim/valgrind/checkError.sim
run tsim/bnode/basic1.sim
\ No newline at end of file
run tsim/valgrind/checkError.sim
\ No newline at end of file
tests/script/tsim/user/privilege_sysinfo.sim
浏览文件 @
fc5af249
...
...
@@ -110,7 +110,6 @@ sql_error show dnodes
sql_error show snodes
sql_error show qnodes
sql_error show mnodes
sql_error show bnodes
sql_error show db.vgroups
sql_error show db.stables
sql_error show db.tables
...
...
tests/system-test/0-others/taosdMonitor.py
浏览文件 @
fc5af249
...
...
@@ -125,7 +125,7 @@ class RequestHandlerImpl(http.server.BaseHTTPRequestHandler):
dnode_infos
=
[
'uptime'
,
'cpu_engine'
,
'cpu_system'
,
'cpu_cores'
,
'mem_engine'
,
'mem_system'
,
'mem_total'
,
'disk_engine'
,
'disk_used'
,
'disk_total'
,
'net_in'
,
'net_out'
,
'io_read'
,
'io_write'
,
'io_read_disk'
,
'io_write_disk'
,
'req_select'
,
'req_select_rate'
,
'req_insert'
,
'req_insert_success'
,
'req_insert_rate'
,
'req_insert_batch'
,
'req_insert_batch_success'
,
'req_insert_batch_rate'
,
'errors'
,
'vnodes_num'
,
'masters'
,
'has_mnode'
,
'has_qnode'
,
'has_snode'
,
'has_bnode'
]
'req_insert_batch_rate'
,
'errors'
,
'vnodes_num'
,
'masters'
,
'has_mnode'
,
'has_qnode'
,
'has_snode'
]
for
elem
in
dnode_infos
:
if
elem
not
in
infoDict
[
"dnode_info"
]
or
infoDict
[
"dnode_info"
][
elem
]
<
0
:
tdLog
.
exit
(
f
"
{
elem
}
is null!"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录