Re: How to swap two cores and then unload one of them

2016-09-12 Thread Fabrizio Fortino
Hi George,

Thank you for getting back to me.

I am using Solr 6.

I need to use coreContainer because I have created a CoreAdminHandler
extension.

Thanks,
Fabrizio

On Sun, Sep 11, 2016 at 6:42 PM, Georg Sorst <georg.so...@gmail.com> wrote:

> Hi Fabrizio,
>
> which Solr version are you using? In more recent versions (starting with 5
> I think) you should not use the coreContainer directly but instead go
> through the HTTP API (which also supports the swap operation) or use SolrJ.
>
> Best,
> Georg
>
> Fabrizio Fortino <ffort...@gilt.com> schrieb am Mo., 29. Aug. 2016 11:53:
>
> > I have a NON-Cloud Solr and I am trying to use the swap functionality to
> > push an updated core into production without downtime.
> >
> > Here are the steps I am executing
> > 1. Solr is up and running with a single core (name = 'livecore')
> > 2. I create a new core with the latest version of my documents (name =
> > 'newcore')
> > 3. I swap the cores -> coreContainer.swap("newcore", "livecore")
> > 4. I try to unload "newcore" (that points to the old one) and remove all
> > the related dirs -> coreContainer.unload("newcore", true, true, true)
> >
> > The first three operations are OK. But when I try to execute the last one
> > the Solr log starts printing the following messages forever
> >
> > 61424 INFO (pool-1-thread-1) [ x:newcore] o.a.s.c.SolrCore Core newcore
> is
> > not yet closed, waiting 100 ms before checking again.
> >
> > I have opened an issue on this problem (
> > https://issues.apache.org/jira/browse/SOLR-8757) but I have not received
> > any answer yet.
> >
> > In the meantime I have found the following workaround: I try to manually
> > close all the core references before unloading it. Here is the code:
> >
> > SolrCore core = coreContainer.create("newcore", coreProps)
> > coreContainer.swap("newcore", "livecore")
> > // the old livecore is now newcore, so unload it and remove all the
> > related dirsSolrCore oldCore = coreContainer.getCore("newCore")while
> > (oldCore.getOpenCount > 1) {
> >   oldCore.close()
> > }
> > coreContainer.unload("newcore", true, true, true)
> >
> >
> > This seemed to work but there is some race conditions and from time to
> time
> > I get a ConcurrentModificationException and then an abnormal CPU
> > consumption.
> >
> > I filed a separate issue on this
> > https://issues.apache.org/jira/browse/SOLR-9208 but this is not
> considered
> > an issue by the Solr committers. The suggestion is to move and discuss it
> > here in the mailing list.
> >
> > If this is not an issue, what are the steps to swap to cores and unload
> one
> > of them?
> >
> > Thanks a lot,
> > Fabrizio
> >
>


How to swap two cores and then unload one of them

2016-08-29 Thread Fabrizio Fortino
I have a NON-Cloud Solr and I am trying to use the swap functionality to
push an updated core into production without downtime.

Here are the steps I am executing
1. Solr is up and running with a single core (name = 'livecore')
2. I create a new core with the latest version of my documents (name =
'newcore')
3. I swap the cores -> coreContainer.swap("newcore", "livecore")
4. I try to unload "newcore" (that points to the old one) and remove all
the related dirs -> coreContainer.unload("newcore", true, true, true)

The first three operations are OK. But when I try to execute the last one
the Solr log starts printing the following messages forever

61424 INFO (pool-1-thread-1) [ x:newcore] o.a.s.c.SolrCore Core newcore is
not yet closed, waiting 100 ms before checking again.

I have opened an issue on this problem (
https://issues.apache.org/jira/browse/SOLR-8757) but I have not received
any answer yet.

In the meantime I have found the following workaround: I try to manually
close all the core references before unloading it. Here is the code:

SolrCore core = coreContainer.create("newcore", coreProps)
coreContainer.swap("newcore", "livecore")
// the old livecore is now newcore, so unload it and remove all the
related dirsSolrCore oldCore = coreContainer.getCore("newCore")while
(oldCore.getOpenCount > 1) {
  oldCore.close()
}
coreContainer.unload("newcore", true, true, true)


This seemed to work but there is some race conditions and from time to time
I get a ConcurrentModificationException and then an abnormal CPU
consumption.

I filed a separate issue on this
https://issues.apache.org/jira/browse/SOLR-9208 but this is not considered
an issue by the Solr committers. The suggestion is to move and discuss it
here in the mailing list.

If this is not an issue, what are the steps to swap to cores and unload one
of them?

Thanks a lot,
Fabrizio


solr 5.5: swap + unload does not work

2016-03-03 Thread Fabrizio Fortino
I have created a Solr CoreAdminHandler extension with the goal to swap two
cores and remove the old one.

My code looks like this:

SolrCore core = coreContainer.create("newcore", coreProps)
coreContainer.swap("newcore", "livecore")
// the old livecore is now newcore, so unload it and remove all the related
dirs
coreContainer.unload("newcore", true, true, true)

After the last statement get executed the Solr log starts printing the
following messages forever

61424 INFO (pool-1-thread-1) [ x:newcore] o.a.s.c.SolrCore Core newcore is
not yet closed, waiting 100 ms before checking again.

I tried to call the close() method on the SolrCore instance before and
after the unload but the result is the same.


I opened an issue on the problem (
https://issues.apache.org/jira/browse/SOLR-8757) but the jira has not been
acknowledged yet.

I'd like to know if my code is wrong or is a Solr bug. In case of a bug it
would be nice to have a workaround.

Thanks