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

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


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

commit 0e2f4756e51fe12172fdb3d395179caef95d3071
Author: qiye <[email protected]>
AuthorDate: Thu Nov 7 11:44:54 2024 +0800

    [opt](index compaction)Use RAM dir to create tmp index_writer (#41371) 
(#41703)
    
    ## 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 c51d63d96ce..7d1b348b95b 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
@@ -41,8 +41,9 @@ Status compact_column(int64_t index_id,
                     "debug point: index compaction error");
         }
     })
-    lucene::store::Directory* dir =
-            
DorisFSDirectoryFactory::getDirectory(io::global_local_filesystem(), 
tmp_path.data());
+    bool can_use_ram_dir = true;
+    lucene::store::Directory* dir = 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 */);
@@ -69,8 +70,10 @@ Status compact_column(int64_t index_id,
         }
     }
 
-    // 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


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

Reply via email to