You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2017/03/28 19:04:21 UTC
lucene-solr:branch_6x: SOLR-10365: Handle a
SolrCoreInitializationException while publishing core state during SolrCore
creation
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 9705e9598 -> c37cb7e94
SOLR-10365: Handle a SolrCoreInitializationException while publishing core state during SolrCore creation
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c37cb7e9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c37cb7e9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c37cb7e9
Branch: refs/heads/branch_6x
Commit: c37cb7e94e312fbfe650cb4cc4e812dbc2034478
Parents: 9705e95
Author: Ishan Chattopadhyaya <is...@apache.org>
Authored: Wed Mar 29 00:26:31 2017 +0530
Committer: Ishan Chattopadhyaya <is...@apache.org>
Committed: Wed Mar 29 00:33:58 2017 +0530
----------------------------------------------------------------------
solr/CHANGES.txt | 3 ++
.../org/apache/solr/cloud/ZkController.java | 4 +++
.../org/apache/solr/core/CoreContainer.java | 6 ++--
.../core/SolrCoreInitializationException.java | 32 ++++++++++++++++++++
4 files changed, 41 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c37cb7e9/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 10197d8..911efba 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -83,6 +83,9 @@ Other Changes
* SOLR-10343: Update Solr default/example and test configs to use SynonymGraphFilterFactory. (Steve Rowe)
+* SOLR-10365: Handle a SolrCoreInitializationException while publishing core state during SolrCore creation
+ (Ishan Chattopadhyaya)
+
================== 6.5.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c37cb7e9/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index c47cc2a..fe32d58 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -85,6 +85,7 @@ import org.apache.solr.core.CloudConfig;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.core.SolrCore;
+import org.apache.solr.core.SolrCoreInitializationException;
import org.apache.solr.logging.MDCLoggingContext;
import org.apache.solr.update.UpdateLog;
import org.apache.zookeeper.CreateMode;
@@ -1207,6 +1208,9 @@ public class ZkController {
}
}
}
+ } catch (SolrCoreInitializationException ex) {
+ // The core had failed to initialize (in a previous request, not this one), hence nothing to do here.
+ log.info("The core '{}' had failed to initialize before.", cd.getName());
}
ZkNodeProps m = new ZkNodeProps(props);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c37cb7e9/solr/core/src/java/org/apache/solr/core/CoreContainer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index ad832d3..104110c 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1249,7 +1249,7 @@ public class CoreContainer {
* @see SolrCore#close()
* @param name the core name
* @return the core if found, null if a SolrCore by this name does not exist
- * @exception SolrException if a SolrCore with this name failed to be initialized
+ * @exception SolrCoreInitializationException if a SolrCore with this name failed to be initialized
*/
public SolrCore getCore(String name) {
@@ -1268,9 +1268,7 @@ public class CoreContainer {
// error with the details for clients attempting to access it.
CoreLoadFailure loadFailure = getCoreInitFailures().get(name);
if (null != loadFailure) {
- throw new SolrException(ErrorCode.SERVER_ERROR, "SolrCore '" + name +
- "' is not available due to init failure: " +
- loadFailure.exception.getMessage(), loadFailure.exception);
+ throw new SolrCoreInitializationException(name, loadFailure.exception);
}
// otherwise the user is simply asking for something that doesn't exist.
return null;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c37cb7e9/solr/core/src/java/org/apache/solr/core/SolrCoreInitializationException.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCoreInitializationException.java b/solr/core/src/java/org/apache/solr/core/SolrCoreInitializationException.java
new file mode 100644
index 0000000..93b653c
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/core/SolrCoreInitializationException.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.core;
+
+import org.apache.solr.common.SolrException;
+
+public class SolrCoreInitializationException extends SolrException {
+
+ public SolrCoreInitializationException(ErrorCode code, String msg) {
+ super(code, msg);
+ }
+
+ public SolrCoreInitializationException(String coreName, Exception loadException) {
+ super(ErrorCode.SERVER_ERROR, "SolrCore '" + coreName +
+ "' is not available due to init failure: " +
+ loadException.getMessage(), loadException);
+ }
+}
\ No newline at end of file