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

Unable to load custom MergePolicy

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: None
    • Labels:
      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

        1. SOLR-2983_2.patch
          8 kB
          Tommaso Teofili
        2. SOLR-2983.patch
          7 kB
          Tommaso Teofili

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: