You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2023/01/11 09:03:12 UTC

[lucene] 02/02: Never throttle creation of compound files. (#12070)

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

jpountz pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit b8d40e6af8d71ac776fe743a8dbd7d68eed07846
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Wed Jan 11 09:57:13 2023 +0100

    Never throttle creation of compound files. (#12070)
    
    `ConcurrentMergeScheduler` uses the rate at which a merge writes bytes as a
    proxy for CPU usage, in order to prevent merging from disrupting searches too
    much. However creating compound files are lightweight CPU-wise and do not need
    throttling.
    
    Closes #12068
---
 lucene/CHANGES.txt                                            | 3 +++
 lucene/core/src/java/org/apache/lucene/index/IndexWriter.java | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index d1802e42dea..eb9b5cf5403 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -105,6 +105,9 @@ Improvements
 
 * GITHUB#12034: Remove null check in IndexReaderContext#leaves() usages (Erik Pellizzon)
 
+* GITHUB#12070: Compound file creation is no longer subject to merge throttling.
+  (Adrien Grand)
+
 Bug Fixes
 ---------------------
 * GITHUB#11726: Indexing term vectors on large documents could fail due to
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index 88ed488dbad..f488e1f83f6 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -5211,7 +5211,10 @@ public class IndexWriter
         success = false;
 
         Collection<String> filesToRemove = merge.info.files();
-        TrackingDirectoryWrapper trackingCFSDir = new TrackingDirectoryWrapper(mergeDirectory);
+        // NOTE: Creation of the CFS file must be performed with the original
+        // directory rather than with the merging directory, so that it is not
+        // subject to merge throttling.
+        TrackingDirectoryWrapper trackingCFSDir = new TrackingDirectoryWrapper(directory);
         try {
           createCompoundFile(
               infoStream, trackingCFSDir, merge.info.info, context, this::deleteNewFiles);