Bird
Raised Fist0

You have a Kafka topic with schema compatibility set to FORWARD. You want to add a new optional field to the schema without breaking existing consumers. Which approach should you take?

hard🚀 Application Q15 of Q15
Kafka - Schema Registry
You have a Kafka topic with schema compatibility set to FORWARD. You want to add a new optional field to the schema without breaking existing consumers. Which approach should you take?
AAdd the new field with a default value or make it nullable
BRemove an existing required field to simplify the schema
CAdd the new field without a default value
DChange the type of an existing field to a different primitive type
Step-by-Step Solution
Solution:
  1. Step 1: Understand FORWARD compatibility

    FORWARD compatibility means old schema can read data written with new schema.
  2. Step 2: Determine safe schema changes

    Adding optional fields with defaults or nullable types preserves forward compatibility.
  3. Step 3: Evaluate options

    Only Add the new field with a default value or make it nullable adds a field safely; others break compatibility or cause errors.
  4. Final Answer:

    Add the new field with a default value or make it nullable -> Option A
  5. Quick Check:

    Forward compatible additions need defaults or nullable [OK]
Quick Trick: Add optional fields with defaults for forward compatibility [OK]
Common Mistakes:
MISTAKES
  • Adding required fields without defaults
  • Removing fields under forward compatibility
  • Changing field types without compatibility checks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes