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

morrySnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new c02047ee370 [fix](test) Fix flaky partition_curd_union_rewrite test in 
cloud mode (#62766)
c02047ee370 is described below

commit c02047ee3702e2c390920e727da5f5f5b2b635d8
Author: Hakan Uzum <[email protected]>
AuthorDate: Thu May 21 05:06:27 2026 +0300

    [fix](test) Fix flaky partition_curd_union_rewrite test in cloud mode 
(#62766)
    
    ### What problem does this PR solve?
    
    Related PR: #62599
    
    Problem Summary:
    The `partition_curd_union_rewrite` test intermittently fails in
    `cloud_p0` CI because `mv_rewrite_success` calls after data
    modifications (insert/delete) do not pass
    `is_partition_statistics_ready`. Without this check, the function
    defaults to `true` and asserts that CBO chose the MV. In cloud mode,
    partition statistics propagation can be slower, so CBO may not select
    the MV, causing the test to fail.
    
    The first two `mv_rewrite_success` calls (before any DML) already pass
    `is_partition_statistics_ready` correctly. This fix applies the same
    pattern to the remaining six calls that follow insert/delete operations.
    
    **Observed failures:**
    - PR #62599 — cloud_p0 ❌
    - PR #62762 — cloud_p0 ❌
---
 .../partition_curd_union_rewrite.groovy            | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git 
a/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy
 
b/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy
index 2c6a383d6de..43c90c0df89 100644
--- 
a/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy
+++ 
b/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy
@@ -193,11 +193,13 @@ suite ("partition_curd_union_rewrite") {
     insert into lineitem values 
     (1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-10-17', '2023-10-17', 
'2023-10-17', 'a', 'b', 'yyyyyyyyy');
     """
-    // wait partition is invalid
-    sleep(5000)
-    mv_rewrite_success(all_partition_sql, mv_name)
+    // wait partition is invalid — use deterministic wait instead of fixed 
sleep
+    waitingPartitionIsExpected(mv_name, "p_20231017_20231018", false)
+    mv_rewrite_success(all_partition_sql, mv_name,
+            is_partition_statistics_ready(db, ["lineitem", "orders", mv_name]))
     compare_res(all_partition_sql + order_by_stmt)
-    mv_rewrite_success(partition_sql, mv_name)
+    mv_rewrite_success(partition_sql, mv_name,
+            is_partition_statistics_ready(db, ["lineitem", "orders", mv_name]))
     compare_res(partition_sql + order_by_stmt)
 
     sql "REFRESH MATERIALIZED VIEW ${mv_name} AUTO"
@@ -207,11 +209,13 @@ suite ("partition_curd_union_rewrite") {
     insert into lineitem values 
     (1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-10-21', '2023-10-21', 
'2023-10-21', 'a', 'b', 'yyyyyyyyy');
     """
-    // Wait partition is invalid
-    sleep(5000)
-    mv_rewrite_success(all_partition_sql, mv_name)
+    // Wait partition is invalid — use deterministic wait instead of fixed 
sleep
+    waitingPartitionIsExpected(mv_name, "p_20231021_20231022", false)
+    mv_rewrite_success(all_partition_sql, mv_name,
+            is_partition_statistics_ready(db, ["lineitem", "orders", mv_name]))
     compare_res(all_partition_sql + order_by_stmt)
-    mv_rewrite_success(partition_sql, mv_name)
+    mv_rewrite_success(partition_sql, mv_name,
+            is_partition_statistics_ready(db, ["lineitem", "orders", mv_name]))
     compare_res(partition_sql + order_by_stmt)
 
     // Test when base table delete partition test
@@ -219,10 +223,12 @@ suite ("partition_curd_union_rewrite") {
     waitingMTMVTaskFinished(getJobName(db, mv_name))
     sql """ ALTER TABLE lineitem DROP PARTITION IF EXISTS p_20231021 FORCE;
     """
-    // Wait partition is invalid
-    sleep(3000)
-    mv_rewrite_success(all_partition_sql, mv_name)
+    // Wait partition is invalid — use deterministic wait instead of fixed 
sleep
+    waitingPartitionIsExpected(mv_name, "p_20231021_20231022", false)
+    mv_rewrite_success(all_partition_sql, mv_name,
+            is_partition_statistics_ready(db, ["lineitem", "orders", mv_name]))
     compare_res(all_partition_sql + order_by_stmt)
-    mv_rewrite_success(partition_sql, mv_name)
+    mv_rewrite_success(partition_sql, mv_name,
+            is_partition_statistics_ready(db, ["lineitem", "orders", mv_name]))
     compare_res(partition_sql + order_by_stmt)
 }


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

Reply via email to