SOLR-6145: In AddSchemaFieldsUpdateProcessor.processAdd(), handle ManagedIndexSchema.addFields() failures that won't benefit from retrying.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1601775 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Rowe 2014-06-10 21:23:09 +00:00
parent 5f2af20b04
commit 1b049e26ac
1 changed files with 8 additions and 4 deletions

View File

@ -316,10 +316,14 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
}
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