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