Spring / Spring gRPC Interview Questions
How does protobuf handle backward and forward compatibility?
Protobuf is designed so that old and new versions of a message can coexist safely, provided a few rules are followed. Adding a new field with a fresh, unused tag number is safe: older code simply ignores the field it doesn't recognize, and newer code sees the field's default when talking to an older sender.
Renaming a field is safe, since only the tag number is serialized. What breaks compatibility is reusing a retired tag number for a different field, or changing a field's wire type incompatibly (for example, switching an int32 to a string on the same tag). Reserving retired numbers and field names via the reserved keyword prevents this class of mistake from being reintroduced later.
More Related questions...