Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d758a102
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d758a102
编写于
4月 09, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
4月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11343 from taosdata/feature/node
feat[cluster]: create and drop qnode
上级
990fe3fa
a0460538
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
974 addition
and
564 deletion
+974
-564
include/common/tmsg.h
include/common/tmsg.h
+4
-11
include/util/taoserror.h
include/util/taoserror.h
+30
-34
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-10
source/dnode/mgmt/bm/bmHandle.c
source/dnode/mgmt/bm/bmHandle.c
+5
-6
source/dnode/mgmt/bm/bmWorker.c
source/dnode/mgmt/bm/bmWorker.c
+25
-18
source/dnode/mgmt/dm/dmFile.c
source/dnode/mgmt/dm/dmFile.c
+1
-1
source/dnode/mgmt/main/dndExec.c
source/dnode/mgmt/main/dndExec.c
+1
-1
source/dnode/mgmt/main/dndFile.c
source/dnode/mgmt/main/dndFile.c
+2
-2
source/dnode/mgmt/main/dndTransport.c
source/dnode/mgmt/main/dndTransport.c
+3
-3
source/dnode/mgmt/mm/mmFile.c
source/dnode/mgmt/mm/mmFile.c
+1
-1
source/dnode/mgmt/mm/mmHandle.c
source/dnode/mgmt/mm/mmHandle.c
+4
-4
source/dnode/mgmt/qm/qmHandle.c
source/dnode/mgmt/qm/qmHandle.c
+6
-7
source/dnode/mgmt/qm/qmWorker.c
source/dnode/mgmt/qm/qmWorker.c
+22
-18
source/dnode/mgmt/sm/smHandle.c
source/dnode/mgmt/sm/smHandle.c
+5
-5
source/dnode/mgmt/sm/smWorker.c
source/dnode/mgmt/sm/smWorker.c
+8
-7
source/dnode/mgmt/test/bnode/dbnode.cpp
source/dnode/mgmt/test/bnode/dbnode.cpp
+20
-20
source/dnode/mgmt/test/mnode/dmnode.cpp
source/dnode/mgmt/test/mnode/dmnode.cpp
+9
-9
source/dnode/mgmt/test/qnode/dqnode.cpp
source/dnode/mgmt/test/qnode/dqnode.cpp
+20
-20
source/dnode/mgmt/test/snode/dsnode.cpp
source/dnode/mgmt/test/snode/dsnode.cpp
+20
-20
source/dnode/mgmt/test/vnode/vnode.cpp
source/dnode/mgmt/test/vnode/vnode.cpp
+2
-2
source/dnode/mgmt/vm/vmFile.c
source/dnode/mgmt/vm/vmFile.c
+1
-1
source/dnode/mgmt/vm/vmHandle.c
source/dnode/mgmt/vm/vmHandle.c
+2
-2
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+56
-57
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+3
-3
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-1
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+13
-1
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
+76
-80
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+59
-62
source/dnode/mnode/impl/test/bnode/bnode.cpp
source/dnode/mnode/impl/test/bnode/bnode.cpp
+28
-28
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/trans.cpp
source/dnode/mnode/impl/test/trans/trans.cpp
+10
-10
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+4
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+12
-12
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+16
-21
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+9
-0
tests/script/tsim/bnode/basic1.sim
tests/script/tsim/bnode/basic1.sim
+135
-0
tests/script/tsim/qnode/basic1.sim
tests/script/tsim/qnode/basic1.sim
+135
-0
tests/script/tsim/snode/basic1.sim
tests/script/tsim/snode/basic1.sim
+135
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
d758a102
...
...
@@ -1023,10 +1023,11 @@ int32_t tDeserializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
,
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
,
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
int32_t
tSerializeS
MCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateM
nodeReq
*
pReq
);
int32_t
tDeserializeS
MCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateM
nodeReq
*
pReq
);
int32_t
tSerializeS
CreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQ
nodeReq
*
pReq
);
int32_t
tDeserializeS
CreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQ
nodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
...
...
@@ -1037,14 +1038,6 @@ typedef struct {
int32_t
tSerializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
);
int32_t
tDeserializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
,
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
int32_t
tSerializeSMCreateDropQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
int32_t
tDeserializeSMCreateDropQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
typedef
struct
{
char
sql
[
TSDB_SHOW_SQL_LEN
];
int32_t
queryId
;
...
...
include/util/taoserror.h
浏览文件 @
d758a102
...
...
@@ -64,31 +64,35 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016)
//common & util
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0101)
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0102)
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0103)
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0106)
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0107)
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0108)
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0109)
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x010A)
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x010B)
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x010C)
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x010D)
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x010E)
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x010F)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0110)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0111)
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0112)
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0113)
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0114)
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0115)
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x0120)
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x0121)
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x0122)
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0123)
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0100)
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0101)
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0102)
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0103)
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0104)
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0105)
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0106)
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0107)
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0108)
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x0109)
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x010A)
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x010B)
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x010C)
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x010D)
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010E)
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010F)
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0111)
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0112)
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0113)
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0114)
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0115)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0140)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0141)
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0152)
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0153)
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0154)
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0155)
//client
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
...
...
@@ -284,17 +288,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
// dnode
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x04A0)
#define TSDB_CODE_DND_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
#define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x04A2)
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
#define TSDB_CODE_NODE_PARSE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x04A5)
#define TSDB_CODE_NODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A6)
#define TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A7)
#define TSDB_CODE_DND_VNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A8)
#define TSDB_CODE_DND_VNODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A9)
#define TSDB_CODE_DND_VNODE_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x04AA)
// vnode
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
...
...
source/common/src/tmsg.c
浏览文件 @
d758a102
...
...
@@ -1203,7 +1203,7 @@ int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *
return
0
;
}
int32_t
tSerializeS
MCreateDrop
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tSerializeS
CreateDropM
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
...
@@ -1216,7 +1216,7 @@ int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnod
return
tlen
;
}
int32_t
tDeserializeS
MCreateDrop
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tDeserializeS
CreateDropM
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
...
...
@@ -1257,14 +1257,6 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
return
0
;
}
int32_t
tSerializeSMCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateMnodeReq
*
pReq
)
{
return
tSerializeSMCreateDropQSBNodeReq
(
buf
,
bufLen
,
(
SMCreateQnodeReq
*
)
pReq
);
}
int32_t
tDeserializeSMCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateMnodeReq
*
pReq
)
{
return
tDeserializeSMCreateDropQSBNodeReq
(
buf
,
bufLen
,
(
SMCreateQnodeReq
*
)
pReq
);
}
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
...
source/dnode/mgmt/bm/bmHandle.c
浏览文件 @
d758a102
...
...
@@ -16,8 +16,7 @@
#define _DEFAULT_SOURCE
#include "bmInt.h"
void
bmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonBmInfo
*
bmInfo
)
{
}
void
bmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonBmInfo
*
bmInfo
)
{}
int32_t
bmProcessGetMonBmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonBmInfo
bmInfo
=
{
0
};
...
...
@@ -49,13 +48,13 @@ int32_t bmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create bnode since %s, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
pDnode
->
dnodeId
);
return
-
1
;
}
else
{
...
...
@@ -68,13 +67,13 @@ int32_t bmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop bnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
source/dnode/mgmt/bm/bmWorker.c
浏览文件 @
d758a102
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "bmInt.h"
static
void
bmSendErrorRsp
(
S
MgmtWrapper
*
pWrapper
,
S
NodeMsg
*
pMsg
,
int32_t
code
)
{
static
void
bmSendErrorRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
};
tmsgSendRsp
(
&
rpcRsp
);
...
...
@@ -25,15 +25,17 @@ static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code)
taosFreeQitem
(
pMsg
);
}
static
void
bmSendErrorRsps
(
S
MgmtWrapper
*
pWrapper
,
S
TaosQall
*
qall
,
int32_t
numOfMsgs
,
int32_t
code
)
{
static
void
bmSendErrorRsps
(
STaosQall
*
qall
,
int32_t
numOfMsgs
,
int32_t
code
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SNodeMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
bmSendErrorRsp
(
pWrapper
,
pMsg
,
code
);
if
(
pMsg
!=
NULL
)
{
bmSendErrorRsp
(
pMsg
,
code
);
}
}
}
static
inline
void
bmSendRsp
(
S
MgmtWrapper
*
pWrapper
,
S
NodeMsg
*
pMsg
,
int32_t
code
)
{
static
inline
void
bmSendRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
...
...
@@ -42,20 +44,22 @@ static inline void bmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
tmsgSendRsp
(
&
rsp
);
}
static
void
bmProcessMonQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
static
void
bmProcessMon
itor
Queue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, get from bnode
monitor queue"
,
pMsg
);
dTrace
(
"msg:%p, get from bnode
-
monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_BM_INFO
)
{
code
=
bmProcessGetMonBmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
bmSendRsp
(
pM
gmt
->
pWrapper
,
pM
sg
,
code
);
bmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
...
...
@@ -64,21 +68,22 @@ static void bmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
}
static
void
bmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
SMgmtWrapper
*
pWrapper
=
pMgmt
->
pWrapper
;
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SNodeMsg
*
));
if
(
pArray
==
NULL
)
{
bmSendErrorRsps
(
pWrapper
,
qall
,
numOfMsgs
,
TSDB_CODE_OUT_OF_MEMORY
);
bmSendErrorRsps
(
qall
,
numOfMsgs
,
TSDB_CODE_OUT_OF_MEMORY
);
return
;
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SNodeMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"msg:%p, will be processed in bnode queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
bmSendErrorRsp
(
pWrapper
,
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
if
(
pMsg
!=
NULL
)
{
dTrace
(
"msg:%p, get from bnode-write queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
bmSendErrorRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
}
}
}
...
...
@@ -86,9 +91,11 @@ static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
for
(
size_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SNodeMsg
*
pMsg
=
*
(
SNodeMsg
**
)
taosArrayGet
(
pArray
,
i
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
taosFreeQitem
(
pMsg
);
if
(
pMsg
!=
NULL
)
{
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
taosFreeQitem
(
pMsg
);
}
}
taosArrayDestroy
(
pArray
);
}
...
...
@@ -120,12 +127,12 @@ int32_t bmStartWorker(SBnodeMgmt *pMgmt) {
if
(
tsMultiProcess
)
{
SSingleWorkerCfg
mCfg
=
{
.
min
=
1
,
.
max
=
1
,
.
name
=
"bnode-monitor"
,
.
fp
=
(
FItem
)
bmProcessMonQueue
,
.
param
=
pMgmt
};
.
min
=
1
,
.
max
=
1
,
.
name
=
"bnode-monitor"
,
.
fp
=
(
FItem
)
bmProcessMon
itor
Queue
,
.
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
;
...
...
source/dnode/mgmt/dm/dmFile.c
浏览文件 @
d758a102
...
...
@@ -21,7 +21,7 @@ static bool dmIsEpChanged(SDnodeMgmt *pMgmt, int32_t dnodeId, const char *ep);
static
void
dmResetDnodes
(
SDnodeMgmt
*
pMgmt
,
SArray
*
dnodeEps
);
int32_t
dmReadFile
(
SDnodeMgmt
*
pMgmt
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int32_t
len
=
0
;
int32_t
maxLen
=
256
*
1024
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
...
...
source/dnode/mgmt/main/dndExec.c
浏览文件 @
d758a102
...
...
@@ -90,7 +90,7 @@ static int32_t dndNewProc(SMgmtWrapper *pWrapper, EDndType n) {
static
void
dndProcessProcHandle
(
void
*
handle
)
{
dWarn
(
"handle:%p, the child process dies and send an offline rsp"
,
handle
);
SRpcMsg
rpcMsg
=
{.
handle
=
handle
,
.
code
=
TSDB_CODE_
DND
_OFFLINE
};
SRpcMsg
rpcMsg
=
{.
handle
=
handle
,
.
code
=
TSDB_CODE_
NODE
_OFFLINE
};
rpcSendResponse
(
&
rpcMsg
);
}
...
...
source/dnode/mgmt/main/dndFile.c
浏览文件 @
d758a102
...
...
@@ -19,7 +19,7 @@
#define MAXLEN 1024
int32_t
dndReadFile
(
SMgmtWrapper
*
pWrapper
,
bool
*
pDeployed
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int64_t
len
=
0
;
char
content
[
MAXLEN
+
1
]
=
{
0
};
cJSON
*
root
=
NULL
;
...
...
@@ -159,7 +159,7 @@ int32_t dndReadShmFile(SDnode *pDnode) {
if
(
taosReadFile
(
pFile
,
content
,
MAXLEN
)
>
0
)
{
root
=
cJSON_Parse
(
content
);
if
(
root
==
NULL
)
{
terrno
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
terrno
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
dError
(
"failed to read %s since invalid json format"
,
file
);
goto
_OVER
;
}
...
...
source/dnode/mgmt/main/dndTransport.c
浏览文件 @
d758a102
...
...
@@ -121,7 +121,7 @@ static void dndProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
if
(
isReq
&&
pMsg
->
pCont
==
NULL
)
{
dError
(
"req:%s not processed since its empty, handle:%p app:%p"
,
TMSG_INFO
(
msgType
),
pMsg
->
handle
,
pMsg
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_
DND_
INVALID_MSG_LEN
,
.
ahandle
=
pMsg
->
ahandle
};
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_INVALID_MSG_LEN
,
.
ahandle
=
pMsg
->
ahandle
};
rpcSendResponse
(
&
rspMsg
);
return
;
}
...
...
@@ -338,7 +338,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
static
int32_t
dndSendRpcReq
(
STransMgmt
*
pMgmt
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
if
(
pMgmt
->
clientRpc
==
NULL
)
{
terrno
=
TSDB_CODE_
DND
_OFFLINE
;
terrno
=
TSDB_CODE_
NODE
_OFFLINE
;
return
-
1
;
}
...
...
@@ -359,7 +359,7 @@ static void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
static
int32_t
dndSendReq
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
if
(
dndGetStatus
(
pWrapper
->
pDnode
)
!=
DND_STAT_RUNNING
)
{
terrno
=
TSDB_CODE_
DND
_OFFLINE
;
terrno
=
TSDB_CODE_
NODE
_OFFLINE
;
dError
(
"failed to send rpc msg since %s, handle:%p"
,
terrstr
(),
pReq
->
handle
);
return
-
1
;
}
...
...
source/dnode/mgmt/mm/mmFile.c
浏览文件 @
d758a102
...
...
@@ -17,7 +17,7 @@
#include "mmInt.h"
int32_t
mmReadFile
(
SMnodeMgmt
*
pMgmt
,
bool
*
pDeployed
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
...
...
source/dnode/mgmt/mm/mmHandle.c
浏览文件 @
d758a102
...
...
@@ -57,7 +57,7 @@ int32_t mmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
if
(
createReq
.
replica
<=
1
||
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -70,13 +70,13 @@ int32_t mmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDropMn
odeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropMQSBN
odeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop mnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -95,7 +95,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
}
if
(
alterReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to alter mnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
source/dnode/mgmt/qm/qmHandle.c
浏览文件 @
d758a102
...
...
@@ -16,8 +16,7 @@
#define _DEFAULT_SOURCE
#include "qmInt.h"
void
qmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonQmInfo
*
qmInfo
)
{
}
void
qmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonQmInfo
*
qmInfo
)
{}
int32_t
qmProcessGetMonQmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonQmInfo
qmInfo
=
{
0
};
...
...
@@ -49,14 +48,14 @@ int32_t qmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
dError
(
"failed to create qnode since %s
, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
pDnode
->
dnodeId
);
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create qnode since %s
"
,
terrstr
()
);
return
-
1
;
}
else
{
return
qmOpen
(
pWrapper
);
...
...
@@ -68,13 +67,13 @@ int32_t qmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropQnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop qnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
source/dnode/mgmt/qm/qmWorker.c
浏览文件 @
d758a102
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "qmInt.h"
static
inline
void
qmSendRsp
(
S
MgmtWrapper
*
pWrapper
,
S
NodeMsg
*
pMsg
,
int32_t
code
)
{
static
inline
void
qmSendRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
...
...
@@ -25,20 +25,22 @@ static inline void qmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
tmsgSendRsp
(
&
rsp
);
}
static
void
qmProcessMonQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
static
void
qmProcessMon
itor
Queue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, get from qnode
monitor queue"
,
pMsg
);
dTrace
(
"msg:%p, get from qnode
-
monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_SM_INFO
)
{
code
=
qmProcessGetMonQmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
qmSendRsp
(
pM
gmt
->
pWrapper
,
pM
sg
,
code
);
qmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
...
...
@@ -49,10 +51,12 @@ static void qmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
static
void
qmProcessQueryQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, will be processed in qnode-query queue"
,
pMsg
);
int32_t
code
=
qndProcessQueryMsg
(
pMgmt
->
pQnode
,
&
pMsg
->
rpcMsg
);
if
(
code
!=
0
)
{
qmSendRsp
(
pMgmt
->
pWrapper
,
pMsg
,
code
);
dTrace
(
"msg:%p, get from qnode-query queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
qndProcessQueryMsg
(
pMgmt
->
pQnode
,
pRpc
);
if
(
pRpc
->
msgType
&
1U
&&
code
!=
0
)
{
qmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
...
...
@@ -63,10 +67,12 @@ static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
static
void
qmProcessFetchQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, will be processed in qnode-fetch queue"
,
pMsg
);
int32_t
code
=
qndProcessFetchMsg
(
pMgmt
->
pQnode
,
&
pMsg
->
rpcMsg
);
if
(
code
!=
0
)
{
qmSendRsp
(
pMgmt
->
pWrapper
,
pMsg
,
code
);
dTrace
(
"msg:%p, get from qnode-fetch queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
qndProcessFetchMsg
(
pMgmt
->
pQnode
,
pRpc
);
if
(
pRpc
->
msgType
&
1U
&&
code
!=
0
)
{
qmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
...
...
@@ -92,11 +98,8 @@ int32_t qmProcessFetchMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t
qmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
SQnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
qmPutMsgToWorker
(
&
pMgmt
->
monitorWorker
,
pMsg
);
return
0
;
}
...
...
@@ -125,6 +128,7 @@ int32_t qmPutMsgToFetchQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc) {
int32_t
qmGetQueueSize
(
SMgmtWrapper
*
pWrapper
,
int32_t
vgId
,
EQueueType
qtype
)
{
int32_t
size
=
-
1
;
SQnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
switch
(
qtype
)
{
case
QUERY_QUEUE
:
size
=
taosQueueSize
(
pMgmt
->
queryWorker
.
queue
);
...
...
@@ -164,7 +168,7 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
if
(
tsMultiProcess
)
{
SSingleWorkerCfg
mCfg
=
{
.
min
=
1
,
.
max
=
1
,
.
name
=
"qnode-monitor"
,
.
fp
=
(
FItem
)
qmProcessMonQueue
,
.
param
=
pMgmt
};
.
min
=
1
,
.
max
=
1
,
.
name
=
"qnode-monitor"
,
.
fp
=
(
FItem
)
qmProcessMon
itor
Queue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start qnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/sm/smHandle.c
浏览文件 @
d758a102
...
...
@@ -48,14 +48,14 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
dError
(
"failed to create snode since %s
, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
pDnode
->
dnodeId
);
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create snode since %s
"
,
terrstr
()
);
return
-
1
;
}
else
{
return
smOpen
(
pWrapper
);
...
...
@@ -67,13 +67,13 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropSnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop snode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
source/dnode/mgmt/sm/smWorker.c
浏览文件 @
d758a102
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "smInt.h"
static
inline
void
smSendRsp
(
S
MgmtWrapper
*
pWrapper
,
S
NodeMsg
*
pMsg
,
int32_t
code
)
{
static
inline
void
smSendRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
...
...
@@ -28,17 +28,19 @@ static inline void smSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
static
void
smProcessMonitorQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, get from snode
monitor queue"
,
pMsg
);
dTrace
(
"msg:%p, get from snode
-
monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_SM_INFO
)
{
code
=
smProcessGetMonSmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
smSendRsp
(
pM
gmt
->
pWrapper
,
pM
sg
,
code
);
smSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
...
...
@@ -53,7 +55,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
SNodeMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"msg:%p,
will be processed in snode
unique queue"
,
pMsg
);
dTrace
(
"msg:%p,
get from snode-
unique queue"
,
pMsg
);
sndProcessUMsg
(
pMgmt
->
pSnode
,
&
pMsg
->
rpcMsg
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
...
...
@@ -65,7 +67,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
static
void
smProcessSharedQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p,
will be processed in snode
shared queue"
,
pMsg
);
dTrace
(
"msg:%p,
get from snode-
shared queue"
,
pMsg
);
sndProcessSMsg
(
pMgmt
->
pSnode
,
&
pMsg
->
rpcMsg
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
...
...
@@ -88,7 +90,6 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
}
SMultiWorkerCfg
cfg
=
{.
max
=
1
,
.
name
=
"snode-unique"
,
.
fp
=
smProcessUniqueQueue
,
.
param
=
pMgmt
};
if
(
tMultiWorkerInit
(
pUniqueWorker
,
&
cfg
)
!=
0
)
{
dError
(
"failed to start snode-unique worker since %s"
,
terrstr
());
return
-
1
;
...
...
@@ -193,7 +194,7 @@ int32_t smProcessSharedMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t
smProcessExecMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
workerType
=
smGetSWTypeFromMsg
(
&
pMsg
->
rpcMsg
);
int32_t
workerType
=
smGetSWTypeFromMsg
(
&
pMsg
->
rpcMsg
);
if
(
workerType
==
SND_WORKER_TYPE__SHARED
)
{
return
smProcessSharedMsg
(
pWrapper
,
pMsg
);
}
else
{
...
...
source/dnode/mgmt/test/bnode/dbnode.cpp
浏览文件 @
d758a102
...
...
@@ -33,22 +33,22 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -59,9 +59,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -74,9 +74,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
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
);
...
...
@@ -88,22 +88,22 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -114,9 +114,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -129,9 +129,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -142,9 +142,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/mnode/dmnode.cpp
浏览文件 @
d758a102
...
...
@@ -96,7 +96,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
...
...
@@ -113,7 +113,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
...
...
@@ -139,22 +139,22 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
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
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/qnode/dqnode.cpp
浏览文件 @
d758a102
...
...
@@ -30,22 +30,22 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
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
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
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
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -86,22 +86,22 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -112,9 +112,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -127,9 +127,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -140,9 +140,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/snode/dsnode.cpp
浏览文件 @
d758a102
...
...
@@ -30,22 +30,22 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
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
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
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
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -86,22 +86,22 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -112,9 +112,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -127,9 +127,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -140,9 +140,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/vnode/vnode.cpp
浏览文件 @
d758a102
...
...
@@ -67,7 +67,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
DND_V
NODE_ALREADY_DEPLOYED
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_ALREADY_DEPLOYED
);
}
}
}
...
...
@@ -301,7 +301,7 @@ TEST_F(DndTestVnode, 06_Drop_Vnode) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
DND_V
NODE_NOT_DEPLOYED
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_NOT_DEPLOYED
);
}
}
}
\ No newline at end of file
source/dnode/mgmt/vm/vmFile.c
浏览文件 @
d758a102
...
...
@@ -45,7 +45,7 @@ SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes) {
}
int32_t
vmGetVnodesFromFile
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int32_t
len
=
0
;
int32_t
maxLen
=
30000
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
...
...
source/dnode/mgmt/vm/vmHandle.c
浏览文件 @
d758a102
...
...
@@ -139,7 +139,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
tFreeSCreateVnodeReq
(
&
createReq
);
dDebug
(
"vgId:%d, already exist"
,
createReq
.
vgId
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
terrno
=
TSDB_CODE_
DND_V
NODE_ALREADY_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
return
-
1
;
}
...
...
@@ -238,7 +238,7 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to drop since %s"
,
vgId
,
terrstr
());
terrno
=
TSDB_CODE_
DND_V
NODE_NOT_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
d758a102
...
...
@@ -21,17 +21,17 @@
#include "mndTrans.h"
#include "mndUser.h"
#define
TSDB_
BNODE_VER_NUMBER 1
#define
TSDB_
BNODE_RESERVE_SIZE 64
#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
mndBnodeActionDelete
(
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
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropBnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessCreateBnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessDropBnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropBnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndGetBnodeMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveBnodes
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
...
...
@@ -76,18 +76,18 @@ static void mndReleaseBnode(SMnode *pMnode, SBnodeObj *pObj) {
static
SSdbRaw
*
mndBnodeActionEncode
(
SBnodeObj
*
pObj
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_BNODE
,
TSDB_BNODE_VER_NUMBER
,
sizeof
(
SBnodeObj
)
+
TSDB_
BNODE_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
goto
BNODE_ENCODE
_OVER
;
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
,
BNODE_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
createdTime
,
BNODE_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
updateTime
,
BNODE_ENCODE
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_BNODE_RESERVE_SIZE
,
BNODE_ENCODE
_OVER
)
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
;
BNODE_ENCODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"bnode:%d, failed to encode to raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -102,28 +102,28 @@ static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
BNODE_DECODE
_OVER
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
TSDB_
BNODE_VER_NUMBER
)
{
if
(
sver
!=
BNODE_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
BNODE_DECODE
_OVER
;
goto
_OVER
;
}
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
SBnodeObj
));
if
(
pRow
==
NULL
)
goto
BNODE_DECODE
_OVER
;
if
(
pRow
==
NULL
)
goto
_OVER
;
SBnodeObj
*
pObj
=
sdbGetRowObj
(
pRow
);
if
(
pObj
==
NULL
)
goto
BNODE_DECODE
_OVER
;
if
(
pObj
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pObj
->
id
,
BNODE_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
createdTime
,
BNODE_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
updateTime
,
BNODE_DECODE
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_BNODE_RESERVE_SIZE
,
BNODE_DECODE
_OVER
)
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
;
BNODE_DECODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"bnode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
taosMemoryFreeClear
(
pRow
);
...
...
@@ -190,13 +190,13 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -217,13 +217,13 @@ static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -249,19 +249,19 @@ static int32_t mndCreateBnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
bnodeObj
.
updateTime
=
bnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_BNODE
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
CREATE_BNODE
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create bnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
if
(
mndSetCreateBnodeRedoLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
CREATE_BNODE
_OVER
;
if
(
mndSetCreateBnodeUndoLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
CREATE_BNODE
_OVER
;
if
(
mndSetCreateBnodeCommitLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
CREATE_BNODE
_OVER
;
if
(
mndSetCreateBnodeRedoActions
(
pTrans
,
pDnode
,
&
bnodeObj
)
!=
0
)
goto
CREATE_BNODE
_OVER
;
if
(
mndSetCreateBnodeUndoActions
(
pTrans
,
pDnode
,
&
bnodeObj
)
!=
0
)
goto
CREATE_BNODE
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
CREATE_BNODE
_OVER
;
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
;
CREATE_BNODE
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -274,9 +274,9 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
SUserObj
*
pUser
=
NULL
;
SMCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_BNODE
_OVER
;
goto
_OVER
;
}
mDebug
(
"bnode:%d, start to create"
,
createReq
.
dnodeId
);
...
...
@@ -284,31 +284,31 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
pObj
=
mndAcquireBnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pObj
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_BNODE_ALREADY_EXIST
;
goto
CREATE_BNODE
_OVER
;
goto
_OVER
;
}
else
if
(
terrno
!=
TSDB_CODE_MND_BNODE_NOT_EXIST
)
{
goto
CREATE_BNODE
_OVER
;
goto
_OVER
;
}
pDnode
=
mndAcquireDnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
goto
CREATE_BNODE
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_BNODE
_OVER
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
CREATE_BNODE
_OVER
;
goto
_OVER
;
}
code
=
mndCreateBnode
(
pMnode
,
pReq
,
pDnode
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_BNODE
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"bnode:%d, failed to create since %s"
,
createReq
.
dnodeId
,
terrstr
());
}
...
...
@@ -316,7 +316,6 @@ CREATE_BNODE_OVER:
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
...
...
@@ -340,13 +339,13 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -367,17 +366,17 @@ static int32_t mndDropBnode(SMnode *pMnode, SNodeMsg *pReq, SBnodeObj *pObj) {
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_BNODE
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
DROP_BNODE
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop bnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSetDropBnodeRedoLogs
(
pTrans
,
pObj
)
!=
0
)
goto
DROP_BNODE
_OVER
;
if
(
mndSetDropBnodeCommitLogs
(
pTrans
,
pObj
)
!=
0
)
goto
DROP_BNODE
_OVER
;
if
(
mndSetDropBnodeRedoActions
(
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
DROP_BNODE
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
DROP_BNODE
_OVER
;
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
;
DROP_BNODE
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -389,37 +388,37 @@ static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq) {
SBnodeObj
*
pObj
=
NULL
;
SMDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_BNODE
_OVER
;
goto
_OVER
;
}
mDebug
(
"bnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_SDB_APP_ERROR
;
goto
DROP_BNODE
_OVER
;
goto
_OVER
;
}
pObj
=
mndAcquireBnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pObj
==
NULL
)
{
goto
DROP_BNODE
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_BNODE
_OVER
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
DROP_BNODE
_OVER
;
goto
_OVER
;
}
code
=
mndDropBnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_BNODE
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"bnode:%d, failed to drop since %s"
,
dropReq
.
dnodeId
,
terrstr
());
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
d758a102
...
...
@@ -381,7 +381,7 @@ static int32_t mndSetCreateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_CREATE_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_
DND_V
NODE_ALREADY_DEPLOYED
;
action
.
acceptableCode
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
return
-
1
;
...
...
@@ -412,7 +412,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_
DND_V
NODE_NOT_DEPLOYED
;
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
return
-
1
;
...
...
@@ -880,7 +880,7 @@ static int32_t mndBuildDropVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_DND_DROP_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_
DND_V
NODE_NOT_DEPLOYED
;
action
.
acceptableCode
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
d758a102
...
...
@@ -554,7 +554,7 @@ static int32_t mndProcessDropDnodeReq(SNodeMsg *pReq) {
SDnodeObj
*
pDnode
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDropMn
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropMQSBN
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_DNODE_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
d758a102
...
...
@@ -44,7 +44,17 @@ static const SInfosTableSchema modulesSchema[] = {
};
static
const
SInfosTableSchema
qnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
134
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
snodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
bnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
userDBSchema
[]
=
{
...
...
@@ -184,6 +194,8 @@ static const SInfosTableMeta infosMeta[] = {
{
TSDB_INS_TABLE_MNODES
,
mnodesSchema
,
tListLen
(
mnodesSchema
)},
{
TSDB_INS_TABLE_MODULES
,
modulesSchema
,
tListLen
(
modulesSchema
)},
{
TSDB_INS_TABLE_QNODES
,
qnodesSchema
,
tListLen
(
qnodesSchema
)},
{
TSDB_INS_TABLE_SNODES
,
snodesSchema
,
tListLen
(
snodesSchema
)},
{
TSDB_INS_TABLE_BNODES
,
bnodesSchema
,
tListLen
(
snodesSchema
)},
{
TSDB_INS_TABLE_USER_DATABASES
,
userDBSchema
,
tListLen
(
userDBSchema
)},
{
TSDB_INS_TABLE_USER_FUNCTIONS
,
userFuncSchema
,
tListLen
(
userFuncSchema
)},
{
TSDB_INS_TABLE_USER_INDEXES
,
userIdxSchema
,
tListLen
(
userIdxSchema
)},
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
d758a102
...
...
@@ -388,7 +388,7 @@ static int32_t mndProcessCreateMnodeReq(SNodeMsg *pReq) {
SUserObj
*
pUser
=
NULL
;
SMCreateMnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDropMn
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropMQSBN
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_MNODE_OVER
;
}
...
...
@@ -509,9 +509,9 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pObj
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
action
.
pCont
=
pReq
;
...
...
@@ -554,7 +554,7 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq) {
SMnodeObj
*
pObj
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDropMn
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropMQSBN
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_MNODE_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
d758a102
...
...
@@ -21,22 +21,22 @@
#include "mndTrans.h"
#include "mndUser.h"
#define
TSDB_QNODE_VER_NUMBER
1
#define
TSDB_
QNODE_RESERVE_SIZE 64
#define
QNODE_VER_NUMBER
1
#define QNODE_RESERVE_SIZE 64
static
SSdbRaw
*
mndQnodeActionEncode
(
SQnodeObj
*
pObj
);
static
SSdbRow
*
mndQnodeActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndQnodeActionInsert
(
SSdb
*
pSdb
,
SQnodeObj
*
pObj
);
static
int32_t
mndQnodeActionDelete
(
SSdb
*
pSdb
,
SQnodeObj
*
pObj
);
static
int32_t
mndQnodeActionUpdate
(
SSdb
*
pSdb
,
SQnodeObj
*
pOld
,
SQnodeObj
*
pNew
);
static
int32_t
mndQnodeActionDelete
(
SSdb
*
pSdb
,
SQnodeObj
*
pObj
);
static
int32_t
mndProcessCreateQnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropQnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessCreateQnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessDropQnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropQnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessQnodeListReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndGetQnodeMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveQnodes
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextQnode
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessQnodeListReq
(
SNodeMsg
*
pReq
);
int32_t
mndInitQnode
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_QNODE
,
...
...
@@ -49,9 +49,9 @@ int32_t mndInitQnode(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_QNODE
,
mndProcessCreateQnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_QNODE
,
mndProcessDropQnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_QNODE_LIST
,
mndProcessQnodeListReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_QNODE_RSP
,
mndProcessCreateQnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_DROP_QNODE_RSP
,
mndProcessDropQnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_QNODE_LIST
,
mndProcessQnodeListReq
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_QNODE
,
mndGetQnodeMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_QNODE
,
mndRetrieveQnodes
);
...
...
@@ -78,18 +78,18 @@ static void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj) {
static
SSdbRaw
*
mndQnodeActionEncode
(
SQnodeObj
*
pObj
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_QNODE
,
TSDB_QNODE_VER_NUMBER
,
sizeof
(
SQnodeObj
)
+
TSDB_
QNODE_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
goto
QNODE_ENCODE
_OVER
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_QNODE
,
QNODE_VER_NUMBER
,
sizeof
(
SQnodeObj
)
+
QNODE_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_SET_INT32
(
pRaw
,
dataPos
,
pObj
->
id
,
QNODE_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
createdTime
,
QNODE_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
updateTime
,
QNODE_ENCODE
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_QNODE_RESERVE_SIZE
,
QNODE_ENCODE
_OVER
)
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
,
QNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
QNODE_ENCODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"qnode:%d, failed to encode to raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -104,28 +104,28 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
QNODE_DECODE
_OVER
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
TSDB_
QNODE_VER_NUMBER
)
{
if
(
sver
!=
QNODE_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
QNODE_DECODE
_OVER
;
goto
_OVER
;
}
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
SQnodeObj
));
if
(
pRow
==
NULL
)
goto
QNODE_DECODE
_OVER
;
if
(
pRow
==
NULL
)
goto
_OVER
;
SQnodeObj
*
pObj
=
sdbGetRowObj
(
pRow
);
if
(
pObj
==
NULL
)
goto
QNODE_DECODE
_OVER
;
if
(
pObj
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pObj
->
id
,
QNODE_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
createdTime
,
QNODE_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
updateTime
,
QNODE_DECODE
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_QNODE_RESERVE_SIZE
,
QNODE_DECODE
_OVER
)
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
,
QNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
QNODE_DECODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"qnode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
taosMemoryFreeClear
(
pRow
);
...
...
@@ -192,13 +192,13 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -219,13 +219,13 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -251,19 +251,19 @@ static int32_t mndCreateQnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
qnodeObj
.
updateTime
=
qnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_QNODE
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
CREATE_QNODE
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create qnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
if
(
mndSetCreateQnodeRedoLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
CREATE_QNODE
_OVER
;
if
(
mndSetCreateQnodeUndoLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
CREATE_QNODE
_OVER
;
if
(
mndSetCreateQnodeCommitLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
CREATE_QNODE
_OVER
;
if
(
mndSetCreateQnodeRedoActions
(
pTrans
,
pDnode
,
&
qnodeObj
)
!=
0
)
goto
CREATE_QNODE
_OVER
;
if
(
mndSetCreateQnodeUndoActions
(
pTrans
,
pDnode
,
&
qnodeObj
)
!=
0
)
goto
CREATE_QNODE
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
CREATE_QNODE
_OVER
;
if
(
mndSetCreateQnodeRedoLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateQnodeUndoLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateQnodeCommitLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateQnodeRedoActions
(
pTrans
,
pDnode
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateQnodeUndoActions
(
pTrans
,
pDnode
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
CREATE_QNODE
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -276,9 +276,9 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
SUserObj
*
pUser
=
NULL
;
SMCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_QNODE
_OVER
;
goto
_OVER
;
}
mDebug
(
"qnode:%d, start to create"
,
createReq
.
dnodeId
);
...
...
@@ -286,31 +286,31 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
pObj
=
mndAcquireQnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pObj
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_QNODE_ALREADY_EXIST
;
goto
CREATE_QNODE
_OVER
;
goto
_OVER
;
}
else
if
(
terrno
!=
TSDB_CODE_MND_QNODE_NOT_EXIST
)
{
goto
CREATE_QNODE
_OVER
;
goto
_OVER
;
}
pDnode
=
mndAcquireDnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
goto
CREATE_QNODE
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_QNODE
_OVER
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
CREATE_QNODE
_OVER
;
goto
_OVER
;
}
code
=
mndCreateQnode
(
pMnode
,
pReq
,
pDnode
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_QNODE
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"qnode:%d, failed to create since %s"
,
createReq
.
dnodeId
,
terrstr
());
}
...
...
@@ -318,7 +318,6 @@ CREATE_QNODE_OVER:
mndReleaseQnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
...
...
@@ -342,13 +341,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -369,17 +368,17 @@ static int32_t mndDropQnode(SMnode *pMnode, SNodeMsg *pReq, SQnodeObj *pObj) {
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_QNODE
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
DROP_QNODE
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop qnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSetDropQnodeRedoLogs
(
pTrans
,
pObj
)
!=
0
)
goto
DROP_QNODE
_OVER
;
if
(
mndSetDropQnodeCommitLogs
(
pTrans
,
pObj
)
!=
0
)
goto
DROP_QNODE
_OVER
;
if
(
mndSetDropQnodeRedoActions
(
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
DROP_QNODE
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
DROP_QNODE
_OVER
;
if
(
mndSetDropQnodeRedoLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropQnodeCommitLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropQnodeRedoActions
(
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
DROP_QNODE
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -391,37 +390,37 @@ static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq) {
SQnodeObj
*
pObj
=
NULL
;
SMDropQnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_QNODE
_OVER
;
goto
_OVER
;
}
mDebug
(
"qnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_SDB_APP_ERROR
;
goto
DROP_QNODE
_OVER
;
goto
_OVER
;
}
pObj
=
mndAcquireQnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pObj
==
NULL
)
{
goto
DROP_QNODE
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_QNODE
_OVER
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
DROP_QNODE
_OVER
;
goto
_OVER
;
}
code
=
mndDropQnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_QNODE
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"qnode:%d, failed to drop since %s"
,
dropReq
.
dnodeId
,
terrstr
());
}
...
...
@@ -433,37 +432,36 @@ DROP_QNODE_OVER:
}
static
int32_t
mndProcessQnodeListReq
(
SNodeMsg
*
pReq
)
{
int32_t
code
=
-
1
;
SQnodeListReq
qlistReq
=
{
0
}
;
int32_t
numOfRows
=
0
;
S
Mnode
*
pMnode
=
pReq
->
pNode
;
S
Sdb
*
pSdb
=
pMnode
->
pSdb
;
SQnode
Obj
*
pObj
=
NULL
;
int32_t
code
=
-
1
;
int32_t
numOfRows
=
0
;
SMnode
*
pMnode
=
pReq
->
pNode
;
S
Sdb
*
pSdb
=
pMnode
->
pSdb
;
S
QnodeObj
*
pObj
=
NULL
;
SQnode
ListReq
qlistReq
=
{
0
}
;
SQnodeListRsp
qlistRsp
=
{
0
};
if
(
tDeserializeSQnodeListReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
qlistReq
)
!=
0
)
{
mError
(
"
invalid qnode list msg
"
);
mError
(
"
failed to parse qnode list req
"
);
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
QNODE_LIST
_OVER
;
goto
_OVER
;
}
qlistRsp
.
epSetList
=
taosArrayInit
(
5
,
sizeof
(
SEpSet
));
if
(
NULL
==
qlistRsp
.
epSetList
)
{
mError
(
"
taosArrayInit epSet failed
"
);
mError
(
"
failed to alloc epSet while process qnode list req
"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
QNODE_LIST
_OVER
;
goto
_OVER
;
}
while
(
true
)
{
void
*
pIter
=
sdbFetch
(
pSdb
,
SDB_QNODE
,
NULL
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SEpSet
epSet
=
{
0
};
strcpy
(
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
);
SEpSet
epSet
=
{
.
numOfEps
=
1
};
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
pObj
->
pDnode
->
port
;
epSet
.
numOfEps
=
1
;
taosArrayPush
(
qlistRsp
.
epSetList
,
&
epSet
);
(
void
)
taosArrayPush
(
qlistRsp
.
epSetList
,
&
epSet
);
numOfRows
++
;
sdbRelease
(
pSdb
,
pObj
);
...
...
@@ -477,19 +475,17 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
void
*
pRsp
=
taosMemoryMalloc
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
QNODE_LIST
_OVER
;
goto
_OVER
;
}
tSerializeSQnodeListRsp
(
pRsp
,
rspLen
,
&
qlistRsp
);
pReq
->
rspLen
=
rspLen
;
pReq
->
pRsp
=
pRsp
;
code
=
0
;
QNODE_LIST_OVER:
_OVER:
tFreeSQnodeListRsp
(
&
qlistRsp
);
return
code
;
}
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
d758a102
...
...
@@ -21,17 +21,17 @@
#include "mndTrans.h"
#include "mndUser.h"
#define
TSDB_
SNODE_VER_NUMBER 1
#define
TSDB_
SNODE_RESERVE_SIZE 64
#define SNODE_VER_NUMBER 1
#define SNODE_RESERVE_SIZE 64
static
SSdbRaw
*
mndSnodeActionEncode
(
SSnodeObj
*
pObj
);
static
SSdbRow
*
mndSnodeActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndSnodeActionInsert
(
SSdb
*
pSdb
,
SSnodeObj
*
pObj
);
static
int32_t
mndSnodeActionDelete
(
SSdb
*
pSdb
,
SSnodeObj
*
pObj
);
static
int32_t
mndSnodeActionUpdate
(
SSdb
*
pSdb
,
SSnodeObj
*
pOld
,
SSnodeObj
*
pNew
);
static
int32_t
mndSnodeActionDelete
(
SSdb
*
pSdb
,
SSnodeObj
*
pObj
);
static
int32_t
mndProcessCreateSnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropSnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessCreateSnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessDropSnodeReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessDropSnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndGetSnodeMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveSnodes
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
...
...
@@ -61,11 +61,9 @@ int32_t mndInitSnode(SMnode *pMnode) {
void
mndCleanupSnode
(
SMnode
*
pMnode
)
{}
SEpSet
mndAcquireEpFromSnode
(
SMnode
*
pMnode
,
const
SSnodeObj
*
pSnode
)
{
SEpSet
epSet
;
memcpy
(
epSet
.
eps
->
fqdn
,
pSnode
->
pDnode
->
fqdn
,
128
);
epSet
.
eps
->
port
=
pSnode
->
pDnode
->
port
;
epSet
.
numOfEps
=
1
;
epSet
.
inUse
=
0
;
SEpSet
epSet
=
{.
numOfEps
=
1
,
.
inUse
=
0
};
memcpy
(
epSet
.
eps
[
0
].
fqdn
,
pSnode
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
pSnode
->
pDnode
->
port
;
return
epSet
;
}
...
...
@@ -85,18 +83,18 @@ static void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj) {
static
SSdbRaw
*
mndSnodeActionEncode
(
SSnodeObj
*
pObj
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_SNODE
,
TSDB_SNODE_VER_NUMBER
,
sizeof
(
SSnodeObj
)
+
TSDB_
SNODE_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
goto
SNODE_ENCODE
_OVER
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_SNODE
,
SNODE_VER_NUMBER
,
sizeof
(
SSnodeObj
)
+
SNODE_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_SET_INT32
(
pRaw
,
dataPos
,
pObj
->
id
,
SNODE_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
createdTime
,
SNODE_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pObj
->
updateTime
,
SNODE_ENCODE
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_SNODE_RESERVE_SIZE
,
SNODE_ENCODE
_OVER
)
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
,
SNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
SNODE_ENCODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"snode:%d, failed to encode to raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -111,28 +109,28 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
SNODE_DECODE
_OVER
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
TSDB_
SNODE_VER_NUMBER
)
{
if
(
sver
!=
SNODE_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
SNODE_DECODE
_OVER
;
goto
_OVER
;
}
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
SSnodeObj
));
if
(
pRow
==
NULL
)
goto
SNODE_DECODE
_OVER
;
if
(
pRow
==
NULL
)
goto
_OVER
;
SSnodeObj
*
pObj
=
sdbGetRowObj
(
pRow
);
if
(
pObj
==
NULL
)
goto
SNODE_DECODE
_OVER
;
if
(
pObj
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pObj
->
id
,
SNODE_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
createdTime
,
SNODE_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pObj
->
updateTime
,
SNODE_DECODE
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_SNODE_RESERVE_SIZE
,
SNODE_DECODE
_OVER
)
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
,
SNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
SNODE_DECODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"snode:%d, failed to decode from raw:%p since %s"
,
pObj
->
id
,
pRaw
,
terrstr
());
taosMemoryFreeClear
(
pRow
);
...
...
@@ -199,13 +197,13 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -226,13 +224,13 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -258,20 +256,20 @@ static int32_t mndCreateSnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
snodeObj
.
updateTime
=
snodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_SNODE
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
CREATE_SNODE
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create snode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
if
(
mndSetCreateSnodeRedoLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
CREATE_SNODE
_OVER
;
if
(
mndSetCreateSnodeUndoLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
CREATE_SNODE
_OVER
;
if
(
mndSetCreateSnodeCommitLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
CREATE_SNODE
_OVER
;
if
(
mndSetCreateSnodeRedoActions
(
pTrans
,
pDnode
,
&
snodeObj
)
!=
0
)
goto
CREATE_SNODE
_OVER
;
if
(
mndSetCreateSnodeUndoActions
(
pTrans
,
pDnode
,
&
snodeObj
)
!=
0
)
goto
CREATE_SNODE
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
CREATE_SNODE
_OVER
;
if
(
mndSetCreateSnodeRedoLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSnodeUndoLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSnodeCommitLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSnodeRedoActions
(
pTrans
,
pDnode
,
&
snodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSnodeUndoActions
(
pTrans
,
pDnode
,
&
snodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
CREATE_SNODE
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -284,9 +282,9 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
SUserObj
*
pUser
=
NULL
;
SMCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_SNODE
_OVER
;
goto
_OVER
;
}
mDebug
(
"snode:%d, start to create"
,
createReq
.
dnodeId
);
...
...
@@ -294,31 +292,31 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
pObj
=
mndAcquireSnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pObj
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_SNODE_ALREADY_EXIST
;
goto
CREATE_SNODE
_OVER
;
goto
_OVER
;
}
else
if
(
terrno
!=
TSDB_CODE_MND_SNODE_NOT_EXIST
)
{
goto
CREATE_SNODE
_OVER
;
goto
_OVER
;
}
pDnode
=
mndAcquireDnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
goto
CREATE_SNODE
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_SNODE
_OVER
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
CREATE_SNODE
_OVER
;
goto
_OVER
;
}
code
=
mndCreateSnode
(
pMnode
,
pReq
,
pDnode
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_SNODE
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"snode:%d, failed to create since %s"
,
createReq
.
dnodeId
,
terrstr
());
return
-
1
;
...
...
@@ -327,7 +325,6 @@ CREATE_SNODE_OVER:
mndReleaseSnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
...
...
@@ -351,13 +348,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
pDnode
->
id
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetDnodeEpset
(
pDnode
);
...
...
@@ -378,18 +375,18 @@ static int32_t mndDropSnode(SMnode *pMnode, SNodeMsg *pReq, SSnodeObj *pObj) {
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_SNODE
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
DROP_SNODE
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop snode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSetDropSnodeRedoLogs
(
pTrans
,
pObj
)
!=
0
)
goto
DROP_SNODE
_OVER
;
if
(
mndSetDropSnodeCommitLogs
(
pTrans
,
pObj
)
!=
0
)
goto
DROP_SNODE
_OVER
;
if
(
mndSetDropSnodeRedoActions
(
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
DROP_SNODE
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
DROP_SNODE
_OVER
;
if
(
mndSetDropSnodeRedoLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSnodeCommitLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSnodeRedoActions
(
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
DROP_SNODE
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -401,37 +398,37 @@ static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq) {
SSnodeObj
*
pObj
=
NULL
;
SMDropSnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_SNODE
_OVER
;
goto
_OVER
;
}
mDebug
(
"snode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_SDB_APP_ERROR
;
goto
DROP_SNODE
_OVER
;
goto
_OVER
;
}
pObj
=
mndAcquireSnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pObj
==
NULL
)
{
goto
DROP_SNODE
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_SNODE
_OVER
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
DROP_SNODE
_OVER
;
goto
_OVER
;
}
code
=
mndDropSnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_SNODE
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"snode:%d, failed to drop since %s"
,
dropReq
.
dnodeId
,
terrstr
());
}
...
...
source/dnode/mnode/impl/test/bnode/bnode.cpp
浏览文件 @
d758a102
...
...
@@ -55,9 +55,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -68,9 +68,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -90,9 +90,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -124,9 +124,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -148,9 +148,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -169,9 +169,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -185,9 +185,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
...
...
@@ -200,9 +200,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -214,9 +214,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -235,9 +235,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -255,9 +255,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
...
...
@@ -270,9 +270,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -284,9 +284,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
SMDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -305,9 +305,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
SMCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/test/mnode/mnode.cpp
浏览文件 @
d758a102
...
...
@@ -63,9 +63,9 @@ TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -78,9 +78,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Invalid_Id) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -114,9 +114,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -143,9 +143,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -167,9 +167,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -183,9 +183,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
...
...
@@ -198,9 +198,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -212,9 +212,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -233,9 +233,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -253,9 +253,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
...
...
@@ -268,9 +268,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -282,9 +282,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -303,9 +303,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
SMCreateMnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
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
浏览文件 @
d758a102
...
...
@@ -55,9 +55,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -68,9 +68,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -90,9 +90,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -124,9 +124,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -148,9 +148,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -169,9 +169,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -185,9 +185,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
taosMsleep
(
1000
);
...
...
@@ -203,9 +203,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -217,9 +217,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -239,9 +239,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -258,9 +258,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
...
...
@@ -273,9 +273,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
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
);
...
...
@@ -286,9 +286,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -307,9 +307,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
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
浏览文件 @
d758a102
...
...
@@ -55,9 +55,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -68,9 +68,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -90,9 +90,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -124,9 +124,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -148,9 +148,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -169,9 +169,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -185,9 +185,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
...
...
@@ -200,9 +200,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -214,9 +214,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -235,9 +235,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -255,9 +255,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
...
...
@@ -270,9 +270,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -284,9 +284,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -305,9 +305,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
SMCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/test/trans/trans.cpp
浏览文件 @
d758a102
...
...
@@ -136,9 +136,9 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -155,9 +155,9 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -194,9 +194,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
server2
.
Stop
();
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
...
...
@@ -249,9 +249,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -274,9 +274,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
SMCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
d758a102
...
...
@@ -783,6 +783,10 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
tableType
=
TSDB_MGMT_TABLE_MODULE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_QNODES
,
tListLen
(
pName
->
tname
))
==
0
)
{
tableType
=
TSDB_MGMT_TABLE_QNODE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_SNODES
,
tListLen
(
pName
->
tname
))
==
0
)
{
tableType
=
TSDB_MGMT_TABLE_SNODE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_BNODES
,
tListLen
(
pName
->
tname
))
==
0
)
{
tableType
=
TSDB_MGMT_TABLE_BNODE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_FUNCTIONS
,
tListLen
(
pName
->
tname
))
==
0
)
{
tableType
=
TSDB_MGMT_TABLE_FUNC
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_INDEXES
,
tListLen
(
pName
->
tname
))
==
0
)
{
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
d758a102
...
...
@@ -158,6 +158,8 @@ SNodeptr nodesMakeNode(ENodeType type) {
case
QUERY_NODE_SHOW_FUNCTIONS_STMT
:
case
QUERY_NODE_SHOW_INDEXES_STMT
:
case
QUERY_NODE_SHOW_STREAMS_STMT
:
case
QUERY_NODE_SHOW_BNODES_STMT
:
case
QUERY_NODE_SHOW_SNODES_STMT
:
return
makeNode
(
type
,
sizeof
(
SShowStmt
));
case
QUERY_NODE_LOGIC_PLAN_SCAN
:
return
makeNode
(
type
,
sizeof
(
SScanLogicNode
));
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
d758a102
...
...
@@ -2037,13 +2037,13 @@ static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt
static
int16_t
getCreateComponentNodeMsgType
(
ENodeType
type
)
{
switch
(
type
)
{
case
QUERY_NODE_CREATE_QNODE_STMT
:
return
TDMT_
D
ND_CREATE_QNODE
;
return
TDMT_
M
ND_CREATE_QNODE
;
case
QUERY_NODE_CREATE_BNODE_STMT
:
return
TDMT_
D
ND_CREATE_BNODE
;
return
TDMT_
M
ND_CREATE_BNODE
;
case
QUERY_NODE_CREATE_SNODE_STMT
:
return
TDMT_
D
ND_CREATE_SNODE
;
return
TDMT_
M
ND_CREATE_SNODE
;
case
QUERY_NODE_CREATE_MNODE_STMT
:
return
TDMT_
D
ND_CREATE_MNODE
;
return
TDMT_
M
ND_CREATE_MNODE
;
default:
break
;
}
...
...
@@ -2059,12 +2059,12 @@ static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComp
}
pCxt
->
pCmdMsg
->
epSet
=
pCxt
->
pParseCxt
->
mgmtEpSet
;
pCxt
->
pCmdMsg
->
msgType
=
getCreateComponentNodeMsgType
(
nodeType
(
pStmt
));
pCxt
->
pCmdMsg
->
msgLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
pCxt
->
pCmdMsg
->
msgLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
pCxt
->
pCmdMsg
->
pMsg
=
taosMemoryMalloc
(
pCxt
->
pCmdMsg
->
msgLen
);
if
(
NULL
==
pCxt
->
pCmdMsg
->
pMsg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pCxt
->
pCmdMsg
->
pMsg
,
pCxt
->
pCmdMsg
->
msgLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pCxt
->
pCmdMsg
->
pMsg
,
pCxt
->
pCmdMsg
->
msgLen
,
&
createReq
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2072,13 +2072,13 @@ static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComp
static
int16_t
getDropComponentNodeMsgType
(
ENodeType
type
)
{
switch
(
type
)
{
case
QUERY_NODE_DROP_QNODE_STMT
:
return
TDMT_
D
ND_DROP_QNODE
;
return
TDMT_
M
ND_DROP_QNODE
;
case
QUERY_NODE_DROP_BNODE_STMT
:
return
TDMT_
D
ND_DROP_BNODE
;
return
TDMT_
M
ND_DROP_BNODE
;
case
QUERY_NODE_DROP_SNODE_STMT
:
return
TDMT_
D
ND_DROP_SNODE
;
return
TDMT_
M
ND_DROP_SNODE
;
case
QUERY_NODE_DROP_MNODE_STMT
:
return
TDMT_
D
ND_DROP_MNODE
;
return
TDMT_
M
ND_DROP_MNODE
;
default:
break
;
}
...
...
@@ -2094,12 +2094,12 @@ static int32_t translateDropComponentNode(STranslateContext* pCxt, SDropComponen
}
pCxt
->
pCmdMsg
->
epSet
=
pCxt
->
pParseCxt
->
mgmtEpSet
;
pCxt
->
pCmdMsg
->
msgType
=
getDropComponentNodeMsgType
(
nodeType
(
pStmt
));
pCxt
->
pCmdMsg
->
msgLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
pCxt
->
pCmdMsg
->
msgLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
pCxt
->
pCmdMsg
->
pMsg
=
taosMemoryMalloc
(
pCxt
->
pCmdMsg
->
msgLen
);
if
(
NULL
==
pCxt
->
pCmdMsg
->
pMsg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
tSerializeS
MCreateDrop
QSBNodeReq
(
pCxt
->
pCmdMsg
->
pMsg
,
pCxt
->
pCmdMsg
->
msgLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pCxt
->
pCmdMsg
->
pMsg
,
pCxt
->
pCmdMsg
->
msgLen
,
&
dropReq
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/transport/src/rpcMain.c
浏览文件 @
d758a102
...
...
@@ -1211,7 +1211,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte
rpcSendReqToServer
(
pRpc
,
pContext
);
rpcFreeCont
(
rpcMsg
.
pCont
);
}
else
if
(
pHead
->
code
==
TSDB_CODE_RPC_NOT_READY
||
pHead
->
code
==
TSDB_CODE_APP_NOT_READY
||
pHead
->
code
==
TSDB_CODE_
DND
_OFFLINE
)
{
pHead
->
code
==
TSDB_CODE_
NODE
_OFFLINE
)
{
pContext
->
code
=
pHead
->
code
;
rpcProcessConnError
(
pContext
,
NULL
);
rpcFreeCont
(
rpcMsg
.
pCont
);
...
...
source/util/src/terror.c
浏览文件 @
d758a102
...
...
@@ -70,21 +70,29 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQD
TAOS_DEFINE_ERROR
(
TSDB_CODE_RPC_INVALID_VERSION
,
"Invalid app version"
)
//common & util
TAOS_DEFINE_ERROR
(
TSDB_CODE_OPS_NOT_SUPPORT
,
"Operation not supported"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OUT_OF_MEMORY
,
"Out of Memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OUT_OF_RANGE
,
"Out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OUT_OF_SHM_MEM
,
"Out of Shared memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_SHM_ID
,
"Invalid SHM ID"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_PTR
,
"Invalid pointer"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG
,
"Invalid message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG_LEN
,
"Invalid message len"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_PARA
,
"Invalid parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_CFG
,
"Invalid config option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_OPTION
,
"Invalid option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_JSON_FORMAT
,
"Invalid json format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VERSION_NUMBER
,
"Invalid version number"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VERSION_STRING
,
"Invalid version string"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VERSION_NOT_COMPATIBLE
,
"Version not compatible"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MEMORY_CORRUPTED
,
"Memory corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FILE_CORRUPTED
,
"Data file corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CHECKSUM_ERROR
,
"Checksum error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG
,
"Invalid message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COMPRESS_ERROR
,
"Failed to compress msg"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OPS_NOT_SUPPORT
,
"Operation not supported"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MSG_NOT_PROCESSED
,
"Message not processed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_PARA
,
"Invalid parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REPEAT_INIT
,
"Repeat initialization"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CFG_NOT_FOUND
,
"Config not found"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_CFG
,
"Invalid config option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_OUT_OF_SHM_MEM
,
"Out of Share memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_SHM_ID
,
"Invalid SHM ID"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REPEAT_INIT
,
"Repeat initialization"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_NO_MEMORY
,
"Ref out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_FULL
,
"too many Ref Objs"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_ID_REMOVED
,
"Ref ID is removed"
)
...
...
@@ -92,11 +100,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_REF_INVALID_ID, "Invalid Ref ID")
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_ALREADY_EXIST
,
"Ref is already there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_NOT_EXIST
,
"Ref is not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VERSION_NUMBER
,
"Invalid version number"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VERSION_STRING
,
"Invalid version string"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VERSION_NOT_COMPATIBLE
,
"Version not compatible"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COMPRESS_ERROR
,
"Failed to compress msg"
)
//client
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_OPERATION
,
"Invalid operation"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_QHANDLE
,
"Invalid qhandle"
)
...
...
@@ -277,17 +280,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "SMA does not exist")
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_SMA_OPTION
,
"Invalid sma option"
)
// dnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_ACTION_IN_PROGRESS
,
"Action in progress"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_OFFLINE
,
"Dnode is offline"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_INVALID_MSG_LEN
,
"Invalid message length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NODE_OFFLINE
,
"Node is offline"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NODE_ALREADY_DEPLOYED
,
"Node already deployed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NODE_NOT_DEPLOYED
,
"Node not deployed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NODE_PARSE_FILE_ERROR
,
"Invalid json format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_NODE_INVALID_OPTION
,
"Invalid node option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED
,
"Vnode already deployed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
,
"Vnode not deployed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_VNODE_INVALID_OPTION
,
"Vnode option invalid"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_VNODE_TOO_MANY_VNODES
,
"Too many vnodes"
)
// vnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_ACTION_IN_PROGRESS
,
"Action in progress"
)
...
...
tests/script/jenkins/basic.txt
浏览文件 @
d758a102
...
...
@@ -33,6 +33,15 @@
./test.sh -f tsim/query/scalarFunction.sim
./test.sh -f tsim/query/charScalarFunction.sim
# ---- qnode
./test.sh -f tsim/qnode/basic1.sim
# ---- snode
./test.sh -f tsim/snode/basic1.sim
# ---- bnode
./test.sh -f tsim/bnode/basic1.sim
# ---- show
./test.sh -f tsim/show/basic.sim
...
...
tests/script/tsim/bnode/basic1.sim
0 → 100644
浏览文件 @
d758a102
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 =============== show dnodes
sql show dnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql show mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != master then
return -1
endi
print =============== create dnodes
sql create dnode $hostname port 7200
sleep 2000
sql show 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 show mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != master 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/qnode/basic1.sim
0 → 100644
浏览文件 @
d758a102
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 =============== show dnodes
sql show dnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql show mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != master then
return -1
endi
print =============== create dnodes
sql create dnode $hostname port 7200
sleep 2000
sql show 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 show mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != master then
return -1
endi
print =============== create drop qnode 1
sql create qnode on dnode 1
sql show qnodes
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql_error create qnode on dnode 1
sql drop qnode on dnode 1
sql show qnodes
if $rows != 0 then
return -1
endi
sql_error drop qnode on dnode 1
print =============== create drop qnode 2
sql create qnode on dnode 2
sql show qnodes
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql_error create qnode on dnode 2
sql drop qnode on dnode 2
sql show qnodes
if $rows != 0 then
return -1
endi
sql_error drop qnode on dnode 2
print =============== create drop qnodes
sql create qnode on dnode 1
sql create qnode on dnode 2
sql show qnodes
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 qnodes
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/snode/basic1.sim
0 → 100644
浏览文件 @
d758a102
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 =============== show dnodes
sql show dnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql show mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != master then
return -1
endi
print =============== create dnodes
sql create dnode $hostname port 7200
sleep 2000
sql show 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 show mnodes;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data02 != master then
return -1
endi
print =============== create drop qnode 1
sql create qnode on dnode 1
sql show qnodes
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql_error create qnode on dnode 1
sql drop qnode on dnode 1
sql show qnodes
if $rows != 0 then
return -1
endi
sql_error drop qnode on dnode 1
print =============== create drop qnode 2
sql create qnode on dnode 2
sql show qnodes
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql_error create qnode on dnode 2
sql drop qnode on dnode 2
sql show qnodes
if $rows != 0 then
return -1
endi
sql_error drop qnode on dnode 2
print =============== create drop qnodes
sql create qnode on dnode 1
sql create qnode on dnode 2
sql show qnodes
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 qnodes
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录