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

Support registering searcher listeners in SolrCoreAware.inform(SolrCore) method

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0, 6.0
    • Fix Version/s: 5.0, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      I'm marking this Jira as Bug because we already have components that do this (SuggestComponent and SpellcheckComponent), however, listeners registered at this stage not always work.
      From https://issues.apache.org/jira/browse/SOLR-6845?focusedCommentId=14250350&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14250350

      Trying to add some unit tests to this feature I found another issue. SuggestComponent and SpellcheckComponent rely on a firstSearcherListener to load (and in this case, also build) some structures. These firstSearcherListeners are registered on SolrCoreAware.inform(), however the first searcher listener task is only added to the queue of warming tasks if there is at least one listener registered at the time of the first searcher creation (before SolrCoreAware.inform() is ever called). See

      SolrCore.java
              if (currSearcher == null && firstSearcherListeners.size() > 0) {
                future = searcherExecutor.submit(new Callable() {
                  @Override
                  public Object call() throws Exception {
                    try {
                      for (SolrEventListener listener : firstSearcherListeners) {
                        listener.newSearcher(newSearcher, null);
                      }
                    } catch (Throwable e) {
                      SolrException.log(log, null, e);
                      if (e instanceof Error) {
                        throw (Error) e;
                      }
                    }
                    return null;
                  }
                });
              }
      

      I'll create a new Jira for this

        Attachments

        1. SOLR-6864.patch
          9 kB
          Tomás Fernández Löbbe
        2. fix.patch
          3 kB
          Tomás Fernández Löbbe
        3. SOLR-6864-tests.patch
          10 kB
          Tomás Fernández Löbbe

          Activity

            People

            • Assignee:
              erickerickson Erick Erickson
              Reporter:
              tomasflobbe Tomás Fernández Löbbe
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: