Lucene - Core
  1. Lucene - Core
  2. LUCENE-5481

IndexWriter.forceMerge may run unneeded merges

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.7.1, 4.8, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      I was running some tests and was surprised that IndexWriter.forceMerge caused the index to be merged even when the index contains a single segment with no deletions.

      This is due to MergePolicy.isMerged which always returns false with the default configuration although merge policies rely on it to know whether a single-segment index should be merged.

      1. LUCENE-5481.patch
        10 kB
        Adrien Grand

        Activity

        Hide
        Adrien Grand added a comment -

        Here is an attempt to fit it. The interesting change is in MergePolicy.isMerged.

        Show
        Adrien Grand added a comment - Here is an attempt to fit it. The interesting change is in MergePolicy.isMerged .
        Hide
        Michael McCandless added a comment -

        That's just awful.

        So if you .forceMerge(1) an existing index, and then turn around call call that again, the 2nd time still does the merge?

        Show
        Michael McCandless added a comment - That's just awful. So if you .forceMerge(1) an existing index, and then turn around call call that again, the 2nd time still does the merge?
        Hide
        Adrien Grand added a comment -

        Yes, exactly.

        Show
        Adrien Grand added a comment - Yes, exactly.
        Hide
        Michael McCandless added a comment -

        +1, patch looks good. Thanks Adrien!

        Show
        Michael McCandless added a comment - +1, patch looks good. Thanks Adrien!
        Hide
        ASF subversion and git services added a comment -

        Commit 1572942 from Adrien Grand in branch 'dev/trunk'
        [ https://svn.apache.org/r1572942 ]

        LUCENE-5481: Don't run unnecessary merges in IndexWriter.forceMerge.

        Show
        ASF subversion and git services added a comment - Commit 1572942 from Adrien Grand in branch 'dev/trunk' [ https://svn.apache.org/r1572942 ] LUCENE-5481 : Don't run unnecessary merges in IndexWriter.forceMerge.
        Hide
        ASF subversion and git services added a comment -

        Commit 1572943 from Adrien Grand in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1572943 ]

        LUCENE-5481: Don't run unnecessary merges in IndexWriter.forceMerge.

        Show
        ASF subversion and git services added a comment - Commit 1572943 from Adrien Grand in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1572943 ] LUCENE-5481 : Don't run unnecessary merges in IndexWriter.forceMerge.
        Hide
        Adrien Grand added a comment -

        Committed. Thank you for the review, Mike!

        Show
        Adrien Grand added a comment - Committed. Thank you for the review, Mike!
        Hide
        Michael McCandless added a comment -

        I'll backport to 4.7.x

        Show
        Michael McCandless added a comment - I'll backport to 4.7.x
        Hide
        ASF subversion and git services added a comment -

        Commit 1578528 from Michael McCandless in branch 'dev/branches/lucene_solr_4_7'
        [ https://svn.apache.org/r1578528 ]

        LUCENE-5481: merge back to 47x

        Show
        ASF subversion and git services added a comment - Commit 1578528 from Michael McCandless in branch 'dev/branches/lucene_solr_4_7' [ https://svn.apache.org/r1578528 ] LUCENE-5481 : merge back to 47x
        Hide
        Steve Rowe added a comment -

        Michael McCandless, looks like this can be re-resolved, now that you've backported to lucene_solr_4_7 branch?

        Show
        Steve Rowe added a comment - Michael McCandless , looks like this can be re-resolved, now that you've backported to lucene_solr_4_7 branch?
        Hide
        Michael McCandless added a comment -

        Woops, yes ... resolving now.

        Show
        Michael McCandless added a comment - Woops, yes ... resolving now.
        Hide
        Steve Rowe added a comment -

        Bulk close 4.7.1 issues

        Show
        Steve Rowe added a comment - Bulk close 4.7.1 issues

          People

          • Assignee:
            Adrien Grand
            Reporter:
            Adrien Grand
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development