Fix some ci errors.
This commit is contained in:
parent
5416e73203
commit
a6a8ddd043
|
@ -373,7 +373,7 @@ int32_t cfgGetAndSetItem(SConfig *pCfg, SConfigItem **pItem, const char *name, c
|
||||||
}
|
}
|
||||||
|
|
||||||
*pItem = cfgGetItem(pCfg, name);
|
*pItem = cfgGetItem(pCfg, name);
|
||||||
if (pItem == NULL) {
|
if (*pItem == NULL) {
|
||||||
(void)taosThreadMutexUnlock(&pCfg->lock);
|
(void)taosThreadMutexUnlock(&pCfg->lock);
|
||||||
TAOS_RETURN(TSDB_CODE_CFG_NOT_FOUND);
|
TAOS_RETURN(TSDB_CODE_CFG_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,202 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
import taos
|
||||||
|
import frame
|
||||||
|
import frame.etool
|
||||||
|
|
||||||
|
from frame.log import *
|
||||||
|
from frame.cases import *
|
||||||
|
from frame.sql import *
|
||||||
|
from frame.caseBase import *
|
||||||
|
from frame.epath import *
|
||||||
|
from frame.srvCtl import *
|
||||||
|
from frame import *
|
||||||
|
|
||||||
|
class ConfigParam:
|
||||||
|
def __init__(self, name, default_value, value_range, scope,category):
|
||||||
|
self.name = name
|
||||||
|
self.default_value = default_value
|
||||||
|
self.value_range = value_range
|
||||||
|
self.scope = scope
|
||||||
|
self.category = category
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase(TBase):
|
||||||
|
def alterCachemodel(self):
|
||||||
|
"""Add test case for altering cache model(TS-5390)
|
||||||
|
"""
|
||||||
|
# drop database if exists
|
||||||
|
tdSql.execute(f"drop database if exists db3590;")
|
||||||
|
# create database with cachemodel 'none'
|
||||||
|
tdSql.execute(f"create database db3590 vgroups 1 replica 1 cachemodel 'none';")
|
||||||
|
tdSql.execute("use db3590;")
|
||||||
|
tdSql.execute("create table ntb1 (ts timestamp, ival1 int);")
|
||||||
|
tdSql.execute("insert into ntb1 values(now, 1);")
|
||||||
|
tdSql.execute("flush database db3590;")
|
||||||
|
# alter table schema
|
||||||
|
tdSql.execute("alter table ntb1 add column ival2 int;")
|
||||||
|
tdSql.execute("insert into ntb1 values(now, 2, NULL);")
|
||||||
|
# alter table schema again
|
||||||
|
tdSql.execute("alter table ntb1 add column ival3 int;")
|
||||||
|
# alter database with cachemodel 'both‘
|
||||||
|
tdSql.execute("alter database db3590 cachemodel 'both';")
|
||||||
|
# wait for cachemodel avaiable
|
||||||
|
time.sleep(5)
|
||||||
|
tdSql.query("select last(*) from ntb1;")
|
||||||
|
|
||||||
|
def alterTtlConfig(self):
|
||||||
|
"""Add test case for altering ttl config
|
||||||
|
"""
|
||||||
|
db_name = "db"
|
||||||
|
tdSql.execute(f"create database {db_name};")
|
||||||
|
tdSql.execute(f"use {db_name};")
|
||||||
|
tdSql.execute("create table t1 (ts timestamp, a int);")
|
||||||
|
|
||||||
|
ttl_min_value = 0
|
||||||
|
ttl_max_value = 2147483647
|
||||||
|
# verify ttl min value
|
||||||
|
tdSql.execute(f"alter table t1 ttl {ttl_min_value}")
|
||||||
|
tdSql.query("select `ttl` from information_schema.ins_tables where table_name='t1' and db_name='db';")
|
||||||
|
tdSql.checkData(0, 0, ttl_min_value)
|
||||||
|
# verify ttl max value
|
||||||
|
tdSql.execute(f"alter table t1 ttl {ttl_max_value}")
|
||||||
|
tdSql.query("select `ttl` from information_schema.ins_tables where table_name='t1' and db_name='db';")
|
||||||
|
tdSql.checkData(0, 0, ttl_max_value)
|
||||||
|
# verify abnormal ttl value
|
||||||
|
tdSql.error(f"alter table t1 ttl {ttl_max_value + 1}", expectErrInfo="Value out of range")
|
||||||
|
tdSql.error(f"alter table t1 ttl {ttl_min_value - 1}", expectErrInfo="syntax error")
|
||||||
|
|
||||||
|
# TS-5291
|
||||||
|
tdSql.execute("create database db5291 vgroups 1;")
|
||||||
|
tdSql.execute("use db5291;")
|
||||||
|
tdSql.execute("create table ttltb1(ts timestamp, ival int) ttl 1;")
|
||||||
|
tdSql.execute("create table ttltb2(ts timestamp, ival int) ttl 1;")
|
||||||
|
tdSql.execute("drop table ttltb1;")
|
||||||
|
tdSql.execute("flush database db5291;")
|
||||||
|
tdSql.execute("drop table ttltb2;")
|
||||||
|
# restart taosd
|
||||||
|
sc.dnodeStopAll()
|
||||||
|
sc.dnodeStart(1)
|
||||||
|
sc.dnodeStart(2)
|
||||||
|
sc.dnodeStart(3)
|
||||||
|
tdSql.execute("flush database db5291;")
|
||||||
|
|
||||||
|
def alterSupportVnodes(self):
|
||||||
|
tdLog.info(f"test function of altering supportVnodes")
|
||||||
|
|
||||||
|
tdSql.execute("alter dnode 1 'supportVnodes' '128'")
|
||||||
|
time.sleep(1)
|
||||||
|
tdSql.query('show dnodes')
|
||||||
|
tdSql.checkData(0, 3, "128")
|
||||||
|
|
||||||
|
tdSql.execute("alter dnode 1 'supportVnodes' '64'")
|
||||||
|
time.sleep(1)
|
||||||
|
tdSql.query('show dnodes')
|
||||||
|
tdSql.checkData(0, 3, "64")
|
||||||
|
|
||||||
|
def checkKeyValue(self, res, key, value, ikey = 0, ival = 1):
|
||||||
|
result = False
|
||||||
|
for row in res:
|
||||||
|
if row[ikey] == key:
|
||||||
|
if row[ival] != value:
|
||||||
|
raise Exception(f"key:{key} value:{row[ival]} != {value}")
|
||||||
|
else:
|
||||||
|
tdLog.info(f"key:{key} value:{row[ival]} == {value}")
|
||||||
|
result = True
|
||||||
|
break
|
||||||
|
if not result:
|
||||||
|
raise Exception(f"key:{key} not found")
|
||||||
|
|
||||||
|
def checkRows(self, sql, nExpect, nRetry):
|
||||||
|
for i in range(nRetry):
|
||||||
|
res = tdSql.getResult(sql)
|
||||||
|
if len(res) == nExpect:
|
||||||
|
break
|
||||||
|
time.sleep(1)
|
||||||
|
if len(res) != nExpect:
|
||||||
|
raise Exception(f"rows:{len(res)} != {nExpect}")
|
||||||
|
|
||||||
|
def alterBypassFlag(self):
|
||||||
|
"""Add test case for altering bypassFlag(TD-32907)
|
||||||
|
"""
|
||||||
|
tdSql.execute(f"drop database if exists db")
|
||||||
|
tdSql.execute(f"create database db")
|
||||||
|
tdSql.execute("use db")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show local variables;"), "bypassFlag", "0")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "0", 1, 2)
|
||||||
|
tdSql.execute("alter local 'bypassFlag 1'")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show local variables;"), "bypassFlag", "1")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "0", 1, 2)
|
||||||
|
tdSql.execute("create table stb0(ts timestamp, c0 int) tags(t0 int)")
|
||||||
|
tdSql.execute("create table ctb0 using stb0 tags(0)")
|
||||||
|
tdSql.execute("insert into ctb0 values(now, 1)")
|
||||||
|
tdSql.query("select * from stb0")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.execute("alter local 'bypassFlag 0'")
|
||||||
|
tdSql.execute("alter all dnodes 'bypassFlag 2'")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show local variables"), "bypassFlag", "0")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "2", 1, 2)
|
||||||
|
tdSql.execute("insert into ctb0 values(now, 2)")
|
||||||
|
tdSql.query("select * from stb0")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.execute("alter all dnodes 'bypassFlag 4'")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "4", 1, 2)
|
||||||
|
tdSql.execute("insert into ctb0 values(now, 4)")
|
||||||
|
tdSql.execute("insert into ctb1 using stb0 tags(1) values(now, 10)")
|
||||||
|
tdSql.query("select * from stb0")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("show db.tables")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.execute("alter all dnodes 'bypassFlag 8'")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "8", 1, 2)
|
||||||
|
tdSql.execute("insert into ctb0 values(now, 8)")
|
||||||
|
tdSql.execute("insert into ctb1 values(now, 18)")
|
||||||
|
tdSql.query("select * from stb0")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.execute("flush database db")
|
||||||
|
self.checkRows("select * from stb0", 0, 10)
|
||||||
|
tdSql.execute("alter all dnodes 'bypassFlag 0'")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show local variables"), "bypassFlag", "0")
|
||||||
|
self.checkKeyValue(tdSql.getResult("show dnode 1 variables like 'bypassFlag'"), "bypassFlag", "0", 1, 2)
|
||||||
|
tdSql.execute("insert into ctb0 values(now, 80)")
|
||||||
|
tdSql.execute("insert into ctb1 values(now, 180)")
|
||||||
|
tdSql.query("select * from stb0")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.execute("flush database db")
|
||||||
|
for i in range(5):
|
||||||
|
self.checkRows("select * from stb0", 2, 1)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# run
|
||||||
|
def run(self):
|
||||||
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
|
||||||
|
# TS-4721
|
||||||
|
self.alterSupportVnodes()
|
||||||
|
# TS-5191
|
||||||
|
self.alterTtlConfig()
|
||||||
|
# TS-5390
|
||||||
|
self.alterCachemodel()
|
||||||
|
# TD-32907
|
||||||
|
self.alterBypassFlag()
|
||||||
|
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -5,10 +5,10 @@ sql connect
|
||||||
|
|
||||||
print ======== step1
|
print ======== step1
|
||||||
sql alter dnode 1 'resetlog'
|
sql alter dnode 1 'resetlog'
|
||||||
sql alter dnode 1 'monitor' '1'
|
sql alter all dnodes 'monitor' '1'
|
||||||
sql alter dnode 1 'monitor' '0'
|
sql alter all dnodes 'monitor' '0'
|
||||||
sql alter dnode 1 'monitor 1'
|
sql alter all dnodes 'monitor 1'
|
||||||
sql alter dnode 1 'monitor 0'
|
sql alter all dnodes 'monitor 0'
|
||||||
|
|
||||||
print ======== step2
|
print ======== step2
|
||||||
sql_error alter dnode 1 'resetquerycache'
|
sql_error alter dnode 1 'resetquerycache'
|
||||||
|
|
|
@ -26,22 +26,6 @@ class TDTestCase:
|
||||||
tdLog.debug(f"start to excute {__file__}")
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
tdSql.init(conn.cursor(), True)
|
tdSql.init(conn.cursor(), True)
|
||||||
|
|
||||||
def modifyMaxTopics(self, tmqMaxTopicNum):
|
|
||||||
# single dnode
|
|
||||||
cfgDir = tdDnodes.dnodes[0].cfgDir
|
|
||||||
|
|
||||||
# cluster dnodes
|
|
||||||
# tdDnodes[1].dataDir
|
|
||||||
# tdDnodes[1].logDir
|
|
||||||
# tdDnodes[1].cfgDir
|
|
||||||
|
|
||||||
cfgFile = f"%s/taos.cfg"%(cfgDir)
|
|
||||||
shellCmd = 'echo tmqMaxTopicNum %d >> %s'%(tmqMaxTopicNum, cfgFile)
|
|
||||||
tdLog.info(" shell cmd: %s"%(shellCmd))
|
|
||||||
os.system(shellCmd)
|
|
||||||
tdDnodes.stoptaosd(1)
|
|
||||||
tdDnodes.starttaosd(1)
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
def prepareTestEnv(self):
|
def prepareTestEnv(self):
|
||||||
tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
|
tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
|
||||||
|
@ -169,8 +153,9 @@ class TDTestCase:
|
||||||
# tdDnodes.starttaosd(1)
|
# tdDnodes.starttaosd(1)
|
||||||
# time.sleep(5)
|
# time.sleep(5)
|
||||||
|
|
||||||
newTmqMaxTopicNum = 22
|
alterSql = "alter all dnodes 'tmqMaxTopicNum' '22'"
|
||||||
self.modifyMaxTopics(newTmqMaxTopicNum)
|
tdLog.info("alter all dnodes 'tmqMaxTopicNum' '22'")
|
||||||
|
tdSql.execute(alterSql)
|
||||||
|
|
||||||
sqlString = "create topic %s%s as %s" %(topicNamePrefix, 'x', queryString)
|
sqlString = "create topic %s%s as %s" %(topicNamePrefix, 'x', queryString)
|
||||||
tdLog.info("create topic sql: %s"%sqlString)
|
tdLog.info("create topic sql: %s"%sqlString)
|
||||||
|
@ -190,8 +175,10 @@ class TDTestCase:
|
||||||
if topicNum != newTmqMaxTopicNum:
|
if topicNum != newTmqMaxTopicNum:
|
||||||
tdLog.exit("show topics %d not equal expect num: %d"%(topicNum, newTmqMaxTopicNum))
|
tdLog.exit("show topics %d not equal expect num: %d"%(topicNum, newTmqMaxTopicNum))
|
||||||
|
|
||||||
newTmqMaxTopicNum = 18
|
alterSql = "alter all dnodes 'tmqMaxTopicNum' '18'"
|
||||||
self.modifyMaxTopics(newTmqMaxTopicNum)
|
tdLog.info("alter all dnodes 'tmqMaxTopicNum' '18'")
|
||||||
|
tdSql.execute(alterSql)
|
||||||
|
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
sqlString = "drop topic %s%d" %(topicNamePrefix, i)
|
sqlString = "drop topic %s%d" %(topicNamePrefix, i)
|
||||||
|
|
Loading…
Reference in New Issue