Schema-Evolution und Kompatibilitätsmodi
Lernen Sie, wie die Confluent Schema Registry bei Schemaänderungen die Kompatibilität durchsetzt und wie Sie sicher zwischen rückwärts-, vorwärts- und vollständiger Kompatibilität wählen.
Schema-Evolution und Kompatibilitätsmodi ist eine kostenlose Apache Kafka & Stream Processing Fundamentals-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Apache Kafka & Stream Processing Fundamentals-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Apache Kafka & Stream Processing Fundamentals-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Why Schemas Evolve
Data contracts change over time — you add fields, deprecate others, rename things. Schema evolution is the discipline of changing schemas without breaking existing producers and consumers.
The Compatibility Problem
Producers and consumers often deploy at different times. A new producer might emit a v2 schema while old consumers still expect v1.
Without rules, that mismatch causes deserialization failures in production.
Backward Compatibility
Backward: new schema can read data written with the old schema.
- Safe changes: delete a field, add a field with a default.
- Upgrade consumers first.
Forward Compatibility
Forward: old schema can read data written with the new schema.
- Safe changes: add a field, delete a field that had a default.
- Upgrade producers first.
Full Compatibility
Full requires both backward and forward compatibility at once.
- Only changes safe in both directions are allowed (add/remove fields with defaults).
- Producers and consumers can be upgraded in any order.
Transitive Variants
Each mode has a transitive version (BACKWARD_TRANSITIVE, etc.).
Non-transitive checks only against the latest schema; transitive checks against all prior versions — stronger guarantees, more constraints.
Setting Compatibility
Compatibility is configured per subject (or globally) via the Schema Registry REST API.
curl -X PUT \
http://localhost:8081/config/orders-value \
-H 'Content-Type: application/vnd.schemaregistry.v1+json' \
-d '{"compatibility": "BACKWARD"}'A Backward-Safe Avro Change
Adding a field with a default keeps old data readable under BACKWARD mode.
{
"type": "record",
"name": "Order",
"fields": [
{"name": "id", "type": "string"},
{"name": "amount", "type": "double"},
{"name": "currency", "type": "string", "default": "USD"}
]
}Testing Before You Register
The registry can check a candidate schema against the current one before you commit it.
curl -X POST \
http://localhost:8081/compatibility/subjects/orders-value/versions/latest \
-H 'Content-Type: application/vnd.schemaregistry.v1+json' \
-d '{"schema": "...escaped avro..."}'Breaking Changes
Changes that almost always break compatibility:
- Renaming a field (treated as delete + add).
- Changing a field's type incompatibly.
- Adding a required field with no default.
For these, create a new subject/topic version instead.
Choosing a Mode
Rules of thumb:
- BACKWARD (default) when you upgrade consumers first.
- FORWARD when producers lead.
- FULL for independently deployed teams.
- Use transitive variants for long-lived, replayable topics.
Quick Check
Test your understanding of compatibility modes.
Recap
You learned schema evolution and compatibility modes.
- BACKWARD: new reads old, upgrade consumers first.
- FORWARD: old reads new, upgrade producers first.
- FULL: both, any order.
- Transitive variants check all prior versions; renames and required no-default fields break compatibility.
Häufig gestellte Fragen
Ist die Lektion „Schema-Evolution und Kompatibilitätsmodi“ kostenlos?
Ja — der vollständige Text von „Schema-Evolution und Kompatibilitätsmodi“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Apache Kafka & Stream Processing Fundamentals-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Apache Kafka & Stream Processing Fundamentals-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Schema-Evolution und Kompatibilitätsmodi“?
Lernen Sie, wie die Confluent Schema Registry bei Schemaänderungen die Kompatibilität durchsetzt und wie Sie sicher zwischen rückwärts-, vorwärts- und vollständiger Kompatibilität wählen. Du übst Apache Kafka & Stream Processing Fundamentals mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Apache Kafka & Stream Processing Fundamentals zu starten?
Keine Vorkenntnisse erforderlich. Apache Kafka & Stream Processing Fundamentals auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Schema-Evolution und Kompatibilitätsmodi“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Apache Kafka & Stream Processing Fundamentals-Lektion Code schreiben und ausführen?
Ja. Jede Apache Kafka & Stream Processing Fundamentals-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Warum Schemaverwaltung?
- Avro- und Protobuf-Schemas
- Schema Registry in Kafka integrieren
- Schema-Evolution und Kompatibilitätsmodi