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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 2ae37626bbe [opt](index compaction)Use RAM dir to create tmp 
index_writer (#41371) (#41705)
2ae37626bbe is described below

commit 2ae37626bbed7b50069a900f3ab4e890bfbf1e8a
Author: qiye <[email protected]>
AuthorDate: Sat Oct 12 17:13:55 2024 +0800

    [opt](index compaction)Use RAM dir to create tmp index_writer (#41371) 
(#41705)
    
    ## Proposed changes
    
    bp #41371
---
 be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 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 40a1d2218f8..51aeab0cb45 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
@@ -39,8 +39,9 @@ Status compact_column(int64_t index_id, 
std::vector<lucene::store::Directory*>&
                     "debug point: index compaction error");
         }
     })
-
-    lucene::store::Directory* dir = DorisFSDirectoryFactory::getDirectory(fs, 
tmp_path.c_str());
+    bool can_use_ram_dir = true;
+    lucene::store::Directory* dir =
+            DorisFSDirectoryFactory::getDirectory(fs, tmp_path.c_str(), 
can_use_ram_dir);
     lucene::analysis::SimpleAnalyzer<char> analyzer;
     auto* index_writer = _CLNEW lucene::index::IndexWriter(dir, &analyzer, 
true /* create */,
                                                            true /* 
closeDirOnShutdown */);
@@ -69,8 +70,10 @@ Status compact_column(int64_t index_id, 
std::vector<lucene::store::Directory*>&
         }
     }
 
-    // delete temporary segment_path
-    static_cast<void>(fs->delete_directory(tmp_path.c_str()));
+    // delete temporary segment_path, only when inverted_index_ram_dir_enable 
is false
+    if (!config::inverted_index_ram_dir_enable) {
+        static_cast<void>(fs->delete_directory(tmp_path.c_str()));
+    }
     return Status::OK();
 }
 } // namespace doris::segment_v2


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

Reply via email to