5. 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
A. Add the new field with a default value or make it nullable
B. Remove an existing required field to simplify the schema
C. Add the new field without a default value
D. Change the type of an existing field to a different primitive type
Solution
Step 1: Understand FORWARD compatibility
FORWARD compatibility means old schema can read data written with new schema.
Step 2: Determine safe schema changes
Adding optional fields with defaults or nullable types preserves forward compatibility.
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.
Final Answer:
Add the new field with a default value or make it nullable -> Option A
Quick Check:
Forward compatible additions need defaults or nullable [OK]
Hint: Add optional fields with defaults for forward compatibility [OK]
Common Mistakes:
Adding required fields without defaults
Removing fields under forward compatibility
Changing field types without compatibility checks
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.