Skip to content

Commit

Permalink
[fix](inverted index) the rowset may be deleted and become nullptr. a…
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzxl1993 authored and weixingyu12 committed Apr 30, 2024
1 parent 4f6f709 commit 72d331a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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;
Expand Down

0 comments on commit 72d331a

Please sign in to comment.