-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protocol versioning #65
Comments
In this case you wouldn't change the type of the field at position 2. Instead add a new field with the desired type at the next ordinal position (3 in the example) and rename the old field ( Note, while I've done some work with protobufs, it's definitely far from extensive. |
Anyone here knows if there is a standard way of doing versioning and version negotiation in gRPC? FYI: I asked this in the gRPC mailing list: |
The gRPC folks expect that your code should always be backwards compatible. Besides, gRPC itself can largely handle additive changes. A message with a single field will parse data that has two fields by ignoring the second field. To @jsafrane's point about breaking changes, perhaps we should consider relocating the version field into the gRPC message metadata, which can then be parsed out via a gRPC interceptor. That way the message is approved or rejected before it is ever routed to the correct (or rather intended) handler. Please see the GoCSI client for an example on injecting a message with metadata and the server that extracts said data. |
Seems related: #18 (comment) TL;DR maybe keep in mind use cases where people are adapting gRPC to other protocols |
This issues is obsolete considering version was dropped from all RPCs. Closing issue. |
There should be a chapter that explains evolution of the API. There is
Version
field in every request, but I don't understand how does it allow us to make API breaking changes.Let's assume that we need to change the API in backward-incompatible way to 2.0.0, e.g. by changing type of
CreateVolumeRequest.name
fromstring
tomap<string,string>
. Note that this example is purely synthetic and meant just to demonstrate an incompatible API change.API 1.0:
API 2.0:
How will
CreateVolumeRequest.version
help us in any way? I am looking at golang gRPC implementation and it always parses whole message. A server that knows v2.0 version of the API won't be able to parse v1.0CreateVolumeRequest
because field with nr. "2" will have unexpected type (string instead of VolumeName). Is there any magic beyond simple tutorials on grpc.io that would allow a server to peek intoCreateVolumeRequest.version
to decide which API definition to choose for parsing whole message?The text was updated successfully, but these errors were encountered: