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

Using SPI lookups of analysis components results in factories that don't get ResourceLoaderAware.inform called on them (When using ClassicIndexSchemaFactory)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 9.0
    • 9.5, 9.4.1
    • None
    • None

    Description

      Ok ... this is a weird one ...

      SOLR-13593 modified FieldTypePluginLoader to add the ability for analysis Factories to be resolved by SPI name (ex: name="stop", instead of by "short class name" (ex: class="solr.StopFilterFactory".

      The code that deals with this just calls (for example) TokenFilterFactory.forName(name, params); and uses the resulting factory "as is" – But these means that nothing calls the inform(ResourceLoader) on any factories that implement ResourceLoaderAware (such as StopFilterFactory or SynonymGraphFilterFactory)

      In the "short class name" code path (the only option prior to 9.0), the SolrResourceLoader is used to initialize the Factory, and SolrResourceLoader..newInstance(...) takes responsibility of calling factory.inform(this) on everything it instantiates that implements ResourceLoaderAware (as well as some other checks: like SolrCoreAware)

      This discrepancy means that when using the name="foo" syntax, many factories won't be fully initialized – or fail on invalid input – during schema initialization. In the case of things like StopFilterFactory or SynonymGraphFilterFactory) the problem will manifest as some type of runtime error when the factory's create(...) method is called as part of creating a new index or query Analyzer.


      ...BUT...


      This problem only seems to manifest itself when using ClassicIndexSchemaFactory – which is why it's not readily apparent when using the default configset, or something like bin/solr -e techproducts (but is trivial to reproduce in testcases (since almost every "test" solrconfig uses ClassicIndexSchemaFactory)

      I have no idea why using ManagedIndexSchemaFactory doesn't manifest the same problem – it should be using the same FieldTypePluginLoader under the covers – but clearly something specific to ManagedIndexSchema is taking responsibility for calling ResourceLoaderAware.inform(...)

      Attachments

        1. SOLR-16203_test.patch
          0.9 kB
          Chris M. Hostetter

        Issue Links

          Activity

            People

              janhoy Jan Høydahl
              hossman Chris M. Hostetter
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 10m
                  3h 10m