You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Steve Rowe (JIRA)" <ji...@apache.org> on 2014/07/08 05:20:34 UTC

[jira] [Updated] (SOLR-6180) Callers of ManagedIndexSchema mutators should hold the schemaUpdateLock

     [ https://issues.apache.org/jira/browse/SOLR-6180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Rowe updated SOLR-6180:
-----------------------------

    Attachment: SOLR-6180.patch

Looks good.

The attached patch combines the schema lock test with Gregory's other patch.  When I ran the new test without the other patch I got a roughly 50% failure rate when I put a 50ms sleep between {{addField()}} and {{SolrCore.setLatestSchema()}} in {{FieldResource.put()}}, and 100% at 125ms.

Committing shortly.

> Callers of ManagedIndexSchema mutators should hold the schemaUpdateLock
> -----------------------------------------------------------------------
>
>                 Key: SOLR-6180
>                 URL: https://issues.apache.org/jira/browse/SOLR-6180
>             Project: Solr
>          Issue Type: Bug
>          Components: Schema and Analysis
>            Reporter: Gregory Chanan
>            Priority: Minor
>         Attachments: SOLR-6180.patch, SOLR-6180.patch, SchemaLockTest.java
>
>
> Consider the code in FieldResource.java:
> {code}
> SchemaField newField = oldSchema.newField(fieldName, fieldType, map);
> IndexSchema newSchema = oldSchema.addField(newField, copyFieldNames);
> if (null != newSchema) {
>   getSolrCore().setLatestSchema(newSchema);
>   success = true;
> } else {
>   throw new SolrException(ErrorCode.SERVER_ERROR, "Failed to add field.");
> }
> {code}
> The schema update lock is only held during the call to addField, so there is no guarantee that the schema we are setting later is actually the latest schema.  This would rarely happen, but it's possible that between the time we gave up the lock and the time we set the schema that we got a new schema from ZK.  We'd end up overwriting the new schema, possibly missing newly added fields.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org