-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More detail on schema evolution please #1
Comments
Here's a test I used to try and work out the compatibility matrix (and failed). I copied the generated classes and renamed them "Sensor1" and "Sensor2" so I could work with them both in the same class loader.
Only the "native" test works (i.e. the codec can serialize and deserialize an object of type Sensor2). When you try and convert from old to new (Sensor1 to Sensor2) the temperature is ignored, and when you try and go the other way there is an exception in the codec because the "orientation" field is missing. |
@dsyer Let me try that, I had both streams deployed and it works. Field renaming only works in one direction unfortunately. For example on v2 we renamed it to internalTemperature, and if v1 tries to read its ignored. There's some guidelines on avro on what you can expect when doing things such as (field renaming, adding fields, removing fields). I started the schema evolution discussion here: https://github.com/viniciusccarvalho/schema-evolution-samples#schema-evolution-recap |
There should not be any difference between using the generated classes and "GenericRecord", the IMO the advantage of using generic record containers is that we don't need to deal with class renaming on the same class loader. |
Here's a sample of writing V1 and reading on V2, like I said field renaming breaks forward compatibility, but not backward compatibility.
} |
Your test fails for me in the same way mine did (the last assertion is false because the internal temperature is 0). |
I just ran this: https://github.com/viniciusccarvalho/schema-evolution-samples/blob/master/producer_v1/src/test/java/org/springframework/cloud/stream/schema/AvroVersioningTests.java and it passed, Tests seems to be just fine at Travis as well: https://travis-ci.org/viniciusccarvalho/schema-evolution-samples/builds So I really don't know what could be going wrong |
I know there's a link to another blog, but a lazy reader would like to know the punchline! Given the two (incompatible) example objects how do the consumers and producers work together? Which combinations work, and which do not?
The text was updated successfully, but these errors were encountered: