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 >