DivyanshIITB commented on code in PR #14335:
URL: https://github.com/apache/lucene/pull/14335#discussion_r1998645593


##########
lucene/core/src/java/org/apache/lucene/index/MultiTenantMergeScheduler.java:
##########
@@ -0,0 +1,44 @@
+package org.apache.lucene.index;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.io.IOException;
+
+/**
+ * A multi-tenant merge scheduler that shares a global thread pool across 
multiple IndexWriters.
+ */
+public class MultiTenantMergeScheduler extends MergeScheduler {
+
+    // Shared global thread pool
+    private static final ExecutorService MERGE_THREAD_POOL = 
Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() / 2);
+
+    @Override
+    public void merge(MergeScheduler.MergeSource mergeSource, MergeTrigger 
trigger) throws IOException {
+        while (true) {
+            MergePolicy.OneMerge merge = mergeSource.getNextMerge();
+            if (merge == null) {

Review Comment:
   Thanks for pointing this out! I’ve updated the loop condition to use 
hasPendingMerges() instead of relying on null. This ensures better adherence to 
the documented API behavior. Let me know if this aligns with what you were 
suggesting!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to