Forward/backward compatible schema evolution
At the moment, Bottled Water detects when Postgres schema changes happen (e.g. a column is added to a table), generates a new Avro schema for the table, and notifies the client. The client publishes the new schema to the schema registry, and writes subsequent messages to Kafka using the new schema.
This mostly works, except that we currently have to disable schema compatibility checking in the schema registry (avro.compatibility.level=none), because the schema changes currently do not meet Avro's schema evolution requirements.
This task is to fix the autogenerated schemas to be forward and backward compatible, so that we can turn on compatibility checking in the schema registry. There is no fundamental reason we can't do this, just a missing feature in the Avro C implementation.
If you add a field to an Avro record, it must have a default value (which may be null). Similarly, if you remove a field, it must have previously had a default value. These restrictions ensure that clients with an old schema can still ready data written with a new schema, and vice versa.
Currently our autogenerated schemas do not have default values, because libavro currently does not support defaults. This can be added, but will require patching libavro. Then we'll have to make sure that Bottled Water is built against the patched version of libavro.