You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/06/13 11:17:40 UTC

[GitHub] [lucene-solr] s1monw opened a new pull request #1576: lternative approach to LUCENE-8962

s1monw opened a new pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576


   <!--
   _(If you are a project committer then you may remove some/all of the following template.)_
   
   Before creating a pull request, please file an issue in the ASF Jira system for Lucene or Solr:
   
   * https://issues.apache.org/jira/projects/LUCENE
   * https://issues.apache.org/jira/projects/SOLR
   
   You will need to create an account in Jira in order to create an issue.
   
   The title of the PR should reference the Jira issue number in the form:
   
   * LUCENE-####: <short description of problem or changes>
   * SOLR-####: <short description of problem or changes>
   
   LUCENE and SOLR must be fully capitalized. A short description helps people scanning pull requests for items they can work on.
   
   Properly referencing the issue in the title ensures that Jira is correctly updated with code review comments and commits. -->
   
   
   # Description
   
   Please provide a short description of the changes you're making with this pull request.
   
   # Solution
   
   Please provide a short description of the approach taken to implement your solution.
   
   # Tests
   
   Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [ ] I have created a Jira issue and added the issue ID to my pull request title.
   - [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [ ] I have developed this patch against the `master` branch.
   - [ ] I have run `ant precommit` and the appropriate test suite.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Ref Guide](https://github.com/apache/lucene-solr/tree/master/solr/solr-ref-guide) (for Solr changes only).
   


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] dsmiley commented on a change in pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
dsmiley commented on a change in pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#discussion_r440309711



##########
File path: lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
##########
@@ -399,8 +423,19 @@ public String segString(Directory dir) {
       }
       return b.toString();
     }
