From 0776c52330f60da3e0633d3e07e1566e88392ffc Mon Sep 17 00:00:00 2001 From: Jianliang Qi Date: Thu, 26 Sep 2024 21:05:23 +0800 Subject: [PATCH] [opt](index compaction)Use RAM dir to create tmp index_writer --- .../olap/rowset/segment_v2/inverted_index_compaction.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp b/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp index e47189f9137adaf..3524ee7dabade06 100644 --- a/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp +++ b/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp @@ -40,8 +40,9 @@ Status compact_column(int64_t index_id, std::vector& "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 analyzer; auto* index_writer = _CLNEW lucene::index::IndexWriter(dir, &analyzer, true /* create */, true /* closeDirOnShutdown */); @@ -70,8 +71,10 @@ Status compact_column(int64_t index_id, std::vector& } } - // 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