msfroh commented on a change in pull request #1155: LUCENE-8962: Add ability to 
selectively merge on commit
URL: https://github.com/apache/lucene-solr/pull/1155#discussion_r368187135
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
 ##########
 @@ -3223,15 +3259,44 @@ private long prepareCommitInternal() throws 
IOException {
               // sneak into the commit point:
               toCommit = segmentInfos.clone();
 
+              if (anyChanges) {
+                mergeAwaitLatchRef = new AtomicReference<>();
 
 Review comment:
   This is a little bit of hackery to share state between this thread and the 
threads that do the merges. 
   
   We initialize the ref here, pass it to `waitForMergeOnCommitPolicy` on the 
next line to make sure it gets shared with any computed `OneMerge`s. Then, 
before we release the IW lock (so we're guaranteed that those `OneMerge`s 
haven't run yet), we populate the ref with the `CountdownLatch` (once we know 
what we're counting down).
   
   That said, I think I could simplify things a lot by not using 
`OneMergeWrappingMergePolicy`, but rather decorating the returned `OneMerge`s 
(if applicable) directly. I'm going to take a stab at that approach in my next 
commit.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to