Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-2983

Unable to load custom MergePolicy

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.6, 4.0-ALPHA
    • None
    • None

    Description

      As part of a recent upgrade to Solr 3.5.0 we encountered an error related to our use of LinkedIn's ZoieMergePolicy.

      It seems the code that loads a custom MergePolicy was at some point moved into SolrIndexConfig.java from SolrIndexWriter.java, but as this code was copied verbatim it now contains a bug:

      try {
      policy = (MergePolicy) schema.getResourceLoader().newInstance(mpClassName, null, new Class[]

      {IndexWriter.class}

      , new Object[]

      {this}

      );
      } catch (Exception e)

      { policy = (MergePolicy) schema.getResourceLoader().newInstance(mpClassName); }

      'this' is no longer an IndexWriter but a SolrIndexConfig, therefore the call to newInstance will always throw an exception and the catch clause will be executed. If the custom MergePolicy does not have a default constructor (which is the case of ZoieMergePolicy), the second attempt to create the MergePolicy will also fail and Solr won't start.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            teofili Tommaso Teofili
            herberts Mathias Herberts
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment