Merge branch 'master' into feature/m2d4
This commit is contained in:
commit
90ce44fd6e
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -45,6 +45,15 @@ class BuildDockerCluser:
|
|||
"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
|
||||
|
@ -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)
|
||||
display = "echo %s" % cmd
|
||||
self.execCmd(display)
|
||||
self.execCmd(cmd)
|
||||
self.getConnection()
|
||||
self.createDondes()
|
||||
|
|
Loading…
Reference in New Issue