mirror of
https://github.com/taosdata/TDengine
synced 2026-05-24 10:09:01 +00:00
* feat(mqtt): Initial commit for mqtt
* chore(xnode/mnd): xnode message handlers for mnode
* chore(mnd/xnode): mnode part for xnode
* chore(xnode/translater): fix show commands
* fix(ast/creater): fix xnode create option
* fix(xnode/ci): fix ci & doc's error codes
* chore(xnode/sql): make create/drop/show work properly
* fix(xnode/sql): commit new files
* fix(xnode/sql): commit cmake files
* fix: fix testing cases
* fix(xnode/tsc): fix tokens
* fix(ast/anode): fix anode update decl.
* fix(xnode/error): fix xnode error codes
* fix: xnode make/destroy
* chore: xnode with option & dnode id
* chore: use taosmqtt for xnode
* chore: new error code for xnode launching
* chore(xnode): new error code
* chore: header for _xnode_mgmt_mqtt
* chore: source for _xnode_mgmt_mqtt
* chore: remove test directory from cmake
* chore: remove taosmqtt for ci to compile
* chore: remove taosudf header from xnode
* chore: new window macro
* chore: remove xnode mgmt mqtt for windows compilation
* Revert "chore: remove xnode mgmt mqtt for windows compilation"
This reverts commit 197e1640c7.
* chore: cleanup code
* chore: xnode mgmt comment windows part out
* chore: mgmt/mqtt, move uv head toppest
* xnode/mnode: create xnode once per dnode
* fix(xnode/systable/test): fix column count
* xnode/sdb: renumber sdb type for xnode to make start/stop order correct
* xnode/mqtt: new param mqttPort
* fix SXnode's struct type
* transfer dnode id to mqtt subscription
* tmqtt: remove uv_a linking
* tmqtt/tools: sources for tools
* tools: fix windows compilation
* tools/producer: fix windows sleep param
* tools/producer: fix uninited var rc
* make tools only for linux
* test/mnodes: wail 1 or 2 seconds for offline to be leader
* update topic producer tool for geometry data type testing
* format tool sql statements
* show xnodes' ep
* make shell auto complete xnodes
* use usleep instead of sleep
* mqtt/proto: first version mqtt protocol
* remove assert styles
* build with linux only
* fix libuv for taosmqtt building
* fix log printing
* mem: use ttq_ prefix instead of tmqtt
* xnode/parser/proto: protocol option for xnode
* xnode/translater/option: translate xnode option proto
* xnode/translator: translate proto param
* xnode/tmsg: encode/decode proto param
* xnode/mnode: proto parma for mndXnode
* xnode/proto: protocol param for xnode
* xnode/mqtt: save/load proto from xnode json
* rename tmqtt proto header
* rename head directories
* rename header name styles
* restyle func names
* update
* update
* use camel db
* use camel for cxt
* update count of information_schema
* fix exceptional cases
* fix w.r.t reviews
* fixes w.r.t reviews
* use ttq_free
* append xnode msgs
* update information schema count
* support tmq meta data sub
* success typo fix
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix error line var w.r.t. suggestions from copilot
* denote mqtt node with bnode instead of xnode
* smoke testing for mqtt
* soak testing
* new package for test framework: paho 2.1.0
* import mqtt into util
* fix soak testing
* test/soak: user 5 topics per client
* test/soak: cover qos
* update docker image references to tdengine-ci:0.1 in CI scripts and common.py
* refactor: rename bnode msg to backup node
* refactor: rename xnode to bnode 1
* refactor: rename xnode to bnode 2
* refactor: rename xnode to bnode 3
* refactor: rename xnode to bnode 4
* refactor: rename xnode to bnode 4
* refactor: rename xnode to bnode 5
* refactor: rename xnode to bnode 6
* refactor: rename some files 1
* refactor: rename some files 2
* refactor: rename some files 3
* refactor: rename some files 4
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: chenhaoran <haoran920c@163.com>
Co-authored-by: Simon Guan <guanshengliang@qq.com>
198 lines
6.9 KiB
Python
198 lines
6.9 KiB
Python
import taos
|
|
import sys
|
|
import datetime
|
|
import inspect
|
|
import threading
|
|
|
|
from util.log import *
|
|
from util.sql import *
|
|
from util.cases import *
|
|
from util.common import tdCom
|
|
import random
|
|
|
|
|
|
class TDTestCase:
|
|
|
|
def init(self, conn, logSql, replicaVar=1):
|
|
self.replicaVar = int(replicaVar)
|
|
tdLog.debug(f"start to excute {__file__}")
|
|
tdSql.init(conn.cursor(), True)
|
|
|
|
def case1(self):
|
|
tdSql.execute("create database if not exists dbms precision 'ms'")
|
|
tdSql.execute("create database if not exists dbus precision 'us'")
|
|
tdSql.execute("create database if not exists dbns precision 'ns'")
|
|
|
|
tdSql.execute("create table dbms.ntb (ts timestamp, c1 int, c2 bigint)")
|
|
tdSql.execute("create table dbus.ntb (ts timestamp, c1 int, c2 bigint)")
|
|
tdSql.execute("create table dbns.ntb (ts timestamp, c1 int, c2 bigint)")
|
|
|
|
tdSql.execute("insert into dbms.ntb values ('2022-01-01 08:00:00.001', 1, 2)")
|
|
tdSql.execute("insert into dbms.ntb values ('2022-01-01 08:00:00.002', 3, 4)")
|
|
|
|
tdSql.execute("insert into dbus.ntb values ('2022-01-01 08:00:00.000001', 1, 2)")
|
|
tdSql.execute("insert into dbus.ntb values ('2022-01-01 08:00:00.000002', 3, 4)")
|
|
|
|
tdSql.execute("insert into dbns.ntb values ('2022-01-01 08:00:00.000000001', 1, 2)")
|
|
tdSql.execute("insert into dbns.ntb values ('2022-01-01 08:00:00.000000002', 3, 4)")
|
|
|
|
tdSql.query("select count(c1) from dbms.ntb interval(1a)")
|
|
tdSql.checkRows(2)
|
|
|
|
tdSql.query("select count(c1) from dbus.ntb interval(1u)")
|
|
tdSql.checkRows(2)
|
|
|
|
tdSql.query("select count(c1) from dbns.ntb interval(1b)")
|
|
tdSql.checkRows(2)
|
|
|
|
def case2(self):
|
|
|
|
tdSql.query("show variables")
|
|
tdSql.checkGreater(tdSql.getRows(), 80)
|
|
|
|
for i in range(self.replicaVar):
|
|
tdSql.query("show dnode %d variables like 'debugFlag'" % (i + 1))
|
|
tdSql.checkRows(1)
|
|
tdSql.checkData(0, 0, i + 1)
|
|
tdSql.checkData(0, 1, 'debugFlag')
|
|
tdSql.checkData(0, 2, 0)
|
|
|
|
tdSql.query("show dnode 1 variables like '%debugFlag'")
|
|
tdSql.checkRows(26)
|
|
|
|
tdSql.query("show dnode 1 variables like '____debugFlag'")
|
|
tdSql.checkRows(2)
|
|
|
|
tdSql.query("show dnode 1 variables like 's3MigrateEnab%'")
|
|
tdSql.checkRows(1)
|
|
tdSql.checkData(0, 0, 1)
|
|
tdSql.checkData(0, 1, 's3MigrateEnabled')
|
|
tdSql.checkData(0, 2, 0)
|
|
|
|
tdSql.query("show dnode 1 variables like 's3MigrateIntervalSec%'")
|
|
tdSql.checkRows(1)
|
|
tdSql.checkData(0, 0, 1)
|
|
tdSql.checkData(0, 1, 's3MigrateIntervalSec')
|
|
tdSql.checkData(0, 2, 3600)
|
|
|
|
tdSql.query("show dnode 1 variables like 's3PageCacheSize%'")
|
|
tdSql.checkRows(1)
|
|
tdSql.checkData(0, 0, 1)
|
|
tdSql.checkData(0, 1, 's3PageCacheSize')
|
|
tdSql.checkData(0, 2, 4096)
|
|
|
|
tdSql.query("show dnode 1 variables like 's3UploadDelaySec%'")
|
|
tdSql.checkRows(1)
|
|
tdSql.checkData(0, 0, 1)
|
|
tdSql.checkData(0, 1, 's3UploadDelaySec')
|
|
tdSql.checkData(0, 2, 60)
|
|
|
|
def show_local_variables_like(self):
|
|
tdSql.query("show local variables")
|
|
tdSql.checkGreater(tdSql.getRows(), 80)
|
|
|
|
tdSql.query("show local variables like 'debugFlag'")
|
|
tdSql.checkRows(1)
|
|
tdSql.checkData(0, 0, 'debugFlag')
|
|
# tdSql.checkData(0, 1, 0)
|
|
|
|
tdSql.query("show local variables like '%debugFlag'")
|
|
tdSql.checkRows(9)
|
|
|
|
tdSql.query("show local variables like '____debugFlag'")
|
|
tdSql.checkRows(0)
|
|
|
|
tdSql.query("show local variables like 's3MigrateEnab%'")
|
|
tdSql.checkRows(0)
|
|
|
|
tdSql.query("show local variables like 'mini%'")
|
|
tdSql.checkRows(3)
|
|
tdSql.checkData(0, 0, 'minimalTmpDirGB')
|
|
|
|
tdSql.query("show local variables like '%info'")
|
|
tdSql.checkRows(2)
|
|
|
|
def show_cluster_variables_like(self):
|
|
zones = ["", "cluster"]
|
|
for zone in zones:
|
|
tdLog.info(f"show {zone} variables")
|
|
tdSql.query(f"show {zone} variables")
|
|
tdSql.checkGreater(tdSql.getRows(), 80)
|
|
|
|
tdLog.info(f"show {zone} variables like 'debugFlag'")
|
|
#tdSql.query(f"show {zone} variables like 'debugFlag'")
|
|
#tdSql.checkRows(0)
|
|
|
|
tdSql.query(f"show {zone} variables like 's3%'")
|
|
tdSql.checkRows(6)
|
|
|
|
tdSql.query(f"show {zone} variables like 'Max%'")
|
|
tdSql.checkRows(3)
|
|
|
|
tdSql.query(f"show {zone} variables like 'ttl%'")
|
|
tdSql.checkRows(5)
|
|
|
|
tdSql.query(f"show {zone} variables like 'ttl34343434%'")
|
|
tdSql.checkRows(0)
|
|
|
|
tdSql.query(f"show {zone} variables like 'jdlkfdjdfkdfnldlfdnfkdkfdmfdlfmnnnnnjkjk'")
|
|
tdSql.checkRows(0)
|
|
|
|
|
|
def threadTest(self, threadID):
|
|
print(f"Thread {threadID} starting...")
|
|
tdsqln = tdCom.newTdSql()
|
|
for i in range(100):
|
|
tdsqln.query(f"desc db1.stb_1")
|
|
tdsqln.checkRows(3)
|
|
|
|
print(f"Thread {threadID} finished.")
|
|
|
|
def case3(self):
|
|
tdSql.execute("create database db1")
|
|
tdSql.execute("create table db1.stb (ts timestamp, c1 varchar(100)) tags(t1 int)")
|
|
tdSql.execute("create table db1.stb_1 using db1.stb tags(1)")
|
|
|
|
threads = []
|
|
for i in range(10):
|
|
t = threading.Thread(target=self.threadTest, args=(i,))
|
|
threads.append(t)
|
|
t.start()
|
|
|
|
for thread in threads:
|
|
print(f"Thread waitting for finish...")
|
|
thread.join()
|
|
|
|
print(f"Mutithread test finished.")
|
|
|
|
|
|
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
|
tdSql.prepare(replica = self.replicaVar)
|
|
|
|
tdLog.printNoPrefix("==========start case1 run ...............")
|
|
self.case1()
|
|
tdLog.printNoPrefix("==========end case1 run ...............")
|
|
|
|
tdLog.printNoPrefix("==========start case2 run ...............")
|
|
self.case2()
|
|
tdLog.printNoPrefix("==========end case2 run ...............")
|
|
|
|
tdLog.printNoPrefix("==========start case3 run ...............")
|
|
self.case3()
|
|
tdLog.printNoPrefix("==========end case3 run ...............")
|
|
|
|
tdLog.printNoPrefix("==========start show_local_variables_like run ...............")
|
|
self.show_local_variables_like()
|
|
tdLog.printNoPrefix("==========end show_local_variables_like run ...............")
|
|
|
|
tdLog.printNoPrefix("==========start show_cluster_variables_like run ...............")
|
|
self.show_cluster_variables_like()
|
|
tdLog.printNoPrefix("==========end show_cluster_variables_like run ...............")
|
|
|
|
def stop(self):
|
|
tdSql.close()
|
|
tdLog.success(f"{__file__} successfully executed")
|
|
|
|
|
|
tdCases.addLinux(__file__, TDTestCase())
|
|
tdCases.addWindows(__file__, TDTestCase())
|