Hi all:
I am new to Solr, and I am using Solr 6.4.2. I try to add fields and copyFields to schema programmatically as below. However, in a very few occasions, I see a few fields are not added but copyFields are added when I try to add a lot of fields and copyFields (about 80 fields, 40 copyFields (one field is source, the other is destination). This causes core initialization failure because the associated fields for copyFields do not exist? Can someone help me? Thank you! --Michael Hu synchronized (oldSchema.getSchemaUpdateLock()) { try { IndexSchema newSchema = oldSchema.addFields(newFields).addCopyFields(newCopyFields, true); if (null != newSchema) { core.setLatestSchema(newSchema); cmd.getReq().updateSchemaToLatest(); latestSchemaMap.put(core.getName(), newSchema); 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.error("At least one field to be added already exists in the schema - retrying."); oldSchema = core.getLatestSchema(); cmd.getReq().updateSchemaToLatest(); } catch (ManagedIndexSchema.SchemaChangedInZkException e) { log.debug("Schema changed while processing request - retrying."); oldSchema = core.getLatestSchema(); cmd.getReq().updateSchemaToLatest(); } }