[
https://issues.apache.org/jira/browse/AVRO-2793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17080419#comment-17080419
]
Jurgis Pods commented on AVRO-2793:
-----------------------------------
I can certainly do that. However, upon further inspection, there seems to be a
test case that explicitly checks that schemas containing records with different
namespaces are compatible. There must be a reason someone put that test there,
doesn't it?
[https://github.com/apache/avro/blob/master/lang/java/avro/src/test/java/org/apache/avro/TestSchemaCompatibility.java#L250]
> Schema compatibilty should consider fullname of records
> -------------------------------------------------------
>
> Key: AVRO-2793
> URL: https://issues.apache.org/jira/browse/AVRO-2793
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.9.2
> Reporter: Jurgis Pods
> Priority: Major
>
> Consider the following example:
> {code:java}
> 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){code}
> 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|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/SchemaCompatibility.java#L97],
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)