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

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

commit ddb37d7371c56ee9bab04bbdc40aeaee679ad5d5
Author: Jibing-Li <[email protected]>
AuthorDate: Wed Feb 28 18:32:14 2024 +0800

    Fix analyze mv from follower case bug. (#31523)
---
 .../suites/statistics/test_analyze_mtmv.groovy     | 37 ++++++++++++++++------
 .../suites/statistics/test_analyze_mv.groovy       | 37 ++++++++++++++++------
 2 files changed, 56 insertions(+), 18 deletions(-)

diff --git a/regression-test/suites/statistics/test_analyze_mtmv.groovy 
b/regression-test/suites/statistics/test_analyze_mtmv.groovy
index d72c718d2aa..a3b49154673 100644
--- a/regression-test/suites/statistics/test_analyze_mtmv.groovy
+++ b/regression-test/suites/statistics/test_analyze_mtmv.groovy
@@ -17,16 +17,35 @@
 
 suite("test_analyze_mtmv") {
 
-    def wait_row_count_reported = { table, expected ->
-        for (int i = 0; i < 120; i++) {
-            Thread.sleep(5000)
-            def result = sql """SHOW DATA FROM ${table};"""
-            logger.info("result " + result)
-            if (result[0][4] == expected) {
-                return;
+    def wait_row_count_reported = { db, table, expected ->
+        def result = sql """show frontends;"""
+        logger.info("show frontends result origin: " + result)
+        def host
+        def port
+        for (int i = 0; i < result.size(); i++) {
+            if (result[i][8] == "true") {
+                host = result[i][1]
+                port = result[i][4]
             }
         }
-        throw new Exception("Row count report timeout.")
+        def tokens = context.config.jdbcUrl.split('/')
+        def url=tokens[0] + "//" + host + ":" + port
+        logger.info("Master url is " + url)
+        connect(user = context.config.jdbcUser, password = 
context.config.jdbcPassword, url) {
+            sql """use ${db}"""
+            result = sql """show frontends;"""
+            logger.info("show frontends result master: " + result)
+            for (int i = 0; i < 120; i++) {
+                Thread.sleep(5000)
+                result = sql """SHOW DATA FROM ${table};"""
+                logger.info("result " + result)
+                if (result[0][4] == expected) {
+                    return;
+                }
+            }
+            throw new Exception("Row count report timeout.")
+        }
+
     }
 
     sql """drop database if exists test_analyze_mtmv"""
@@ -267,7 +286,7 @@ suite("test_analyze_mtmv") {
     result_sample = sql """show column cached stats mv1(sum_total)"""
     assertEquals(0, result_sample.size())
 
-    wait_row_count_reported("mv1", "3")
+    wait_row_count_reported("test_analyze_mtmv", "mv1", "3")
     sql """analyze table mv1 with sync with sample rows 4000000"""
     result_sample = sql """show column stats mv1(l_shipdate)"""
     logger.info("result " + result_sample)
diff --git a/regression-test/suites/statistics/test_analyze_mv.groovy 
b/regression-test/suites/statistics/test_analyze_mv.groovy
index b433766b55d..5c60c902bf0 100644
--- a/regression-test/suites/statistics/test_analyze_mv.groovy
+++ b/regression-test/suites/statistics/test_analyze_mv.groovy
@@ -34,16 +34,35 @@ suite("test_analyze_mv") {
         }
     }
 
-    def wait_row_count_reported = { table, expected ->
-        for (int i = 0; i < 120; i++) {
-            Thread.sleep(5000)
-            def result = sql """SHOW DATA FROM ${table};"""
-            logger.info("result " + result)
-            if (result[3][4] == expected) {
-                return;
+    def wait_row_count_reported = { db, table, expected ->
+        def result = sql """show frontends;"""
+        logger.info("show frontends result origin: " + result)
+        def host
+        def port
+        for (int i = 0; i < result.size(); i++) {
+            if (result[i][8] == "true") {
+                host = result[i][1]
+                port = result[i][4]
             }
         }
-        throw new Exception("Row count report timeout.")
+        def tokens = context.config.jdbcUrl.split('/')
+        def url=tokens[0] + "//" + host + ":" + port
+        logger.info("Master url is " + url)
+        connect(user = context.config.jdbcUser, password = 
context.config.jdbcPassword, url) {
+            sql """use ${db}"""
+            result = sql """show frontends;"""
+            logger.info("show frontends result master: " + result)
+            for (int i = 0; i < 120; i++) {
+                Thread.sleep(5000)
+                result = sql """SHOW DATA FROM ${table};"""
+                logger.info("result " + result)
+                if (result[3][4] == expected) {
+                    return;
+                }
+            }
+            throw new Exception("Row count report timeout.")
+        }
+
     }
 
     def wait_analyze_finish = { table ->
@@ -340,7 +359,7 @@ suite("test_analyze_mv") {
     assertEquals(0, result_sample.size())
 
     // Test sample
-    wait_row_count_reported("mvTestDup", "6")
+    wait_row_count_reported("test_analyze_mv", "mvTestDup", "6")
     sql """analyze table mvTestDup with sample rows 4000000"""
     wait_analyze_finish("mvTestDup")
     result_sample = sql """SHOW ANALYZE mvTestDup;"""


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

Reply via email to