This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 6d8377653d6 [fix](regression test) test_alter_colocate_group due to 
force_olap_table_replication_num #35835 (#38092)
6d8377653d6 is described below

commit 6d8377653d602b3f1e78d863c1d3fbbc25ba28af
Author: yujun <[email protected]>
AuthorDate: Thu Jul 18 22:33:02 2024 +0800

    [fix](regression test) test_alter_colocate_group due to 
force_olap_table_replication_num #35835 (#38092)
    
    cherry pick from #35835
---
 .../alter_p2/test_alter_colocate_group.groovy      | 42 +++++++++++++++-------
 1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/regression-test/suites/alter_p2/test_alter_colocate_group.groovy 
b/regression-test/suites/alter_p2/test_alter_colocate_group.groovy
index 47c9e6402ee..e90165f928f 100644
--- a/regression-test/suites/alter_p2/test_alter_colocate_group.groovy
+++ b/regression-test/suites/alter_p2/test_alter_colocate_group.groovy
@@ -54,6 +54,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
         (
@@ -64,7 +70,7 @@ suite ("test_alter_colocate_group") {
         PROPERTIES
         (
             "colocate_with" = "group_1",
-            "replication_num" = "1"
+            "replication_num" = "${replication_num}"
         );
     """
 
@@ -83,7 +89,7 @@ suite ("test_alter_colocate_group") {
         PROPERTIES
         (
             "colocate_with" = "group_2",
-            "replication_num" = "1"
+            "replication_num" = "${replication_num}"
         );
     """
 
@@ -99,13 +105,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}"
          );
     """
 
@@ -136,6 +142,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, replication_num)
@@ -153,15 +169,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; "


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to