enh(TS-6867): add test case (#32976)

This commit is contained in:
dongming chen 2025-09-15 15:04:17 +08:00 committed by GitHub
parent 696f0b171c
commit cf1fcd0243
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 139 additions and 2 deletions

View file

@ -47,7 +47,6 @@ database_option: {
- VGROUPS: The number of initial vgroups in the database.
- PRECISION: The timestamp precision of the database. ms for milliseconds, us for microseconds, ns for nanoseconds, default is ms.
- REPLICA: Indicates the number of database replicas, which can be 1, 2, or 3, default is 1; 2 is only available in the enterprise version 3.3.0.0 and later. In a cluster, the number of replicas must be less than or equal to the number of DNODEs. The following restrictions apply:
- Operations such as SPLIT VGROUP or REDISTRIBUTE VGROUP are not supported for databases with double replicas.
- A single-replica database can be changed to a double-replica database, but changing from double replicas to other numbers of replicas, or from three replicas to double replicas is not supported.
- BUFFER: The size of the memory pool for writing into a VNODE, in MB, default is 256, minimum is 3, maximum is 16384.
- PAGES: The number of cache pages in a VNODE's metadata storage engine, default is 256, minimum 64. A VNODE's metadata storage occupies PAGESIZE * PAGES, which by default is 1MB of memory.

View file

@ -64,7 +64,6 @@ database_option: {
表示数据库副本数,取值为 1、2 或 3默认为 1; 2 仅在**企业版支持**。在集群中使用时,副本数必须小于或等于 DNODE 的数目。且使用时存在以下限制:
- 暂不支持对双副本数据库相关 Vgroup 进行 SPLIT VGROUP 或 REDISTRIBUTE VGROUP 操作
- 单副本数据库可变更为双副本数据库,但不支持从双副本变更为其它副本数,也不支持从三副本变更为双副本。
#### BUFFER

View file

@ -0,0 +1,87 @@
import time
from new_test_framework.utils import tdLog, tdSql, sc, clusterComCheck, clusterComCheck
class TestRedistributeVgroupReplica2:
def setup_class(cls):
tdLog.debug(f"start to execute {__file__}")
def test_redistribute_vgroup_replica2(self):
"""RDST: replica-2
1. Start a 3-dnode cluster with supportVnodes=0 on dnode1
2. Create database d1 (1 vgroup, replica 2) and insert data
3. Add dnode3 and dnode4 to the cluster
4. Execute REDISTRIBUTE VGROUP to move the vnode to dnode4 dnode5; verify distribution & data integrity
5. Execute REDISTRIBUTE VGROUP to move the vnode to dnode2 dnode3; verify distribution & data integrity
Since: v3.3.7.0
Labels: common,ci
Jira: None
History:
- 2025-9-2 Dongming Chen Initial version
"""
clusterComCheck.checkDnodes(5)
tdSql.execute(f"alter dnode 1 'supportVnodes' '0'")
clusterComCheck.checkDnodeSupportVnodes(1, 0)
sc.dnodeStop(4)
sc.dnodeStop(5)
clusterComCheck.checkDnodes(3)
tdLog.info(f"=============== step1 create dnode2")
tdSql.query(f"select * from information_schema.ins_dnodes")
tdSql.checkRows(5)
tdSql.checkKeyData(1, 4, "ready")
tdSql.checkKeyData(2, 4, "ready")
tdSql.checkKeyData(3, 4, "ready")
tdLog.info(f"=============== step2: create db")
tdSql.execute(f"create database d1 vgroups 1 replica 2")
sc.dnodeStart(4)
sc.dnodeStart(5)
clusterComCheck.checkDnodes(5)
tdSql.query(f"select * from information_schema.ins_dnodes")
tdSql.checkRows(5)
tdSql.checkKeyData(1, 4, "ready")
tdSql.checkKeyData(2, 4, "ready")
tdSql.checkKeyData(3, 4, "ready")
tdSql.checkKeyData(4, 4, "ready")
tdSql.checkKeyData(5, 4, "ready")
tdLog.info(f"=============== step3: create table")
tdSql.execute(f"use d1")
tdSql.execute(f"create table d1.st (ts timestamp, i int) tags (j int)")
tdSql.execute(f"create table d1.c1 using st tags(1)")
tdSql.query(f"show d1.tables")
tdSql.checkRows(1)
tdLog.info(f"=============== step40:")
tdLog.info(f"redistribute vgroup 2 dnode 4 dnode 5")
tdSql.execute(f"redistribute vgroup 2 dnode 4 dnode 5")
tdSql.query(f"show d1.vgroups")
tdLog.info(
f"===> {tdSql.getData(0,0)} {tdSql.getData(0,1)} {tdSql.getData(0,2)} {tdSql.getData(0,3)} {tdSql.getData(0,4)} {tdSql.getData(0,5)} {tdSql.getData(0,6)} {tdSql.getData(0,7)} {tdSql.getData(0,8)} {tdSql.getData(0,9)}"
)
tdSql.query(f"show d1.tables")
tdSql.checkRows(1)
tdLog.info(f"=============== step41:")
tdLog.info(f"redistribute vgroup 2 dnode 2 dnode 3")
tdSql.execute(f"redistribute vgroup 2 dnode 2 dnode 3")
tdSql.query(f"show d1.vgroups")
tdLog.info(
f"===> {tdSql.getData(0,0)} {tdSql.getData(0,1)} {tdSql.getData(0,2)} {tdSql.getData(0,3)} {tdSql.getData(0,4)} {tdSql.getData(0,5)} {tdSql.getData(0,6)} {tdSql.getData(0,7)} {tdSql.getData(0,8)} {tdSql.getData(0,9)}"
)
tdSql.query(f"show d1.tables")
tdSql.checkRows(1)

View file

@ -0,0 +1,50 @@
import time
from new_test_framework.utils import tdLog, tdSql, sc, clusterComCheck, clusterComCheck
class TestSplitVgroupReplica2:
def setup_class(cls):
tdLog.debug(f"start to execute {__file__}")
def test_split_vgroup_replica2(self):
"""Split: replica-2
1. Start a 4-node cluster with dnode1 configured as supportVnodes=0
2. Create database d1 (1 vgroup, 2 replicas) and insert data
3. Execute SPLIT VGROUP to split the vnode
Catalog:
- Database:Sync
Since: v3.3.7.0
Labels: common,ci
Jira: None
History:
- 2025-9-4 Dongming Chen init
"""
clusterComCheck.checkDnodes(4)
tdSql.execute(f"alter dnode 1 'supportVnodes' '0'")
clusterComCheck.checkDnodeSupportVnodes(1, 0)
tdSql.execute(f"create user u1 pass 'taosdata'")
tdLog.info(f"=============== step1 check dnodes")
tdSql.query(f"select * from information_schema.ins_dnodes")
tdSql.checkRows(4)
tdSql.checkKeyData(1, 4, "ready")
tdSql.checkKeyData(2, 4, "ready")
tdSql.checkKeyData(3, 4, "ready")
tdSql.checkKeyData(4, 4, "ready")
tdLog.info(f"=============== step2: create db")
tdSql.execute(f"create database d1 vgroups 1 replica 2")
tdLog.info(f"=============== step3: split")
tdLog.info(f"split vgroup 2")
tdSql.execute("split vgroup 2")

View file

@ -69,11 +69,13 @@
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_balance3.py -N 6 -C 4
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_balancex.py -N 4 -C 1
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_redistribute_vgroup_replica1.py -N 4
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_redistribute_vgroup_replica2.py -N 5
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_redistribute_vgroup_replica3_v1_follower.py -N 5
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_redistribute_vgroup_replica3_v1_leader.py -N 5
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_redistribute_vgroup_replica3_v2.py -N 6
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_redistribute_vgroup_replica3_v3.py -N 8
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_split_vgroup_replica1.py -N 3
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_split_vgroup_replica2.py -N 4
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_split_vgroup_replica3.py -N 4
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_stable_balance_replica1.py -N 2
,,y,.,./ci/pytest.sh pytest cases/02-Databases/05-Sync/test_stable_dnode2.py -N 2