Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9b273e17
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9b273e17
编写于
5月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: create mnode
上级
cff293ea
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
123 addition
and
21 deletion
+123
-21
include/util/tdef.h
include/util/tdef.h
+5
-5
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
+7
-1
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+10
-8
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+16
-0
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+0
-6
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+1
-1
tests/script/tsim/mnode/basic2.sim
tests/script/tsim/mnode/basic2.sim
+84
-0
未找到文件。
include/util/tdef.h
浏览文件 @
9b273e17
...
...
@@ -428,11 +428,11 @@ enum {
};
#define DEFAULT_HANDLE 0
#define MNODE_HANDLE
-
1
#define QNODE_HANDLE -
2
#define SNODE_HANDLE -
3
#define VNODE_HANDLE -
4
#define BNODE_HANDLE -
5
#define MNODE_HANDLE 1
#define QNODE_HANDLE -
1
#define SNODE_HANDLE -
2
#define VNODE_HANDLE -
3
#define BNODE_HANDLE -
4
#define TSDB_CONFIG_OPTION_LEN 16
#define TSDB_CONIIG_VALUE_LEN 48
...
...
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
浏览文件 @
9b273e17
...
...
@@ -55,9 +55,15 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, const SMgmtInputOpt *pInpu
static
void
mmBuildOptionForOpen
(
SMnodeMgmt
*
pMgmt
,
SMnodeOpt
*
pOption
)
{
pOption
->
msgCb
=
pMgmt
->
msgCb
;
pOption
->
selfIndex
=
pMgmt
->
selfIndex
;
pOption
->
replica
=
pMgmt
->
replica
;
pOption
->
selfIndex
=
-
1
;
memcpy
(
&
pOption
->
replicas
,
pMgmt
->
replicas
,
sizeof
(
SReplica
)
*
TSDB_MAX_REPLICA
);
for
(
int32_t
i
=
0
;
i
<
pOption
->
replica
;
++
i
)
{
if
(
pOption
->
replicas
[
i
].
id
==
pMgmt
->
pData
->
dnodeId
)
{
pOption
->
selfIndex
=
i
;
}
}
pMgmt
->
selfIndex
=
pOption
->
selfIndex
;
pOption
->
deploy
=
false
;
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
9b273e17
...
...
@@ -39,14 +39,16 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
static
void
mndCancelGetNextMnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitMnode
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_MNODE
,
.
keyType
=
SDB_KEY_INT32
,
.
deployFp
=
(
SdbDeployFp
)
mndCreateDefaultMnode
,
.
encodeFp
=
(
SdbEncodeFp
)
mndMnodeActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mndMnodeActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mndMnodeActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mndMnodeActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndMnodeActionDelete
};
SSdbTable
table
=
{
.
sdbType
=
SDB_MNODE
,
.
keyType
=
SDB_KEY_INT32
,
.
deployFp
=
(
SdbDeployFp
)
mndCreateDefaultMnode
,
.
encodeFp
=
(
SdbEncodeFp
)
mndMnodeActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mndMnodeActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mndMnodeActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mndMnodeActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndMnodeActionDelete
,
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_MNODE
,
mndProcessCreateMnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_MNODE
,
mndProcessDropMnodeReq
);
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
9b273e17
...
...
@@ -90,10 +90,12 @@ int32_t mndInitSync(SMnode *pMnode) {
SSyncCfg
*
pCfg
=
&
syncInfo
.
syncCfg
;
pCfg
->
replicaNum
=
pMnode
->
replica
;
pCfg
->
myIndex
=
pMnode
->
selfIndex
;
mInfo
(
"start to open mnode, replica:%d myIndex:%d"
,
pCfg
->
replicaNum
,
pCfg
->
myIndex
);
for
(
int32_t
i
=
0
;
i
<
pMnode
->
replica
;
++
i
)
{
SNodeInfo
*
pNode
=
&
pCfg
->
nodeInfo
[
i
];
tstrncpy
(
pNode
->
nodeFqdn
,
pMnode
->
replicas
[
i
].
fqdn
,
sizeof
(
pNode
->
nodeFqdn
));
pNode
->
nodePort
=
pMnode
->
replicas
[
i
].
port
;
mInfo
(
"index:%d, fqdn:%s port:%d"
,
i
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
}
tsem_init
(
&
pMgmt
->
syncSem
,
0
,
0
);
...
...
@@ -161,3 +163,17 @@ bool mndIsMaster(SMnode *pMnode) {
return
(
pMgmt
->
state
==
TAOS_SYNC_STATE_LEADER
)
&&
(
pMnode
->
syncMgmt
.
restored
);
}
int32_t
mndAlter
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
)
{
SSyncCfg
cfg
=
{.
replicaNum
=
pOption
->
replica
,
.
myIndex
=
pOption
->
selfIndex
};
mInfo
(
"start to alter mnode, replica:%d myIndex:%d"
,
cfg
.
replicaNum
,
cfg
.
myIndex
);
for
(
int32_t
i
=
0
;
i
<
pOption
->
replica
;
++
i
)
{
SNodeInfo
*
pNode
=
&
cfg
.
nodeInfo
[
i
];
tstrncpy
(
pNode
->
nodeFqdn
,
pOption
->
replicas
[
i
].
fqdn
,
sizeof
(
pNode
->
nodeFqdn
));
pNode
->
nodePort
=
pOption
->
replicas
[
i
].
port
;
mInfo
(
"index:%d, fqdn:%s port:%d"
,
i
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
}
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
return
syncReconfig
(
pMgmt
->
sync
,
&
cfg
);
}
\ No newline at end of file
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
9b273e17
...
...
@@ -329,12 +329,6 @@ void mndClose(SMnode *pMnode) {
}
}
int32_t
mndAlter
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
)
{
mDebug
(
"start to alter mnode"
);
mDebug
(
"mnode is altered"
);
return
0
;
}
int32_t
mndStart
(
SMnode
*
pMnode
)
{
mndSyncStart
(
pMnode
);
return
mndInitTimer
(
pMnode
);
...
...
tests/script/sh/deploy.sh
浏览文件 @
9b273e17
...
...
@@ -136,7 +136,7 @@ echo "qDebugFlag 143" >> $TAOS_CFG
echo
"rpcDebugFlag 143"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"uDebugFlag 143"
>>
$TAOS_CFG
echo
"sDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"sDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"wDebugFlag 143"
>>
$TAOS_CFG
echo
"numOfLogLines 20000000"
>>
$TAOS_CFG
echo
"statusInterval 1"
>>
$TAOS_CFG
...
...
tests/script/tsim/mnode/basic2.sim
0 → 100644
浏览文件 @
9b273e17
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 != LEADER 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 != LEADER then
return -1
endi
print =============== create mnode 2
sql create mnode on dnode 2
sql show mnodes
if $rows != 2 then
return -1
endi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录