add srvCtl cluster support
This commit is contained in:
parent
9a8660dd4e
commit
ec16e79b39
|
@ -9,11 +9,12 @@ import time
|
||||||
from frame.log import *
|
from frame.log import *
|
||||||
from frame.cases import *
|
from frame.cases import *
|
||||||
from frame.sql import *
|
from frame.sql import *
|
||||||
|
from frame.srvCtl import *
|
||||||
from frame.caseBase import *
|
from frame.caseBase import *
|
||||||
from frame import *
|
from frame import *
|
||||||
from frame.autogen import *
|
from frame.autogen import *
|
||||||
from frame.server.dnodes import *
|
# from frame.server.dnodes import *
|
||||||
from frame.server.cluster import *
|
# from frame.server.cluster import *
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase(TBase):
|
class TDTestCase(TBase):
|
||||||
|
@ -34,7 +35,7 @@ class TDTestCase(TBase):
|
||||||
autoGen.create_child(self.stb, "d", self.childtable_count)
|
autoGen.create_child(self.stb, "d", self.childtable_count)
|
||||||
autoGen.insert_data(1000)
|
autoGen.insert_data(1000)
|
||||||
tdSql.execute(f"flush database {self.db}")
|
tdSql.execute(f"flush database {self.db}")
|
||||||
clusterDnodes.stoptaosd(3)
|
sc.dnodeStop(3)
|
||||||
# clusterDnodes.stoptaosd(1)
|
# clusterDnodes.stoptaosd(1)
|
||||||
# clusterDnodes.starttaosd(3)
|
# clusterDnodes.starttaosd(3)
|
||||||
# time.sleep(5)
|
# time.sleep(5)
|
||||||
|
@ -56,7 +57,7 @@ class TDTestCase(TBase):
|
||||||
# break
|
# break
|
||||||
self.snapshotAgg()
|
self.snapshotAgg()
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
clusterDnodes.stopAll()
|
sc.dnodeStopAll()
|
||||||
for i in range(1, 4):
|
for i in range(1, 4):
|
||||||
path = clusterDnodes.getDnodeDir(i)
|
path = clusterDnodes.getDnodeDir(i)
|
||||||
dnodesRootDir = os.path.join(path,"data","vnode", "vnode*")
|
dnodesRootDir = os.path.join(path,"data","vnode", "vnode*")
|
||||||
|
@ -66,9 +67,9 @@ class TDTestCase(TBase):
|
||||||
tdLog.debug("delete dir: %s " % (dnodesRootDir))
|
tdLog.debug("delete dir: %s " % (dnodesRootDir))
|
||||||
self.remove_directory(os.path.join(dir, "wal"))
|
self.remove_directory(os.path.join(dir, "wal"))
|
||||||
|
|
||||||
clusterDnodes.starttaosd(1)
|
sc.dnodeStart(1)
|
||||||
clusterDnodes.starttaosd(2)
|
sc.dnodeStart(2)
|
||||||
clusterDnodes.starttaosd(3)
|
sc.dnodeStart(3)
|
||||||
sql = "show vnodes;"
|
sql = "show vnodes;"
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -22,6 +22,7 @@ class ClusterDnodes(TDDnodes):
|
||||||
def init(self, dnodes_lists, deployPath, masterIp):
|
def init(self, dnodes_lists, deployPath, masterIp):
|
||||||
self.dnodes = dnodes_lists # dnode must be TDDnode instance
|
self.dnodes = dnodes_lists # dnode must be TDDnode instance
|
||||||
super(ClusterDnodes, self).init(deployPath, masterIp)
|
super(ClusterDnodes, self).init(deployPath, masterIp)
|
||||||
|
self.model = "cluster"
|
||||||
|
|
||||||
clusterDnodes = ClusterDnodes()
|
clusterDnodes = ClusterDnodes()
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ class TDDnodes:
|
||||||
self.valgrind = 0
|
self.valgrind = 0
|
||||||
self.asan = False
|
self.asan = False
|
||||||
self.killValgrind = 0
|
self.killValgrind = 0
|
||||||
|
self.model = "dnode"
|
||||||
|
|
||||||
def init(self, path, remoteIP = ""):
|
def init(self, path, remoteIP = ""):
|
||||||
binPath = self.dnodes[0].getPath() + "/../../../"
|
binPath = self.dnodes[0].getPath() + "/../../../"
|
||||||
|
@ -268,6 +269,14 @@ class TDDnodes:
|
||||||
def getAsan(self):
|
def getAsan(self):
|
||||||
return self.asan
|
return self.asan
|
||||||
|
|
||||||
|
def getModel(self):
|
||||||
|
return self.model
|
||||||
|
|
||||||
|
def getDnodeCfgPath(self, index):
|
||||||
|
self.check(index)
|
||||||
|
return self.dnodes[index - 1].cfgPath
|
||||||
|
|
||||||
|
|
||||||
def setLevelDisk(self, level, disk):
|
def setLevelDisk(self, level, disk):
|
||||||
for i in range(len(self.dnodes)):
|
for i in range(len(self.dnodes)):
|
||||||
self.dnodes[i].level = int(level)
|
self.dnodes[i].level = int(level)
|
||||||
|
|
|
@ -18,6 +18,7 @@ import datetime
|
||||||
|
|
||||||
from frame.server.dnode import *
|
from frame.server.dnode import *
|
||||||
from frame.server.dnodes import *
|
from frame.server.dnodes import *
|
||||||
|
from frame.server.cluster import *
|
||||||
|
|
||||||
|
|
||||||
class srvCtl:
|
class srvCtl:
|
||||||
|
@ -34,19 +35,32 @@ class srvCtl:
|
||||||
|
|
||||||
# start
|
# start
|
||||||
def dnodeStart(self, idx):
|
def dnodeStart(self, idx):
|
||||||
|
if clusterDnodes.getModel() == 'cluster':
|
||||||
|
return clusterDnodes.starttaosd(idx)
|
||||||
|
|
||||||
return tdDnodes.starttaosd(idx)
|
return tdDnodes.starttaosd(idx)
|
||||||
|
|
||||||
# stop
|
# stop
|
||||||
def dnodeStop(self, idx):
|
def dnodeStop(self, idx):
|
||||||
|
if clusterDnodes.getModel() == 'cluster':
|
||||||
|
return clusterDnodes.stoptaosd(idx)
|
||||||
|
|
||||||
return tdDnodes.stoptaosd(idx)
|
return tdDnodes.stoptaosd(idx)
|
||||||
|
|
||||||
|
def dnodeStopAll(self):
|
||||||
|
if clusterDnodes.getModel() == 'cluster':
|
||||||
|
return clusterDnodes.stopAll()
|
||||||
|
|
||||||
|
return tdDnodes.stopAll()
|
||||||
#
|
#
|
||||||
# about path
|
# about path
|
||||||
#
|
#
|
||||||
|
|
||||||
# get cluster root path like /root/TDinternal/sim/
|
# get cluster root path like /root/TDinternal/sim/
|
||||||
def clusterRootPath(self):
|
def clusterRootPath(self):
|
||||||
|
if clusterDnodes.getModel() == 'cluster':
|
||||||
|
return clusterDnodes.getDnodesRootDir()
|
||||||
|
|
||||||
return tdDnodes.getDnodesRootDir()
|
return tdDnodes.getDnodesRootDir()
|
||||||
|
|
||||||
# return dnode data files list
|
# return dnode data files list
|
||||||
|
@ -60,7 +74,9 @@ class srvCtl:
|
||||||
|
|
||||||
# taos.cfg position
|
# taos.cfg position
|
||||||
def dnodeCfgPath(self, idx):
|
def dnodeCfgPath(self, idx):
|
||||||
return tdDnodes.dnodes[idx-1].cfgPath
|
if clusterDnodes.getModel() == 'cluster':
|
||||||
|
return clusterDnodes.getDnodeCfgPath(idx)
|
||||||
|
return tdDnodes.getDnodeCfgPath(idx)
|
||||||
|
|
||||||
|
|
||||||
sc = srvCtl()
|
sc = srvCtl()
|
Loading…
Reference in New Issue