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

eldenmoon 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 7675a142872 [Fix](Variant) fix potential heap use after free when 
concurrently flush segments on one tablet (#37976)
7675a142872 is described below

commit 7675a14287291164fb95d3faceb2ff2883b662e1
Author: lihangyu <[email protected]>
AuthorDate: Wed Jul 17 20:01:28 2024 +0800

    [Fix](Variant) fix potential heap use after free when concurrently flush 
segments on one tablet (#37976)
    
    TabletSchema is shallow copied, should do deep copy for _flush_schema
---
 be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp         | 4 +++-
 regression-test/suites/variant_p0/compaction_sparse_column.groovy | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp 
b/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
index 92ac65deb6d..0307a53d740 100644
--- a/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
@@ -712,7 +712,9 @@ Status 
VerticalSegmentWriter::_append_block_with_variant_subcolumns(RowsInBlock&
             continue;
         }
         if (_flush_schema == nullptr) {
-            _flush_schema = std::make_shared<TabletSchema>(*_tablet_schema);
+            _flush_schema = std::make_shared<TabletSchema>();
+            // deep copy
+            _flush_schema->copy_from(*_tablet_schema);
         }
         auto column_ref = data.block->get_by_position(i).column;
         const vectorized::ColumnObject& object_column = 
assert_cast<vectorized::ColumnObject&>(
diff --git a/regression-test/suites/variant_p0/compaction_sparse_column.groovy 
b/regression-test/suites/variant_p0/compaction_sparse_column.groovy
index be3c003d1c8..57e6e6ef963 100644
--- a/regression-test/suites/variant_p0/compaction_sparse_column.groovy
+++ b/regression-test/suites/variant_p0/compaction_sparse_column.groovy
@@ -47,6 +47,7 @@ suite("test_compaction_sparse_column", "nonConcurrent") {
         }
 
         set_be_config.call("variant_ratio_of_defaults_as_sparse_column", 
"0.95")
+        set_be_config.call("write_buffer_size", "10240")
 
         sql """ DROP TABLE IF EXISTS ${tableName} """
         sql """
@@ -169,5 +170,7 @@ suite("test_compaction_sparse_column", "nonConcurrent") {
         qt_select_all """SELECT k, v['a'], v['b'], v['xxxx'], v['point'], 
v['ddddd'] from ${tableName} where (cast(v['point'] as int) = 1);"""
     } finally {
         // try_sql("DROP TABLE IF EXISTS ${tableName}")
+        set_be_config.call("write_buffer_size", "209715200")
+        set_be_config.call("variant_ratio_of_defaults_as_sparse_column", "1")
     }
 }


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

Reply via email to