Skip to content

Commit

Permalink
[Refactor](inverted index) refactor inverted index file writer for v1…
Browse files Browse the repository at this point in the history
…/v2 index write apache#42328 (apache#43993)

cherry pick from apache#42328
  • Loading branch information
airborne12 authored Nov 15, 2024
1 parent adfbe69 commit f2c3201
Show file tree
Hide file tree
Showing 6 changed files with 876 additions and 245 deletions.
6 changes: 4 additions & 2 deletions be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,11 @@ Status Compaction::do_inverted_index_compaction() {
DORIS_TRY(inverted_index_file_readers[src_segment_id]->open(index_meta));
}
for (int dest_segment_id = 0; dest_segment_id < dest_segment_num; dest_segment_id++) {
auto* dest_dir =
auto dest_dir =
DORIS_TRY(inverted_index_file_writers[dest_segment_id]->open(index_meta));
dest_index_dirs[dest_segment_id] = dest_dir;
// Destination directories in dest_index_dirs do not need to be deconstructed,
// but their lifecycle must be managed by inverted_index_file_writers.
dest_index_dirs[dest_segment_id] = dest_dir.get();
}
auto st = compact_column(index_meta->index_id(), src_idx_dirs, dest_index_dirs,
index_tmp_path.native(), trans_vec, dest_segment_num_rows);
Expand Down
7 changes: 0 additions & 7 deletions be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ Status compact_column(int64_t index_id,
// when index_writer is destroyed, if closeDir is set, dir will be close
// _CLDECDELETE(dir) will try to ref_cnt--, when it decreases to 1, dir will be destroyed.
_CLDECDELETE(dir)
for (auto* d : dest_index_dirs) {
if (d != nullptr) {
// NOTE: DO NOT close dest dir here, because it will be closed when dest index writer finalize.
//d->close();
//_CLDELETE(d);
}
}

// delete temporary segment_path, only when inverted_index_ram_dir_enable is false
if (!config::inverted_index_ram_dir_enable) {
Expand Down
Loading

0 comments on commit f2c3201

Please sign in to comment.