较旧的服务传输较新版本的协议缓冲区3消息

Say, I have a protocol buffer message (in proto3) of the form

message A {
  int32 foo = 1;
}

I'm running servers X, Y, and Z written in Go that use these messages and pass them around with gRPC such that X talks with Y and Y talks with Z, i.e., X and Z talk via Y.

Alice designs a cool, new feature that requires adding a new field, bar, to message A and updates servers X and Z.

message A {
  int32 foo = 1;
  int32 bar = 2;
}

However, the deployed version of server Y does not recognize this new field and redeploying server Y to achieve this would quickly become very difficult in larger systems.

In a previous life, we used proto2 and all this worked fine because it would keep the unrecognized fields around. However, Google now recommends we use proto3 with gRPC and from my understanding, keeping unrecognized fields around is no longer supported at least in Go.

What is the recommended way to address this issue with proto3?

Update:
There is an open github issue about this https://github.com/google/protobuf/issues/272

You can add an Any field for the future expansion needs:

https://developers.google.com/protocol-buffers/docs/proto3#any

I haven't used it myself, but if I understand correctly, even unrecognized Any field values should remain when the message is decoded and re-encoded.