From 8cd0cca31beb71d66b22e9d35ee35a3f8a488894 Mon Sep 17 00:00:00 2001 From: shuke987 Date: Mon, 15 Jun 2026 20:46:42 +0800 Subject: [PATCH] branch-4.1: [fix](case) fix mow compaction cases on multi-replica cluster The three nonConcurrent MOW compaction regression cases (test_mow_compaction_and_read_stale, test_mow_compaction_and_schema_change, test_mow_compaction_agg_and_remove_pre_delete_bitmap) asserted `assertEquals(1, tablets.size())`. `show tablets` returns one row per replica, so on clusters that materialize multiple replicas for the single bucket the assertion fails at table setup (expected: <1> but was: <3>) on the branch-4.1 NonConcurrent pipeline. Assert the real invariant instead -- exactly one distinct tablet (BUCKETS 1) -- by de-duplicating on TabletId, which is independent of replica count. The cases already operate on a single replica via tablets[0], so the downstream compaction / delete-bitmap inspection is unaffected. Related to apache/doris#58662, which relaxed the same check to `tablets.size() >= 1`; this uses a stricter distinct-tablet assertion. The same improvement will be proposed upstream so the branches reconverge. Co-Authored-By: Claude Opus 4.8 (1M context) --- ...mow_compaction_agg_and_remove_pre_delete_bitmap.groovy | 8 ++++++-- .../compaction/test_mow_compaction_and_read_stale.groovy | 4 +++- .../test_mow_compaction_and_schema_change.groovy | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy b/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy index 0c0fda5d1c2991..62167d545f6889 100644 --- a/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy +++ b/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy @@ -191,7 +191,9 @@ suite("test_mow_compaction_agg_and_remove_pre_delete_bitmap", "nonConcurrent") { def tablets = sql_return_maparray """ show tablets from ${testTable}; """ logger.info("tablets: " + tablets) - assertEquals(1, tablets.size()) + // BUCKETS 1 => exactly one tablet; the cluster may create multiple replicas, + // so show tablets returns one row per replica. Assert by distinct tablet id. + assertEquals(1, tablets.collect { it.TabletId }.unique().size()) def tablet = tablets[0] // 1. write some data @@ -278,7 +280,9 @@ suite("test_mow_compaction_agg_and_remove_pre_delete_bitmap", "nonConcurrent") { tablets = sql_return_maparray """ show tablets from ${testTable}; """ logger.info("tablets: " + tablets) - assertEquals(1, tablets.size()) + // BUCKETS 1 => exactly one tablet; the cluster may create multiple replicas, + // so show tablets returns one row per replica. Assert by distinct tablet id. + assertEquals(1, tablets.collect { it.TabletId }.unique().size()) tablet = tablets[0] // 1. write some data diff --git a/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy b/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy index bfd1a41cf36502..ef9047c3a1bdf5 100644 --- a/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy +++ b/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy @@ -203,7 +203,9 @@ suite("test_mow_compaction_and_read_stale", "nonConcurrent") { def tablets = sql_return_maparray """ show tablets from ${testTable}; """ logger.info("tablets: " + tablets) - assertEquals(1, tablets.size()) + // BUCKETS 1 => exactly one tablet; the cluster may create multiple replicas, + // so show tablets returns one row per replica. Assert by distinct tablet id. + assertEquals(1, tablets.collect { it.TabletId }.unique().size()) def tablet = tablets[0] String tablet_id = tablet.TabletId diff --git a/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy b/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy index 5c4dbbedd3fff5..b248c9370f46d1 100644 --- a/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy +++ b/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy @@ -216,7 +216,9 @@ suite("test_mow_compaction_and_schema_change", "nonConcurrent") { def tablets = sql_return_maparray """ show tablets from ${testTable}; """ logger.info("tablets: " + tablets) - assertEquals(1, tablets.size()) + // BUCKETS 1 => exactly one tablet; the cluster may create multiple replicas, + // so show tablets returns one row per replica. Assert by distinct tablet id. + assertEquals(1, tablets.collect { it.TabletId }.unique().size()) def tablet = tablets[0] // 1. write some data