CCDAK practice question 1 of 25

In Avro, removing or adding a field that has a default is a __ schema evolution

Full set: 150 questions
Answer options
A: full Correct answer
B: backward
C: breaking
D: forward
Correct Answer:
A. full
Explanation

In Avro, a schema evolution is considered full or fully compatible if it is both backward and forward compatible.
1. Adding a field with a default value: This is both backward and forward compatible. A new consumer can read old data by using the default value for the missing field. An old consumer can read new data by simply ignoring the newly added field.
2. Removing a field that has a default value: This is also both backward and forward compatible. A new consumer can read old data by ignoring the field that has been removed. An old consumer can read new data by using its defined default value for the now-missing field. Since both operations are compatible in both directions, they are classified as a full schema evolution.

Why Incorrect

B. backward: This is incomplete. While the change is backward compatible, it is also forward compatible, making "full" the more accurate and comprehensive answer.
C. breaking: This is incorrect. The use of default values ensures that both old and new schemas can process the data without errors, preventing a breaking change.
D. forward: This is incomplete. While the change is forward compatible, it is also backward compatible. "Full" is the correct term for compatibility in both directions.

References

1. Confluent Documentation: Schema Evolution and Compatibility for Schema Registry on Confluent Cloud. Under the section "Compatibility types", the table for FULL compatibility explicitly lists "Add optional fields" and "Delete optional fields" as valid changes. An optional field in this context is one with a default value.

Reference: Confluent Documentation > Schema Registry > Concepts > Schema Evolution and Compatibility > Compatibility types.

2. Apache Avro™ 1.11.3 Specification: Schema Resolution. The rules for resolving schemas between a reader and a writer confirm this behavior.

For adding a field with a default: "If the reader's schema has a field that is not present in the writer's schema, the reader should use the default value for that field." (Ensures backward compatibility).

For removing a field: "If the writer's schema has a field that is not present in the reader's schema, the reader should ignore the field." (Ensures forward compatibility for the add, and backward for the remove).

Scroll to Top