+
+    boolean await(long timeout, TimeUnit unit) {
+      for (OneMerge merge : merges) {
+        if (merge.await(timeout, unit) == false) {

Review comment:
       This looks suspicious when there is more than one merge.  Shouldn't the timeout decrease as time is used up by earlier merges?
   
   In practice, when is there more than one?  I've been confused on this matter when I developed a custom MP/MS.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] s1monw commented on pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
s1monw commented on pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#issuecomment-643609384


   see #1552 for reference


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] s1monw closed pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
s1monw closed pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576


   


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] dsmiley commented on a change in pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
dsmiley commented on a change in pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#discussion_r443266362



##########
File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
##########
@@ -2144,39 +2145,43 @@ private synchronized boolean updatePendingMerges(MergePolicy mergePolicy, MergeT
     assert maxNumSegments == UNBOUNDED_MAX_MERGE_SEGMENTS || maxNumSegments > 0;
     assert trigger != null;
     if (stopMerges) {
-      return false;
+      return null;
     }
 
     // Do not start new merges if disaster struck
     if (tragedy.get() != null) {
-      return false;
+      return null;
     }
-    boolean newMergesFound = false;
     final MergePolicy.MergeSpecification spec;
     if (maxNumSegments != UNBOUNDED_MAX_MERGE_SEGMENTS) {
       assert trigger == MergeTrigger.EXPLICIT || trigger == MergeTrigger.MERGE_FINISHED :
       "Expected EXPLICT or MERGE_FINISHED as trigger even with maxNumSegments set but was: " + trigger.name();
 
       spec = mergePolicy.findForcedMerges(segmentInfos, maxNumSegments, Collections.unmodifiableMap(segmentsToMerge), this);
-      newMergesFound = spec != null;
-      if (newMergesFound) {
+      if (spec != null) {
         final int numMerges = spec.merges.size();
         for(int i=0;i<numMerges;i++) {
           final MergePolicy.OneMerge merge = spec.merges.get(i);
           merge.maxNumSegments = maxNumSegments;
         }
       }
     } else {
-      spec = mergePolicy.findMerges(trigger, segmentInfos, this);
+      switch (trigger) {
+        case COMMIT:

Review comment:
       There is an inconsistency here that suggests something is wrong, or at least confusing enough to deserve a comment.  For case COMMIT, we call a findFullFlushMerges.  Shouldn't it be on case FULL_FLUSH to be consistent with the method we are calling?  Or should findFullFlushMerges be called findCommitMerges?




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] s1monw commented on a change in pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
s1monw commented on a change in pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#discussion_r441125936



##########
File path: lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
##########
@@ -399,8 +423,19 @@ public String segString(Directory dir) {
       }
       return b.toString();
     }
+
+    boolean await(long timeout, TimeUnit unit) {
+      for (OneMerge merge : merges) {
+        if (merge.await(timeout, unit) == false) {

Review comment:
       I fixed this in the followup PR https://github.com/apache/lucene-solr/pull/1585




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] mikemccand commented on a change in pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
mikemccand commented on a change in pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#discussion_r443573360



##########
File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
##########
@@ -2144,39 +2145,43 @@ private synchronized boolean updatePendingMerges(MergePolicy mergePolicy, MergeT
     assert maxNumSegments == UNBOUNDED_MAX_MERGE_SEGMENTS || maxNumSegments > 0;
     assert trigger != null;
     if (stopMerges) {
-      return false;
+      return null;
     }
 
     // Do not start new merges if disaster struck
     if (tragedy.get() != null) {
-      return false;
+      return null;
     }
-    boolean newMergesFound = false;
     final MergePolicy.MergeSpecification spec;
     if (maxNumSegments != UNBOUNDED_MAX_MERGE_SEGMENTS) {
       assert trigger == MergeTrigger.EXPLICIT || trigger == MergeTrigger.MERGE_FINISHED :
       "Expected EXPLICT or MERGE_FINISHED as trigger even with maxNumSegments set but was: " + trigger.name();
 
       spec = mergePolicy.findForcedMerges(segmentInfos, maxNumSegments, Collections.unmodifiableMap(segmentsToMerge), this);
-      newMergesFound = spec != null;
-      if (newMergesFound) {
+      if (spec != null) {
         final int numMerges = spec.merges.size();
         for(int i=0;i<numMerges;i++) {
           final MergePolicy.OneMerge merge = spec.merges.get(i);
           merge.maxNumSegments = maxNumSegments;
         }
       }
     } else {
-      spec = mergePolicy.findMerges(trigger, segmentInfos, this);
+      switch (trigger) {
+        case COMMIT:

Review comment:
       Full flush happens for refresh and commit.
   
   But we have only implemented "merge on commit" so far.
   
   I would love to also add "merge on refresh", but until we do so, I think it's correct for `IndexWriter` to separate out the `COMMIT` case here like this.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] s1monw commented on pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
s1monw commented on pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#issuecomment-645405813


   superseded by #1585


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] s1monw commented on a change in pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
s1monw commented on a change in pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#discussion_r440359230



##########
File path: lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
##########
@@ -399,8 +423,19 @@ public String segString(Directory dir) {
       }
       return b.toString();
     }
+
+    boolean await(long timeout, TimeUnit unit) {
+      for (OneMerge merge : merges) {
+        if (merge.await(timeout, unit) == false) {

Review comment:
       in a real change that's correct. in a prototype as this is it's really just there to visualize the idea. I didn't do this on purpose to not discuss impl details. that's not the point of this it's really just a PR to make commenting simpler.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] s1monw commented on pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
s1monw commented on pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#issuecomment-644997637


   @msfroh I opened https://github.com/apache/lucene-solr/pull/1585 to make it easier to do this. 


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] msfroh commented on pull request #1576: Alternative approach to LUCENE-8962

Posted by GitBox <gi...@apache.org>.
msfroh commented on pull request #1576:
URL: https://github.com/apache/lucene-solr/pull/1576#issuecomment-644899966


   This approach makes sense to me. 
   
   I like how much simpler the addition of MergeSpecification.await() makes things, versus the CountDownLatch hackery of the previous approach. Also, updatePendingMerges returning the MergeSpecification is much cleaner than explicitly computing a merge from within prepareCommitInternal.


----------------------------------------------------------------
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:
users@infra.apache.org



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