Skip to content

Commit

Permalink
[opt](index compaction)Use RAM dir to create tmp index_writer
Browse files Browse the repository at this point in the history
  • Loading branch information
qidaye committed Sep 26, 2024
1 parent a07a134 commit 0776c52
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ Status compact_column(int64_t index_id, std::vector<lucene::store::Directory*>&
"debug point: index compaction error");
}
})
bool can_use_ram_dir = true;
lucene::store::Directory* dir =
DorisFSDirectoryFactory::getDirectory(io::global_local_filesystem(), tmp_path.data());
DorisFSDirectoryFactory::getDirectory(io::global_local_filesystem(), tmp_path.data(), can_use_ram_dir);
lucene::analysis::SimpleAnalyzer<char> analyzer;
auto* index_writer = _CLNEW lucene::index::IndexWriter(dir, &analyzer, true /* create */,
true /* closeDirOnShutdown */);
Expand Down Expand Up @@ -70,8 +71,10 @@ Status compact_column(int64_t index_id, std::vector<lucene::store::Directory*>&
}
}

// delete temporary segment_path
std::ignore = io::global_local_filesystem()->delete_directory(tmp_path.data());
// delete temporary segment_path, only when inverted_index_ram_dir_enable is false
if (!config::inverted_index_ram_dir_enable) {
std::ignore = io::global_local_filesystem()->delete_directory(tmp_path.data());
}
return Status::OK();
}
} // namespace doris::segment_v2

0 comments on commit 0776c52

Please sign in to comment.