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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 61c56209b1b branch-4.0: [fix](schema-change) Prevent coredump when 
reading non-overlapping segments from a single rowset during heavy schema 
change #57191 (#57602)
61c56209b1b is described below

commit 61c56209b1b8477849fd6a9762aacfc95ad0daae
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 6 10:56:25 2025 +0800

    branch-4.0: [fix](schema-change) Prevent coredump when reading 
non-overlapping segments from a single rowset during heavy schema change #57191 
(#57602)
    
    Cherry-picked from #57191
    
    Co-authored-by: Siyang Tang <[email protected]>
---
 be/src/olap/schema_change.cpp                      |  4 +-
 .../test_non_overlap_seg_heavy_sc.out              |  7 ++
 .../test_non_overlap_seg_heavy_sc.groovy           | 74 ++++++++++++++++++++++
 3 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp
index cc1879fce88..7d4bc11366e 100644
--- a/be/src/olap/schema_change.cpp
+++ b/be/src/olap/schema_change.cpp
@@ -552,7 +552,7 @@ Status 
VSchemaChangeDirectly::_inner_process(RowsetReaderSharedPtr rowset_reader
     bool eof = false;
     do {
         auto new_block = 
vectorized::Block::create_unique(new_tablet_schema->create_block());
-        auto ref_block = 
vectorized::Block::create_unique(base_tablet_schema->create_block());
+        auto ref_block = 
vectorized::Block::create_unique(base_tablet_schema->create_block(false));
 
         auto st = rowset_reader->next_block(ref_block.get());
         if (!st) {
@@ -621,7 +621,7 @@ Status 
VBaseSchemaChangeWithSorting::_inner_process(RowsetReaderSharedPtr rowset
 
     bool eof = false;
     do {
-        auto ref_block = 
vectorized::Block::create_unique(base_tablet_schema->create_block());
+        auto ref_block = 
vectorized::Block::create_unique(base_tablet_schema->create_block(false));
         auto st = rowset_reader->next_block(ref_block.get());
         if (!st) {
             if (st.is<ErrorCode::END_OF_FILE>()) {
diff --git 
a/regression-test/data/schema_change_p0/test_non_overlap_seg_heavy_sc.out 
b/regression-test/data/schema_change_p0/test_non_overlap_seg_heavy_sc.out
new file mode 100644
index 00000000000..0780fb12bdb
--- /dev/null
+++ b/regression-test/data/schema_change_p0/test_non_overlap_seg_heavy_sc.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !sql --
+2      2
+3      3
+4      4
+5      5
+
diff --git 
a/regression-test/suites/schema_change_p0/test_non_overlap_seg_heavy_sc.groovy 
b/regression-test/suites/schema_change_p0/test_non_overlap_seg_heavy_sc.groovy
new file mode 100644
index 00000000000..f95fbaf4297
--- /dev/null
+++ 
b/regression-test/suites/schema_change_p0/test_non_overlap_seg_heavy_sc.groovy
@@ -0,0 +1,74 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_non_overlap_seg_heavy_sc") {
+    def tblName = "test_non_overlap_seg_heavy_sc"
+    sql """
+        DROP TABLE IF EXISTS ${tblName}_src
+        """
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tblName}_src
+        (
+            k INT NOT NULL,
+            v1 INT NOT NULL,
+            v2 INT NOT NULL
+        )
+        DUPLICATE KEY(k)
+        DISTRIBUTED BY HASH(k) BUCKETS 5
+        PROPERTIES(
+            "replication_num" = "1",
+            "light_schema_change" = "true",
+            "disable_auto_compaction" = "true"
+        ); 
+        """
+
+    sql """
+        DROP TABLE IF EXISTS ${tblName}_dst
+        """
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tblName}_dst
+        (
+            k INT NOT NULL,
+            v1 INT NOT NULL,
+            v2 INT NOT NULL
+        )
+        DUPLICATE KEY(k)
+        DISTRIBUTED BY HASH(k) BUCKETS 1
+        PROPERTIES(
+            "replication_num" = "1",
+            "light_schema_change" = "true",
+            "disable_auto_compaction" = "true"
+        ); 
+        """
+
+    sql """ INSERT INTO ${tblName}_src VALUES (1, 1, 1),(2, 2, 2),(3, 3, 
3),(4, 4, 4),(5, 5, 5) """
+
+    sql """ INSERT INTO ${tblName}_dst SELECT * FROM ${tblName}_src """
+
+    sql """ DELETE FROM ${tblName}_dst WHERE v1 = 1 """
+
+    sql """ ALTER TABLE ${tblName}_dst DROP COLUMN v1"""
+
+    sql """ ALTER TABLE ${tblName}_dst MODIFY COLUMN v2 STRING NOT NULL """
+
+    waitForSchemaChangeDone {
+        sql """ SHOW ALTER TABLE COLUMN WHERE TableName='${tblName}_dst' ORDER 
BY createtime DESC LIMIT 1 """
+        time 600
+    }
+
+    qt_sql """ SELECT * FROM ${tblName}_dst ORDER BY k """
+}


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

Reply via email to