[ 
https://issues.apache.org/jira/browse/SOLR-6246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14102604#comment-14102604
 ] 

Hoss Man commented on SOLR-6246:
--------------------------------

bq. SolrSuggester adds close hooks but that doesn't work in this case. The 
reason is that the close hooks gets called only after the new core gets 
created....
bq. I experimented by adding a closeHook which gets called before the new 
SolrCore gets created. At least the core now reloads correctly.

Hmm, yeah ... the lifecycle implications and general API changes involved in 
fixing this bug are definitely tricky ... i'm not eager to rush into adding a 
new method to CloseHook.  If we do add something, i think it might be better to 
consider a general "ReloadHook" that could inform components when a SolrCore is 
about to be reloaded, and then followup with the new SolrCore instance once 
it's created, maybe something like...

{code}
public abstract ReloadHook {
  public abstract void preReload(SolrCore oldCore);
  public abstract void postReload(SolrCore oldCore, SolrCore newCore);
}
{code}

bq. This approach has one major disadvantage - There will be a short period 
where the suggester won't work since we close it before the new core has been 
registered.

One way we might be able to mitigate that is by: a) changing the lock factory 
we use on the suggester Directory; 2) subclassing  AnalyzingInfixSuggester to 
be aware of the reloading taking place.  

The idea being that when AnalyzingInfixLookupFactory initially constructs the 
FSDirectory, it could explicitly configure something like the 
SingleInstanceLockFactory - that should allow 2 instances of 
AnalyzingInfixSuggester (in the same JVM) open it at the same time -- but then, 
to prevent corruption risk if both Suggester instances try to write to that 
Directory, we need to subclass them and customize them to know when the 
"reload" is taking place, so the old one blocks itself from doing anymore 
writes.

so suggestions would still be available while waiting for the new core to 
start, but not updates to the dictionary.

----

This is definitely hairy.

> Core fails to reload when AnalyzingInfixSuggester is used as a Suggester
> ------------------------------------------------------------------------
>
>                 Key: SOLR-6246
>                 URL: https://issues.apache.org/jira/browse/SOLR-6246
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.8, 4.8.1, 4.9
>            Reporter: Varun Thacker
>             Fix For: 5.0, 4.10
>
>         Attachments: SOLR-6246-test.patch, SOLR-6246-test.patch, 
> SOLR-6246.patch
>
>
> LUCENE-5477 - added near-real-time suggest building to 
> AnalyzingInfixSuggester. One of the changes that went in was a writer is 
> persisted now to support real time updates via the add() and update() methods.
> When we call Solr's reload command, a new instance of AnalyzingInfixSuggester 
> is created. When trying to create a new writer on the same Directory a lock 
> cannot be obtained and Solr fails to reload the core.
> Also when AnalyzingInfixLookupFactory throws a RuntimeException we should 
> pass along the original message.
> I am not sure what should be the approach to fix it. Should we have a 
> reloadHook where we close the writer?



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to