[ 
https://issues.apache.org/jira/browse/KAFKA-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15952397#comment-15952397
 ] 

ASF GitHub Bot commented on KAFKA-4810:
---------------------------------------

GitHub user vitaly-pushkar opened a pull request:

    https://github.com/apache/kafka/pull/2787

    KAFKA-4810: Kafka Connect SchemaBuilder unset fields validation fix

    > Currently SchemaBuilder is strict when checking that certain fields have 
not been set yet (e.g. version, name, doc). It just checks that the field is 
null. This is intended to protect the user from buggy code that overwrites a 
field with different values, but it's a bit too strict currently. In generic 
code for converting schemas (e.g. Converters) you will sometimes initialize a 
builder with these values (e.g. because you get a SchemaBuilder for a logical 
type, which sets name & version), but then have generic code for setting name & 
version from the source schema.
    
    Changed the validation method to not only check if a field is null but also 
to check if the new value that is being set is the same as the current value of 
the field.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/vitaly-pushkar/kafka 
KAFKA-4810-check-if-can-set-field-same-value

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2787.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2787
    
----
commit 404995bf21ca645475b4a8a002fa6a12e6619fcd
Author: Vitaly Pushkar <vitaly.push...@gmail.com>
Date:   2017-04-01T20:29:28Z

    Change field null validation method to respect the previously set same value

----


> SchemaBuilder should be more lax about checking that fields are unset if they 
> are being set to the same value
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-4810
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4810
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 0.10.2.0
>            Reporter: Ewen Cheslack-Postava
>            Assignee: Vitaly Pushkar
>              Labels: newbie
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Currently SchemaBuilder is strict when checking that certain fields have not 
> been set yet (e.g. version, name, doc). It just checks that the field is 
> null. This is intended to protect the user from buggy code that overwrites a 
> field with different values, but it's a bit too strict currently. In generic 
> code for converting schemas (e.g. Converters) you will sometimes initialize a 
> builder with these values (e.g. because you get a SchemaBuilder for a logical 
> type, which sets name & version), but then have generic code for setting name 
> & version from the source schema.
> We saw this bug in practice with Confluent's AvroConverter, so it's likely it 
> could trip up others as well. You can work around the issue, but it would be 
> nice if exceptions were only thrown if you try to overwrite an existing value 
> with a different value.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to