All Questions
Api Design hard

Your gRPC service uses Protobuf. You need to rename field 'userId' to 'user_id'. How do you do this without breaking existing clients?

  1. A Directly modify the field name in the .proto definition; Protobuf uses string keys for serialization and will dynamically map the new name during deserialization.
  2. B Retain the original field number (tag) while renaming the identifier; Protobuf identifies fields by their numeric tags in the wire format, making the name change a purely cosmetic update.
  3. C Deprecate the original field by assigning it a new, higher field number and declaring the new 'user_id' identifier with the original field number to ensure legacy support.
  4. D Implement a custom gRPC interceptor that performs a string replacement on the binary buffer to substitute the old identifier with the new one before the message is parsed.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions