示例#1
0
    def run(self):
        # cluster environment set up
        nodes = Nodes()
        ctest = ClusterTest(nodes.node1.hostName)
        ctest.connectDB()
        tdSql.init(ctest.conn.cursor(), False)

        nodes.addConfigs("offlineThreshold", "10")
        nodes.removeAllDataFiles()
        nodes.restartAllTaosd()
        nodes.node3.stopTaosd()

        tdLog.sleep(10)
        tdSql.query("show dnodes")
        tdSql.checkRows(3)
        tdSql.checkData(2, 4, "offline")

        tdLog.sleep(60)
        tdSql.checkRows(3)
        tdSql.checkData(2, 4, "dropping")

        tdLog.sleep(300)
        tdSql.checkRows(2)

        nodes.removeConfigs("offlineThreshold", "10")
        nodes.restartAllTaosd()

        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
示例#2
0
    def run(self):

        nodes = Nodes()
        ctest = ClusterTest(nodes.node1.hostName)
        ctest.connectDB()
        ctest.createSTable(3)
        ctest.run()
        tdSql.init(ctest.conn.cursor(), False)

        nodes.node2.stopTaosd()
        tdSql.execute("use %s" % ctest.dbName)
        tdSql.query("show vgroups")
        vnodeID = tdSql.getData(0, 0)
        nodes.node2.removeDataForVnode(vnodeID)
        nodes.node2.startTaosd()

        # Wait for vnode file to recover
        for i in range(10):
            tdSql.query("select count(*) from t0")

        tdLog.sleep(10)

        for i in range(10):
            tdSql.query("select count(*) from t0")
            tdSql.checkData(0, 0, 1000)

        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
示例#3
0
    def run(self):
        
        nodes = Nodes()
        ctest = ClusterTest(nodes.node1.hostName)
        ctest.connectDB()                
        ctest.createSTable(1)
        ctest.run()
        tdSql.init(ctest.conn.cursor(), False)
        
        tdSql.execute("use %s" % ctest.dbName) 
        totalTime = 0
        for i in range(10):
            startTime = time.time()
            tdSql.query("select * from %s" % ctest.stbName)
            totalTime += time.time() - startTime
        print("replica 1: avarage query time for %d records: %f seconds" % (ctest.numberOfTables * ctest.numberOfRecords,totalTime / 10))

        tdSql.execute("alter database %s replica 3" % ctest.dbName)
        tdLog.sleep(60)
        totalTime = 0
        for i in range(10):
            startTime = time.time()
            tdSql.query("select * from %s" % ctest.stbName)
            totalTime += time.time() - startTime
        print("replica 3: avarage query time for %d records: %f seconds" % (ctest.numberOfTables * ctest.numberOfRecords,totalTime / 10))
                                
        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
示例#4
0
    def run(self):

        nodes = Nodes()
        nodes.addConfigs("maxVgroupsPerDb", "10")
        nodes.addConfigs("maxTablesPerVnode", "1000")
        nodes.restartAllTaosd()

        ctest = ClusterTest(nodes.node1.hostName)
        ctest.connectDB()
        ctest.createSTable(1)
        ctest.run()
        tdSql.init(ctest.conn.cursor(), False)

        tdSql.execute("use %s" % ctest.dbName)
        tdSql.query("show vgroups")
        dnodes = []
        for i in range(10):
            dnodes.append(int(tdSql.getData(i, 4)))

        s = set(dnodes)
        if len(s) < 3:
            tdLog.exit("cluster is not balanced")

        tdLog.info("cluster is balanced")

        nodes.removeConfigs("maxVgroupsPerDb", "10")
        nodes.removeConfigs("maxTablesPerVnode", "1000")
        nodes.restartAllTaosd()

        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
示例#5
0
    def run(self):
        # cluster environment set up
        tdLog.info("Test case 7, 10")

        nodes = Nodes()
        ctest = ClusterTest(nodes.node1.hostName)
        ctest.connectDB()
        tdSql.init(ctest.conn.cursor(), False)

        nodes.node1.stopTaosd()
        tdSql.query("show dnodes")
        tdSql.checkRows(3)
        tdSql.checkData(0, 4, "offline")
        tdSql.checkData(1, 4, "ready")
        tdSql.checkData(2, 4, "ready")

        nodes.node1.startTaosd()
        tdSql.checkRows(3)
        tdSql.checkData(0, 4, "ready")
        tdSql.checkData(1, 4, "ready")
        tdSql.checkData(2, 4, "ready")

        nodes.node2.stopTaosd()
        tdSql.query("show dnodes")
        tdSql.checkRows(3)
        tdSql.checkData(0, 4, "ready")
        tdSql.checkData(1, 4, "offline")
        tdSql.checkData(2, 4, "ready")

        nodes.node2.startTaosd()
        tdSql.checkRows(3)
        tdSql.checkData(0, 4, "ready")
        tdSql.checkData(1, 4, "ready")
        tdSql.checkData(2, 4, "ready")

        nodes.node3.stopTaosd()
        tdSql.query("show dnodes")
        tdSql.checkRows(3)
        tdSql.checkData(0, 4, "ready")
        tdSql.checkData(1, 4, "ready")
        tdSql.checkData(2, 4, "offline")

        nodes.node3.startTaosd()
        tdSql.checkRows(3)
        tdSql.checkData(0, 4, "ready")
        tdSql.checkData(1, 4, "ready")
        tdSql.checkData(2, 4, "ready")

        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
    def run(self):

        nodes = Nodes()
        ctest = ClusterTest(nodes.node1.hostName)
        ctest.connectDB()
        ctest.createSTable(3)
        ctest.run()
        tdSql.init(ctest.conn.cursor(), False)

        tdSql.execute("use %s" % ctest.dbName)

        nodes.node2.stopTaosd()
        for i in range(100):
            tdSql.execute("drop table t%d" % i)

        nodes.node2.startTaosd()
        tdSql.query("show tables")
        tdSql.checkRows(9900)

        nodes.node2.stopTaosd()
        for i in range(10):
            tdSql.execute("create table a%d using meters tags(2)" % i)

        nodes.node2.startTaosd()
        tdSql.query("show tables")
        tdSql.checkRows(9910)

        nodes.node2.stopTaosd()
        tdSql.execute("alter table meters add col col6 int")
        nodes.node2.startTaosd()

        nodes.node2.stopTaosd()
        tdSql.execute("drop database %s" % ctest.dbName)

        nodes.node2.startTaosd()
        tdSql.query("show databases")
        tdSql.checkRows(0)

        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
    def run(self):
        # cluster environment set up
        nodes = Nodes()
        nodes.addConfigs("maxVgroupsPerDb", "10")
        nodes.addConfigs("maxTablesPerVnode", "1000")
        nodes.restartAllTaosd()

        ctest = ClusterTest(nodes.node1.hostName)
        ctest.connectDB()
        ctest.createSTable(1)
        ctest.run()

        tdSql.init(ctest.conn.cursor(), False)
        tdSql.execute("use %s" % ctest.dbName)
        tdSql.error("create table tt1 using %s tags(1)" % ctest.stbName)

        nodes.removeConfigs("maxVgroupsPerDb", "10")
        nodes.removeConfigs("maxTablesPerVnode", "1000")
        nodes.restartAllTaosd()

        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
示例#8
0
    def run(self):

        nodes = Nodes()
        ctest = ClusterTest(nodes.node1.hostName)

        ctest.connectDB()
        tdSql.init(ctest.conn.cursor(), False)

        ## Test case 1 ##
        tdLog.info("Test case 1 repeat %d times" % ctest.repeat)
        for i in range(ctest.repeat):
            tdLog.info("Start Round %d" % (i + 1))
            replica = random.randint(1, 3)
            ctest.createSTable(replica)
            ctest.run()
            tdLog.sleep(10)
            tdSql.query("select count(*) from %s.%s" %
                        (ctest.dbName, ctest.stbName))
            tdSql.checkData(0, 0, ctest.numberOfRecords * ctest.numberOfTables)
            tdLog.info("Round %d completed" % (i + 1))

        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)
示例#9
0
 def stop(self):
     tdSql.close()
     tdLog.success("%s successfully executed" % __file__)