Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2793

Schema compatibilty should consider fullname of records

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.9.2
    • None
    • java
    • None

    Description

      Consider the following example:

      Schema writerSchema = Schema.createRecord("fieldname", null, "namespace1", false, Collections.emptyList());
      Schema readerSchema = Schema.createRecord("fieldname", null, "namespace2", false, Collections.emptyList());
      
      // compat.getType() should be SchemaCompatibilityType.INCOMPATIBLE, but is actually SchemaCompatibilityType.COMPATIBLE  
      SchemaPairCompatibility compat = SchemaCompatibility.checkReaderWriterCompatibility(readerSchema, writerSchema2)

      I would expect the validation to yield an incompatible result, as records should have identical fullnames.

      This issue is similar to AVRO-2322, but vice versa: Here the namespace differs, not the record name.

      The root cause seems to be in SchemaCompatibility::schemaNameEquals, where getName() is used instead of getFullName().

      Is there any reason not to be strict here and use the fullname for validation? We ran into severe problems after changing a record's namespace in a newer schema version. The Avro schema compatibiltiy check ran through fine, so we deployed with confidence. However, the change then caused problems both for Confluent's Kafka S3 Connector as well as for Amazon Athena when reading data produced by the new schema.

      Attachments

        Activity

          People

            Unassigned Unassigned
            pederpansen Jurgis Pods
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: