mirror of https://github.com/apache/lucene.git
SOLR-4805,SOLR-4843: SolreCore#reload should not call preRegister and publish a DOWN state to ZooKeeper.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1491310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7f90c7f8ea
commit
d35702de9a
|
@ -125,6 +125,9 @@ Bug Fixes
|
|||
* SOLR-4891: JsonLoader should preserve field value types from the JSON content stream.
|
||||
(Steve Rowe)
|
||||
|
||||
* SOLR-4805: SolreCore#reload should not call preRegister and publish a DOWN state to
|
||||
ZooKeeper. (Mark Miller, Jared Rodriguez)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -1283,11 +1283,7 @@ public final class ZkController {
|
|||
// before becoming available, make sure we are not live and active
|
||||
// this also gets us our assigned shard id if it was not specified
|
||||
publish(cd, ZkStateReader.DOWN, false);
|
||||
// shardState and shardRange are for one-time use only, thereafter the actual values in the Slice should be used
|
||||
if (Slice.CONSTRUCTION.equals(cd.getCloudDescriptor().getShardState())) {
|
||||
cd.getCloudDescriptor().setShardState(null);
|
||||
cd.getCloudDescriptor().setShardRange(null);
|
||||
}
|
||||
|
||||
String coreNodeName = getCoreNodeName(cd);
|
||||
|
||||
// make sure the node name is set on the descriptor
|
||||
|
|
|
@ -423,6 +423,9 @@ public class CoreContainer
|
|||
public SolrCore call() {
|
||||
SolrCore c = null;
|
||||
try {
|
||||
if (zkSys.getZkController() != null) {
|
||||
preRegisterInZk(p);
|
||||
}
|
||||
c = create(p);
|
||||
registerCore(p.isTransient(), name, c, false);
|
||||
} catch (Throwable t) {
|
||||
|
@ -630,22 +633,6 @@ public class CoreContainer
|
|||
throw new RuntimeException( "Invalid core name: "+name );
|
||||
}
|
||||
|
||||
if (zkSys.getZkController() != null) {
|
||||
// this happens before we can receive requests
|
||||
try {
|
||||
zkSys.getZkController().preRegister(core.getCoreDescriptor());
|
||||
} catch (KeeperException e) {
|
||||
log.error("", e);
|
||||
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"", e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
log.error("", e);
|
||||
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"", e);
|
||||
}
|
||||
}
|
||||
|
||||
SolrCore old = null;
|
||||
|
||||
if (isShutDown) {
|
||||
|
@ -991,6 +978,9 @@ public class CoreContainer
|
|||
// the wait as a consequence of shutting down.
|
||||
try {
|
||||
if (core == null) {
|
||||
if (zkSys.getZkController() != null) {
|
||||
preRegisterInZk(desc);
|
||||
}
|
||||
core = create(desc); // This should throw an error if it fails.
|
||||
core.open();
|
||||
registerCore(desc.isTransient(), name, core, false);
|
||||
|
@ -1186,6 +1176,21 @@ public class CoreContainer
|
|||
}
|
||||
}
|
||||
|
||||
public void preRegisterInZk(final CoreDescriptor p) {
|
||||
try {
|
||||
zkSys.getZkController().preRegister(p);
|
||||
} catch (KeeperException e) {
|
||||
log.error("", e);
|
||||
throw new ZooKeeperException(
|
||||
SolrException.ErrorCode.SERVER_ERROR, "", e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
log.error("", e);
|
||||
throw new ZooKeeperException(
|
||||
SolrException.ErrorCode.SERVER_ERROR, "", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getSolrHome() {
|
||||
return solrHome;
|
||||
}
|
||||
|
|
|
@ -851,6 +851,10 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
if (cc != null && cc.isZooKeeperAware() && Slice.CONSTRUCTION.equals(cd.getCloudDescriptor().getShardState())) {
|
||||
// set update log to buffer before publishing the core
|
||||
getUpdateHandler().getUpdateLog().bufferUpdates();
|
||||
|
||||
cd.getCloudDescriptor().setShardState(null);
|
||||
cd.getCloudDescriptor().setShardRange(null);
|
||||
|
||||
}
|
||||
// For debugging
|
||||
// numOpens.incrementAndGet();
|
||||
|
|
|
@ -505,7 +505,9 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
|||
}
|
||||
}
|
||||
dcore.setCoreProperties(coreProperties);
|
||||
|
||||
if (coreContainer.getZkController() != null) {
|
||||
coreContainer.preRegisterInZk(dcore);
|
||||
}
|
||||
SolrCore core = coreContainer.create(dcore);
|
||||
|
||||
coreContainer.register(name, core, false);
|
||||
|
|
|
@ -157,6 +157,10 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
|
|||
|
||||
dcore.setDataDir(dataDir4.getAbsolutePath());
|
||||
|
||||
if (container1.getZkController() != null) {
|
||||
container1.preRegisterInZk(dcore);
|
||||
}
|
||||
|
||||
SolrCore core = container1.create(dcore);
|
||||
|
||||
container1.register(core, false);
|
||||
|
|
|
@ -136,12 +136,21 @@ public class SolrIndexSplitterTest extends SolrTestCaseJ4 {
|
|||
CoreDescriptor dcore1 = new CoreDescriptor(h.getCoreContainer(), "split1", h.getCore().getCoreDescriptor().getInstanceDir());
|
||||
dcore1.setDataDir(indexDir1.getAbsolutePath());
|
||||
dcore1.setSchemaName("schema12.xml");
|
||||
|
||||
if (h.getCoreContainer().getZkController() != null) {
|
||||
h.getCoreContainer().preRegisterInZk(dcore1);
|
||||
}
|
||||
|
||||
core1 = h.getCoreContainer().create(dcore1);
|
||||
h.getCoreContainer().register(core1, false);
|
||||
|
||||
CoreDescriptor dcore2 = new CoreDescriptor(h.getCoreContainer(), "split2", h.getCore().getCoreDescriptor().getInstanceDir());
|
||||
dcore2.setDataDir(indexDir2.getAbsolutePath());
|
||||
dcore2.setSchemaName("schema12.xml");
|
||||
|
||||
if (h.getCoreContainer().getZkController() != null) {
|
||||
h.getCoreContainer().preRegisterInZk(dcore2);
|
||||
}
|
||||
core2 = h.getCoreContainer().create(dcore2);
|
||||
h.getCoreContainer().register(core2, false);
|
||||
|
||||
|
|
|
@ -207,6 +207,11 @@ public class TestHarness extends BaseTestHarness {
|
|||
CoreDescriptor dcore = new CoreDescriptor(container, coreName, solrConfig.getResourceLoader().getInstanceDir());
|
||||
dcore.setConfigName(solrConfig.getResourceName());
|
||||
dcore.setSchemaName(indexSchema.getResourceName());
|
||||
|
||||
if (container.getZkController() != null) {
|
||||
container.preRegisterInZk(dcore);
|
||||
}
|
||||
|
||||
SolrCore core = new SolrCore(coreName, dataDirectory, solrConfig, indexSchema, dcore);
|
||||
container.register(coreName, core, false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue