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

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


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 54be78859e5 [branch-4.1][fix](regression) Support forced replica 
golden in show create case (#65673)
54be78859e5 is described below

commit 54be78859e58514ac0c058efe291df7da9f3c41c
Author: shuke <[email protected]>
AuthorDate: Thu Jul 16 09:29:52 2026 +0800

    [branch-4.1][fix](regression) Support forced replica golden in show create 
case (#65673)
    
    ### What problem does this PR solve?
    
    Issue Number: None
    
    Related PR: #65543
    
    Problem Summary:
    
    Backport the forced-replica-aware SHOW CREATE golden selection to
    branch-4.1. The branch-4.1 P0 environment forces OLAP tables to three
    replicas, while this case only had the one-replica golden. The master
    result file could not be cherry-picked directly because branch-4.1 does
    not emit `binlog.format`, so this backport preserves the complete
    branch-4.1 baseline and adds matching replica-1/replica-3 result blocks.
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [x] Regression test
    - The target case passed with forced replica 3 while validating #65543.
    - Verified all four replica-1 blocks preserve the branch-4.1 baseline,
    and each replica-3 block differs only in `replication_allocation`.
            - `git diff --check` passed.
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [x] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [x] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../test_show_create_table_and_views_nereids.out   | 19 ++++++++++++----
 ...test_show_create_table_and_views_nereids.groovy | 26 +++++++++++++++++-----
 2 files changed, 36 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 e0600604f51..9d81306f98a 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,12 +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]

Reply via email to