Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-6180

Callers of ManagedIndexSchema mutators should hold the schemaUpdateLock

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 4.10, 6.0
    • Schema and Analysis
    • None

    Description

      Consider the code in FieldResource.java:

      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.");
      }
      

      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.

      Attachments

        1. SchemaLockTest.java
          11 kB
          Gregory Chanan
        2. SOLR-6180.patch
          21 kB
          Steven Rowe
        3. SOLR-6180.patch
          15 kB
          Gregory Chanan

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            sarowe Steven Rowe
            gchanan Gregory Chanan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment