Skip to content
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

Support avro schema evolution #1305

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

morrone
Copy link
Collaborator

@morrone morrone commented Dec 6, 2023

This pair of patches allows avro schema evolution in a kafka registry. It required two changes:

  1. Add avro "default" values to each field in a schema
  2. Always generate the avro schema and attempt to push it to the kafka registry (because it may be newer than what is in the registry).

In order to support avro schema evolution, add naive default
values to each field (except the timestamp, which ldms metric
sets will always contain). Technically for the default form of
schema evolution in kafka, we only need to have defaults for
any _new_ fields that we add when evolving a schema. However,
we are not tracking the various iterations of the schema over
time, so just setting defaults for all fields allows us
greater flexibility.
The name alone of the avro schema in the kafka registry is insufficient to
match an ldms schema. A schema in the kafka registry is uniquely identified
by a combination of a name and an integer ID. The schema with the same name
can evolve over time, and each iteration if given new unique ID.

We want to _always_ generate an avro schema, and attempt to push it to the
registry. When the schema hasn't changed, the kafka registry handles the
attempt to add a duplicate gracefully. The existing ID is used. But when
the schema is different, the registry applies schema compatibility checks,
and if they pass it updates the schema with a new ID.

This patch first looks up the schema name in the registry, then
generates its own schema and attemps to push it. This allows us to generate
informational messages about whether the schema is new, existing, or
updated/evolved.
@morrone morrone requested a review from tom95858 December 6, 2023 18:19
@morrone
Copy link
Collaborator Author

morrone commented Dec 9, 2023

Fixes #1262

@morrone
Copy link
Collaborator Author

morrone commented Feb 1, 2024

@tom95858 ping. I've been able to evolve schemas multiple times with these patches, and I'm carrying these in the toss release of ldms. We couldn't be able to function without them.

@tom95858 tom95858 merged commit 552c4ad into ovis-hpc:OVIS-4 Feb 1, 2024
14 checks passed
@morrone morrone deleted the avro_schema_evolution branch September 4, 2024 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants