You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2014/06/10 23:23:09 UTC

svn commit: r1601775 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java

Author: sarowe
Date: Tue Jun 10 21:23:09 2014
New Revision: 1601775

URL: http://svn.apache.org/r1601775
Log:
SOLR-6145: In AddSchemaFieldsUpdateProcessor.processAdd(), handle ManagedIndexSchema.addFields() failures that won't benefit from retrying.

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java?rev=1601775&r1=1601774&r2=1601775&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.java Tue Jun 10 21:23:09 2014
@@ -316,10 +316,14 @@ public class AddSchemaFieldsUpdateProces
         }
         try {
           IndexSchema newSchema = oldSchema.addFields(newFields);
-          cmd.getReq().getCore().setLatestSchema(newSchema);
-          cmd.getReq().updateSchemaToLatest();
-          log.debug("Successfully added field(s) to the schema.");
-          break; // success - exit from the retry loop
+          if (null != newSchema) {
+            cmd.getReq().getCore().setLatestSchema(newSchema);
+            cmd.getReq().updateSchemaToLatest();
+            log.debug("Successfully added field(s) to the schema.");
+            break; // success - exit from the retry loop
+          } else {
+            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Failed to add fields.");
+          }
         } catch(ManagedIndexSchema.FieldExistsException e) {
           log.debug("At least one field to be added already exists in the schema - retrying.");
           // No action: at least one field to be added already exists in the schema, so retry