Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
941e69da
T
TDengine
项目概览
小楼昨夜-听风雨
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
941e69da
编写于
6月 30, 2021
作者:
H
Haojun Liao
提交者:
GitHub
6月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6644 from taosdata/feature/m2d4
merge from master into develop
上级
4233a5a5
90ce44fd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
19 deletion
+39
-19
src/balance/src/bnMain.c
src/balance/src/bnMain.c
+14
-7
src/inc/tbn.h
src/inc/tbn.h
+1
-0
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+2
-2
tests/pytest/dockerCluster/OneMnodeMultipleVnodesTest.py
tests/pytest/dockerCluster/OneMnodeMultipleVnodesTest.py
+2
-3
tests/pytest/dockerCluster/basic.py
tests/pytest/dockerCluster/basic.py
+20
-7
未找到文件。
src/balance/src/bnMain.c
浏览文件 @
941e69da
...
...
@@ -637,6 +637,19 @@ int32_t bnDropDnode(SDnodeObj *pDnode) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
bnDnodeCanCreateMnode
(
struct
SDnodeObj
*
pDnode
)
{
if
(
pDnode
==
NULL
)
return
0
;
if
(
pDnode
->
isMgmt
||
pDnode
->
alternativeRole
==
TAOS_DN_ALTERNATIVE_ROLE_VNODE
||
pDnode
->
status
==
TAOS_DN_STATUS_DROPPING
||
pDnode
->
status
==
TAOS_DN_STATUS_OFFLINE
)
{
return
0
;
}
else
{
return
1
;
}
}
static
void
bnMonitorDnodeModule
()
{
int32_t
numOfMnodes
=
mnodeGetMnodesNum
();
if
(
numOfMnodes
>=
tsNumOfMnodes
)
return
;
...
...
@@ -645,13 +658,7 @@ static void bnMonitorDnodeModule() {
SDnodeObj
*
pDnode
=
tsBnDnodes
.
list
[
i
];
if
(
pDnode
==
NULL
)
break
;
if
(
pDnode
->
isMgmt
||
pDnode
->
status
==
TAOS_DN_STATUS_DROPPING
||
pDnode
->
status
==
TAOS_DN_STATUS_OFFLINE
)
{
continue
;
}
if
(
pDnode
->
alternativeRole
==
TAOS_DN_ALTERNATIVE_ROLE_VNODE
)
{
continue
;
}
if
(
!
bnDnodeCanCreateMnode
(
pDnode
))
continue
;
mLInfo
(
"dnode:%d, numOfMnodes:%d expect:%d, create mnode in this dnode"
,
pDnode
->
dnodeId
,
numOfMnodes
,
tsNumOfMnodes
);
mnodeCreateMnode
(
pDnode
->
dnodeId
,
pDnode
->
dnodeEp
,
true
);
...
...
src/inc/tbn.h
浏览文件 @
941e69da
...
...
@@ -31,6 +31,7 @@ void bnReset();
int32_t
bnAllocVnodes
(
struct
SVgObj
*
pVgroup
);
int32_t
bnAlterDnode
(
struct
SDnodeObj
*
pDnode
,
int32_t
vnodeId
,
int32_t
dnodeId
);
int32_t
bnDropDnode
(
struct
SDnodeObj
*
pDnode
);
int32_t
bnDnodeCanCreateMnode
(
struct
SDnodeObj
*
pDnode
);
#ifdef __cplusplus
}
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
941e69da
...
...
@@ -16,7 +16,6 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "tgrant.h"
#include "tbn.h"
#include "tglobal.h"
#include "tconfig.h"
#include "tutil.h"
...
...
@@ -632,7 +631,8 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
}
int32_t
numOfMnodes
=
mnodeGetMnodesNum
();
if
(
numOfMnodes
<
tsNumOfMnodes
&&
numOfMnodes
<
mnodeGetOnlineDnodesNum
()
&&
!
pDnode
->
isMgmt
)
{
if
(
numOfMnodes
<
tsNumOfMnodes
&&
numOfMnodes
<
mnodeGetOnlineDnodesNum
()
&&
bnDnodeCanCreateMnode
(
pDnode
))
{
bnNotify
();
}
...
...
tests/pytest/dockerCluster/OneMnodeMultipleVnodesTest.py
浏览文件 @
941e69da
...
...
@@ -12,9 +12,6 @@
# -*- coding: utf-8 -*-
from
basic
import
*
from
util.sql
import
tdSql
class
TDTestCase
:
...
...
@@ -36,4 +33,6 @@ td = TDTestCase()
td
.
init
()
## usage: python3 OneMnodeMultipleVnodesTest.py
tests/pytest/dockerCluster/basic.py
浏览文件 @
941e69da
...
...
@@ -44,7 +44,16 @@ class BuildDockerCluser:
"jnidebugFlag"
:
"135"
,
"qdebugFlag"
:
"135"
,
"maxSQLLength"
:
"1048576"
}
}
cmd
=
"mkdir -p %s"
%
self
.
dockerDir
self
.
execCmd
(
cmd
)
cmd
=
"cp *.yml %s"
%
self
.
dockerDir
self
.
execCmd
(
cmd
)
cmd
=
"cp Dockerfile %s"
%
self
.
dockerDir
self
.
execCmd
(
cmd
)
# execute command, and return the output
# ref: https://blog.csdn.net/wowocpp/article/details/80775650
...
...
@@ -81,7 +90,7 @@ class BuildDockerCluser:
def
removeFile
(
self
,
rootDir
,
index
,
dir
):
cmd
=
"rm -rf %s/node%d/%s/*"
%
(
rootDir
,
index
,
dir
)
self
.
execCmd
(
cmd
)
def
clearEnv
(
self
):
cmd
=
"cd %s && docker-compose down --remove-orphans"
%
self
.
dockerDir
self
.
execCmd
(
cmd
)
...
...
@@ -108,10 +117,14 @@ class BuildDockerCluser:
self
.
execCmd
(
cmd
)
def
updateLocalhosts
(
self
):
cmd
=
"grep '172.27.0.7 *tdnode1' /etc/hosts"
cmd
=
"grep '172.27.0.7 *tdnode1' /etc/hosts
| sed 's: ::g'
"
result
=
self
.
execCmdAndGetOutput
(
cmd
)
if
result
and
not
result
.
isspace
():
print
(
result
)
if
result
is
None
or
result
.
isspace
():
print
(
"=========="
)
cmd
=
"echo '172.27.0.7 tdnode1' >> /etc/hosts"
display
=
"echo %s"
%
cmd
self
.
execCmd
(
display
)
self
.
execCmd
(
cmd
)
def
deploy
(
self
):
...
...
@@ -138,13 +151,13 @@ class BuildDockerCluser:
if
self
.
numOfNodes
<
2
or
self
.
numOfNodes
>
10
:
print
(
"the number of nodes must be between 2 and 10"
)
exit
(
0
)
self
.
clearEnv
()
self
.
createDirs
()
self
.
updateLocalhosts
()
self
.
deploy
()
def
run
(
self
):
cmd
=
"./buildClusterEnv.sh -n %d -v %s -d %s"
%
(
self
.
numOfNodes
,
self
.
getTaosdVersion
(),
self
.
dockerDir
)
cmd
=
"./buildClusterEnv.sh -n %d -v %s -d %s"
%
(
self
.
numOfNodes
,
self
.
getTaosdVersion
(),
self
.
dockerDir
)
display
=
"echo %s"
%
cmd
self
.
execCmd
(
display
)
self
.
execCmd
(
cmd
)
self
.
getConnection
()
self
.
createDondes
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录