CodePark/ questions / Message design, schemas & versioning
START PRACTICINGPRACTICE
Backend question · Message queues & streaming › Message design, schemas & versioning

A topic uses Avro with the schema registry in BACKWARD compatibility mode. Which change to the Order schema will the registry accept?

Adding a new field currency with a default value of "EUR"

Under BACKWARD mode, the new schema must be able to read old records. "Adding a new field currency with a default value of "EUR"" works. Old records do not have this field, so the reader fills in the default.

The other changes are rejected:

• "Adding a new field
currency with no default": the reader has no value to fill in for old records.
• "Renaming
total to amount": Avro sees this as removing one field and adding a new required field with no default.
• "Changing
customerId from string to int": Avro cannot promote (convert) a string to an int.