Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](regression test) test_alter_colocate_group due to force_olap_table_replication_num #35835

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions regression-test/suites/alter_p2/test_alter_colocate_group.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ suite ("test_alter_colocate_group") {
sql " DROP TABLE IF EXISTS tbl2 FORCE; "
sql " DROP TABLE IF EXISTS tbl3 FORCE; "

def replication_num = 1
def forceReplicaNum = getFeConfig('force_olap_table_replication_num').toInteger()
if (forceReplicaNum > 0) {
replication_num = forceReplicaNum
}

sql """
CREATE TABLE tbl1
(
Expand All @@ -68,7 +74,7 @@ suite ("test_alter_colocate_group") {
PROPERTIES
(
"colocate_with" = "group_1",
"replication_num" = "1"
"replication_num" = "${replication_num}"
);
"""

Expand All @@ -87,7 +93,7 @@ suite ("test_alter_colocate_group") {
PROPERTIES
(
"colocate_with" = "group_2",
"replication_num" = "1"
"replication_num" = "${replication_num}"
);
"""

Expand All @@ -103,13 +109,13 @@ suite ("test_alter_colocate_group") {
PROPERTIES
(
"colocate_with" = "group_3",
"replication_num" = "1",
"replication_num" = "${replication_num}",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.end" = "2",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "4",
"dynamic_partition.replication_num" = "1"
"dynamic_partition.replication_num" = "${replication_num}"
);
"""

Expand Down Expand Up @@ -140,6 +146,16 @@ suite ("test_alter_colocate_group") {
}
}

def beNum = sql_return_maparray("show backends").size()
def modifyReplicaNum = -1
for (int i=1; i <= beNum; i++) {
if (i != replication_num) {
modifyReplicaNum = i
break
}
}
logger.info("old replica num ${replication_num}, modify replica num ${modifyReplicaNum}")

for (int i = 1; i <= 3; i++) {
def groupName = "regression_test_alter_p2.group_${i}"
checkGroupsReplicaAlloc(groupName, 1)
Expand All @@ -157,15 +173,17 @@ suite ("test_alter_colocate_group") {
exception "Failed to find enough host"
}

test {
sql """
ALTER COLOCATE GROUP ${groupName}
SET ( "replication_num" = "3" );
"""
}
if (modifyReplicaNum > 0) {
test {
sql """
ALTER COLOCATE GROUP ${groupName}
SET ( "replication_num" = "${modifyReplicaNum}" );
"""
}

checkGroupsReplicaAlloc(groupName, 3)
checkTableReplicaAlloc(tableName, hasDynamicPart, 3)
checkGroupsReplicaAlloc(groupName, modifyReplicaNum)
checkTableReplicaAlloc(tableName, hasDynamicPart, modifyReplicaNum)
}
}

sql " DROP TABLE IF EXISTS tbl1 FORCE; "
Expand Down
Loading