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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 42681ebc46a [fix](inverted index) the rowset may be deleted and become 
nullptr. #33878 (#34183)
42681ebc46a is described below

commit 42681ebc46a6e9409ba167eaeceef514aa9853dc
Author: zzzxl <[email protected]>
AuthorDate: Mon Apr 29 09:33:00 2024 +0800

    [fix](inverted index) the rowset may be deleted and become nullptr. #33878 
(#34183)
---
 be/src/olap/compaction.cpp | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp
index 6dbaf4865c3..fcfd3abb522 100644
--- a/be/src/olap/compaction.cpp
+++ b/be/src/olap/compaction.cpp
@@ -462,11 +462,9 @@ Status Compaction::do_compaction_impl(int64_t permits) {
             // src index files
             // format: rowsetId_segmentId
             std::vector<std::string> src_index_files(src_segment_num);
-            std::vector<RowsetId> src_rowset_ids;
             for (const auto& m : src_seg_to_id_map) {
                 std::pair<RowsetId, uint32_t> p = m.first;
                 src_index_files[m.second] = p.first.to_string() + "_" + 
std::to_string(p.second);
-                src_rowset_ids.push_back(p.first);
             }
 
             // dest index files
@@ -533,7 +531,7 @@ Status Compaction::do_compaction_impl(int64_t permits) {
                     ctx.skip_inverted_index.cbegin(), 
ctx.skip_inverted_index.cend(),
                     [&src_segment_num, &dest_segment_num, &index_writer_path, 
&src_index_files,
                      &dest_index_files, &fs, &tablet_path, &trans_vec, 
&dest_segment_num_rows,
-                     &status, &src_rowset_ids, this](int32_t column_uniq_id) {
+                     &status, this](int32_t column_uniq_id) {
                         auto error_handler = [this](int64_t index_id, int64_t 
column_uniq_id) {
                             LOG(WARNING) << "failed to do index compaction"
                                          << ". tablet=" << _tablet->tablet_id()
@@ -554,10 +552,9 @@ Status Compaction::do_compaction_impl(int64_t permits) {
 
                         // if index properties are different, index compaction 
maybe needs to be skipped.
                         std::optional<std::map<std::string, std::string>> 
first_properties;
-                        for (const auto& rowset_id : src_rowset_ids) {
-                            auto rowset_ptr = _tablet->get_rowset(rowset_id);
+                        for (const auto& rowset : _input_rowsets) {
                             const auto* tablet_index =
-                                    
rowset_ptr->tablet_schema()->get_inverted_index(column_uniq_id);
+                                    
rowset->tablet_schema()->get_inverted_index(column_uniq_id);
                             const auto& properties = 
tablet_index->properties();
                             if (!first_properties.has_value()) {
                                 first_properties = properties;


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

Reply via email to