This is an automated email from the ASF dual-hosted git repository.
hello-stephen 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 35f98129184 [fix](regression) Support forced replica golden in show
create case (#65543)
35f98129184 is described below
commit 35f981291847a4a52c4bfa9e756ab49e494b8183
Author: shuke <[email protected]>
AuthorDate: Wed Jul 15 20:56:19 2026 +0800
[fix](regression) Support forced replica golden in show create case (#65543)
`test_show_create_table_and_views_nereids` creates OLAP tables with
`replication_num=1` and compares the complete `SHOW CREATE TABLE` result
with a static golden. In test environments configured with
`force_olap_table_replication_num=3`, Doris correctly rewrites the
effective allocation to three replicas, but the case still expects one
replica and fails before reaching the remaining view, rollup, and CREATE
LIKE checks.
This change reads the effective forced replica configuration and selects
a complete replica-specific golden for the four table-level `SHOW CREATE
TABLE` checks. Both the one-replica and three-replica variants retain
the full DDL comparison; unsupported forced replica values fail
explicitly instead of weakening the assertion.
---
.../test_show_create_table_and_views_nereids.out | 20 +++++++++++++----
...test_show_create_table_and_views_nereids.groovy | 26 +++++++++++++++++-----
2 files changed, 37 insertions(+), 9 deletions(-)
diff --git
a/regression-test/data/show_p0/test_show_create_table_and_views_nereids.out
b/regression-test/data/show_p0/test_show_create_table_and_views_nereids.out
index b0efcf1d5b6..ba759342923 100644
--- a/regression-test/data/show_p0/test_show_create_table_and_views_nereids.out
+++ b/regression-test/data/show_p0/test_show_create_table_and_views_nereids.out
@@ -1,7 +1,10 @@
-- This file is automatically generated. You should know what you did if you
want to edit this
--- !show --
+-- !show_initial_replica_1 --
show_create_table_and_views_nereids_table CREATE TABLE
`show_create_table_and_views_nereids_table` (\n `user_id` largeint NOT NULL,\n
`good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT "0",\n INDEX
index_user_id (`user_id`) USING INVERTED COMMENT "test index comment",\n INDEX
index_good_id (`good_id`) USING INVERTED COMMENT "test index\\" comment"\n)
ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY
RANGE(`good_id`)\n(PARTITION p1 VALUES [("-17014118346046923 [...]
+-- !show_initial_replica_3 --
+show_create_table_and_views_nereids_table CREATE TABLE
`show_create_table_and_views_nereids_table` (\n `user_id` largeint NOT NULL,\n
`good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT "0",\n INDEX
index_user_id (`user_id`) USING INVERTED COMMENT "test index comment",\n INDEX
index_good_id (`good_id`) USING INVERTED COMMENT "test index\\" comment"\n)
ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY
RANGE(`good_id`)\n(PARTITION p1 VALUES [("-17014118346046923 [...]
+
-- !select --
1 1 30
1 2 5
@@ -35,11 +38,20 @@ show_create_table_and_views_nereids_view CREATE VIEW
`show_create_table_and_view
200 1
300 1
--- !show --
+-- !show_after_rollup_replica_1 --
show_create_table_and_views_nereids_table CREATE TABLE
`show_create_table_and_views_nereids_table` (\n `user_id` largeint NOT NULL,\n
`good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT "0",\n INDEX
index_user_id (`user_id`) USING INVERTED COMMENT "test index comment",\n INDEX
index_good_id (`good_id`) USING INVERTED COMMENT "test index\\" comment"\n)
ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY
RANGE(`good_id`)\n(PARTITION p1 VALUES [("-17014118346046923 [...]
--- !show --
+-- !show_after_rollup_replica_3 --
+show_create_table_and_views_nereids_table CREATE TABLE
`show_create_table_and_views_nereids_table` (\n `user_id` largeint NOT NULL,\n
`good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT "0",\n INDEX
index_user_id (`user_id`) USING INVERTED COMMENT "test index comment",\n INDEX
index_good_id (`good_id`) USING INVERTED COMMENT "test index\\" comment"\n)
ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY
RANGE(`good_id`)\n(PARTITION p1 VALUES [("-17014118346046923 [...]
+
+-- !show_like_replica_1 --
show_create_table_and_views_nereids_like CREATE TABLE
`show_create_table_and_views_nereids_like` (\n `user_id` largeint NOT NULL,\n
`good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT "0",\n INDEX
index_user_id (`user_id`) USING INVERTED COMMENT "test index comment",\n INDEX
index_good_id (`good_id`) USING INVERTED COMMENT "test index\\" comment"\n)
ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY
RANGE(`good_id`)\n(PARTITION p1 VALUES [("-1701411834604692317 [...]
--- !show --
+-- !show_like_replica_3 --
+show_create_table_and_views_nereids_like CREATE TABLE
`show_create_table_and_views_nereids_like` (\n `user_id` largeint NOT NULL,\n
`good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT "0",\n INDEX
index_user_id (`user_id`) USING INVERTED COMMENT "test index comment",\n INDEX
index_good_id (`good_id`) USING INVERTED COMMENT "test index\\" comment"\n)
ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY
RANGE(`good_id`)\n(PARTITION p1 VALUES [("-1701411834604692317 [...]
+
+-- !show_like_with_rollup_replica_1 --
show_create_table_and_views_nereids_like_with_rollup CREATE TABLE
`show_create_table_and_views_nereids_like_with_rollup` (\n `user_id` largeint
NOT NULL,\n `good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT
"0",\n INDEX index_user_id (`user_id`) USING INVERTED COMMENT "test index
comment",\n INDEX index_good_id (`good_id`) USING INVERTED COMMENT "test
index\\" comment"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`,
`good_id`)\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [...]
+
+-- !show_like_with_rollup_replica_3 --
+show_create_table_and_views_nereids_like_with_rollup CREATE TABLE
`show_create_table_and_views_nereids_like_with_rollup` (\n `user_id` largeint
NOT NULL,\n `good_id` largeint NOT NULL,\n `cost` bigint SUM NULL DEFAULT
"0",\n INDEX index_user_id (`user_id`) USING INVERTED COMMENT "test index
comment",\n INDEX index_good_id (`good_id`) USING INVERTED COMMENT "test
index\\" comment"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`,
`good_id`)\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [...]
diff --git
a/regression-test/suites/show_p0/test_show_create_table_and_views_nereids.groovy
b/regression-test/suites/show_p0/test_show_create_table_and_views_nereids.groovy
index 8f5297bfa29..97f2c59ee8c 100644
---
a/regression-test/suites/show_p0/test_show_create_table_and_views_nereids.groovy
+++
b/regression-test/suites/show_p0/test_show_create_table_and_views_nereids.groovy
@@ -50,6 +50,22 @@ suite("test_show_create_table_and_views_nereids", "show") {
String rollupName = "${suiteName}_rollup"
String likeName = "${suiteName}_like"
+ def forceReplicaAllocation =
getFeConfig('force_olap_table_replication_allocation').trim()
+ def effectiveReplicaNum = 1
+ if (!forceReplicaAllocation.isEmpty()) {
+ def matcher = forceReplicaAllocation =~
/^tag\.location\.default:\s*(1|3)$/
+ assertTrue(matcher.matches(),
+ "Unsupported force_olap_table_replication_allocation:
${forceReplicaAllocation}")
+ effectiveReplicaNum = matcher.group(1).toInteger()
+ } else {
+ def forceReplicaNum =
getFeConfig('force_olap_table_replication_num').toInteger()
+ if (forceReplicaNum > 0) {
+ assertTrue(forceReplicaNum in [1, 3],
+ "Unsupported force_olap_table_replication_num:
${forceReplicaNum}")
+ effectiveReplicaNum = forceReplicaNum
+ }
+ }
+
sql "SET enable_nereids_planner=true;"
sql "SET enable_fallback_to_original_planner=false;"
@@ -99,7 +115,7 @@ suite("test_show_create_table_and_views_nereids", "show") {
(2, 200, 1111),
(23, 900, 1)"""
- qt_show "SHOW CREATE TABLE ${dbName}.${tableName}"
+ quickRunTest("show_initial_replica_${effectiveReplicaNum}", "SHOW CREATE
TABLE ${dbName}.${tableName}")
qt_select "SELECT * FROM ${dbName}.${tableName} ORDER BY user_id, good_id"
sql "drop view if exists ${dbName}.${viewName};"
@@ -132,15 +148,16 @@ suite("test_show_create_table_and_views_nereids", "show")
{
}
qt_select "SELECT user_id, SUM(cost) FROM ${dbName}.${tableName} GROUP BY
user_id ORDER BY user_id"
- qt_show "SHOW CREATE TABLE ${dbName}.${tableName}"
+ quickRunTest("show_after_rollup_replica_${effectiveReplicaNum}", "SHOW
CREATE TABLE ${dbName}.${tableName}")
// create like
sql "CREATE TABLE ${dbName}.${likeName} LIKE ${dbName}.${tableName}"
- qt_show "SHOW CREATE TABLE ${dbName}.${likeName}"
+ quickRunTest("show_like_replica_${effectiveReplicaNum}", "SHOW CREATE
TABLE ${dbName}.${likeName}")
// create like with rollup
sql "CREATE TABLE ${dbName}.${likeName}_with_rollup LIKE
${dbName}.${tableName} WITH ROLLUP"
- qt_show "SHOW CREATE TABLE ${dbName}.${likeName}_with_rollup"
+ quickRunTest("show_like_with_rollup_replica_${effectiveReplicaNum}",
+ "SHOW CREATE TABLE ${dbName}.${likeName}_with_rollup")
sql "DROP TABLE IF EXISTS ${dbName}.${likeName}_with_rollup FORCE"
sql "DROP TABLE ${dbName}.${likeName} FORCE"
@@ -148,4 +165,3 @@ suite("test_show_create_table_and_views_nereids", "show") {
sql "DROP TABLE ${dbName}.${tableName} FORCE"
sql "DROP DATABASE ${dbName} FORCE"
}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]