diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 299e947d35..a3c8f4fd52 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -116,9 +116,9 @@ bool tsMndSkipGrant = false; bool tsEnableWhiteList = false; // ip white list cfg // arbitrator -int32_t tsArbHeartBeatIntervalSec = 5; -int32_t tsArbCheckSyncIntervalSec = 10; -int32_t tsArbSetAssignedTimeoutSec = 30; +int32_t tsArbHeartBeatIntervalSec = 2; +int32_t tsArbCheckSyncIntervalSec = 3; +int32_t tsArbSetAssignedTimeoutSec = 6; // dnode int64_t tsDndStart = 0; diff --git a/tests/army/cluster/arbitrator_election.py b/tests/army/cluster/arbitrator_election.py new file mode 100644 index 0000000000..7883e162a7 --- /dev/null +++ b/tests/army/cluster/arbitrator_election.py @@ -0,0 +1,97 @@ +import taos +import sys +import os +import subprocess +import glob +import shutil +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 import epath +# from frame.server.dnodes import * +# from frame.server.cluster import * + + +class TDTestCase(TBase): + + def init(self, conn, logSql, replicaVar=1): + updatecfgDict = {'dDebugFlag':131} + super(TDTestCase, self).init(conn, logSql, replicaVar=1, checkColName="c1") + + self.valgrind = 0 + self.db = "test" + self.stb = "meters" + self.childtable_count = 10 + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.execute('CREATE DATABASE db vgroups 1 replica 2;') + + time.sleep(1) + + tdSql.execute("use db;") + + tdSql.execute("CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);") + + tdSql.execute("CREATE TABLE d0 USING meters TAGS (\"California.SanFrancisco\", 2);"); + + count = 0 + + while count < 100: + tdSql.query("show arbgroups;") + + if tdSql.getData(0, 4) == True: + break + + tdLog.info("wait %d seconds for is sync"%count) + time.sleep(1) + + count += 1 + + if count == 100: + tdLog.exit("arbgroup sync failed") + return + + + tdSql.query("show db.vgroups;") + + if(tdSql.getData(0, 4) == "follower") and (tdSql.getData(0, 7) == "leader"): + tdLog.info("stop dnode2") + sc.dnodeStop(2) + + if(tdSql.getData(0, 7) == "follower") and (tdSql.getData(0, 4) == "leader"): + tdLog.info("stop dnode 3") + sc.dnodeStop(3) + + + count = 0 + while count < 11: + tdSql.query("show db.vgroups;") + + if(tdSql.getData(0, 4) == "assigned ") or (tdSql.getData(0, 7) == "assigned "): + break + + tdLog.info("wait %d seconds for set assigned"%count) + time.sleep(1) + + count += 1 + + if count == 11: + tdLog.exit("check assigned failed") + return + + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase())