[
https://issues.apache.org/jira/browse/AVRO-2294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ryan Sobol updated AVRO-2294:
-----------------------------
Description:
The schema validator reports false negatives for any incompatible change to an
{{enum}} type. I found this bug when invoking the
{{SchemaValidatorBuilder.mutualReadStrategy()}} method via Confluent's [Schema
Registry|https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/avro/AvroCompatibilityChecker.java#L44].
This bug can be traced to the
[{{Symbol.hasErrors()}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L394]
method. When it is invoked with a
[{{Symbol.EnumAdjustAction}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L510]
object, it always (and therefore incorrectly) returns {{false}}. This is a
problem because these objects can definitely have errors—masquerading along
side
[{{adjustments}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java#L502].
The root cause of this bug has to do with objects of the
{{Symbol.EnumAdjustAction}} class being assigned a
[{{Kind.EXPLICIT_ACTION}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L504]
kind. This kind informs the {{Symbol.hasErrors()}} method to always [{{return
false}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L409]
without checking if there are any errors hiding inside the object's
{{adjustments}}.
As best I understand, there are a few possible solutions:
# Fix the {{Symbol.hasErrors()}} method so it checks the objects
{{adjustments}}.
# Fix the {{Symbol.EnumAdjustAction}} class so its objects have a different
{{kind}}.
# Fix both 1 and 2.
I'm not 100% familiar with the intention of the {{Symbol}} class. However, if
given a little guidance on the preferred solution, I'm happy to submit a pull
request to fix the bug.
was:
The schema validator reports false negatives for any incompatible change to an
{{enum}} type. I found this bug when invoking the
{{SchemaValidatorBuilder.mutualReadStrategy()}} method via Confluent's [Schema
Registry|https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/avro/AvroCompatibilityChecker.java#L44].
This bug can be traced to the
[{{Symbol.hasErrors()}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L394]
method. When it is invoked with a
[{{Symbol.EnumAdjustAction}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L509]
object, it always (and therefore incorrectly) returns {{false}}. This is a
problem because these objects can definitely have errors—masquerading along
side
[{{adjustments}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java#L502].
The root cause of this bug has to do with objects of the
{{Symbol.EnumAdjustAction}} class being assigned a
[{{Kind.EXPLICIT_ACTION}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L504]
kind. This kind informs the {{Symbol.hasErrors()}} method to always [{{return
false}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L409]
without checking if there are any errors hiding inside the object's
{{adjustments}}.
As best I understand, there are a few possible solutions:
# Fix the {{Symbol.hasErrors()}} method so it checks the objects
{{adjustments}}.
# Fix the {{Symbol.EnumAdjustAction}} class so its objects have a different
{{kind}}.
# Fix both 1 and 2.
I'm not 100% familiar with the intention of the {{Symbol}} class. However, if
given a little guidance on the preferred solution, I'm happy to submit a pull
request to fix the bug.
> The schema validator reports false negatives for any incompatible change to
> an enum type
> ----------------------------------------------------------------------------------------
>
> Key: AVRO-2294
> URL: https://issues.apache.org/jira/browse/AVRO-2294
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.8.2
> Reporter: Ryan Sobol
> Priority: Major
>
> The schema validator reports false negatives for any incompatible change to
> an {{enum}} type. I found this bug when invoking the
> {{SchemaValidatorBuilder.mutualReadStrategy()}} method via Confluent's
> [Schema
> Registry|https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/avro/AvroCompatibilityChecker.java#L44].
> This bug can be traced to the
> [{{Symbol.hasErrors()}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L394]
> method. When it is invoked with a
> [{{Symbol.EnumAdjustAction}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L510]
> object, it always (and therefore incorrectly) returns {{false}}. This is a
> problem because these objects can definitely have errors—masquerading along
> side
> [{{adjustments}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java#L502].
> The root cause of this bug has to do with objects of the
> {{Symbol.EnumAdjustAction}} class being assigned a
> [{{Kind.EXPLICIT_ACTION}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L504]
> kind. This kind informs the {{Symbol.hasErrors()}} method to always
> [{{return
> false}}|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java#L409]
> without checking if there are any errors hiding inside the object's
> {{adjustments}}.
> As best I understand, there are a few possible solutions:
> # Fix the {{Symbol.hasErrors()}} method so it checks the objects
> {{adjustments}}.
> # Fix the {{Symbol.EnumAdjustAction}} class so its objects have a different
> {{kind}}.
> # Fix both 1 and 2.
> I'm not 100% familiar with the intention of the {{Symbol}} class. However, if
> given a little guidance on the preferred solution, I'm happy to submit a pull
> request to fix the bug.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)