Protobuf backward compatibility and proto3 vs proto2

Paul Verest picture Paul Verest · Nov 18, 2016 · Viewed 8.4k times · Source

One of selling points of Protobuf was backward compatibility, i.e. developers can evolve format, and older clients can still use it.

Now with new Protobuf version called proto3, the IDL language itself is not compatible as such things as options, required where dropped, new syntax for enuns, no extention.

Does it mean that using proto3 there's no way to produce binary that older proto2 would read/understand also?

It is like you have to continue to use proto2. If you start using proto3, you can't talk to older systems, or have to rewrite, recompile all those .protos That is compatibility break in the first place.

Answer

jpa picture jpa · Nov 20, 2016

Yes, if some of your systems are proto2 based, it is probably best to keep using proto2. In my opinion, proto3 does not introduce many new features and most libraries will continue supporting proto2.

However, the wire format is mostly compatible. As long as the tag number is the same, the encoding remains the same. The required/optional specifiers do not affect the encoding, they are only checks that are performed after decoding.