shanibr...@gmail.com wrote: > Hi, > Lets say my proto (abcd.proto) is compiled with the protoc compiler > version 2.0.3 and my application also links to the corresponding > runtime libraries. I now run my app and store the bytes generated > from the proto object to some persistent store (say a database). > > A month from now, I decide to upgrade to protocol buffer version 2.0.4 > (which say is released) and recompile abcd.proto using the new > compiler to generate the new cpp classes. I hook my app to the new > runtime libraries and try to read the older bytes (v2.0.3) from the > persistent store. Will it be able to? > > In other words, are the bytes that are written out (for an unchanged > proto file) compatible across protobuf library versions? Will this > always be guaranteed? > > Thanks. > If abcd.proto is unchanged and version 2.0.3 is bug free and version 2.0.4 is bug free then saving with 2.0.3 libraries and loading with 2.0.4 libraries will work. Also, saving with 2.0.4 should let you load with 2.0.3 as well.
It is possible that the c++ class definitions change slightly, so the actual in-memory object may be different. But the data should roundtrip, regardless of the computer language used. If fields are delete from abcd.proto and/or non-required fields are added to abcd.proto then it should still let you load "old" data into the "new" format. Removed fields get stored or dropped in a language-library dependent way. New non-required fields will be unset and have their default values. The only big difficulty is loading data that does have a fields declared as required by the current code. Cheers, Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---