Not exactly, by unknown enum value I mean an enum value that doesn't appear
in the enum definition. For example let's say your enum has only values 0,
1, and 2 but you parse a 3. This could happen if the message was serialized
by another binary using a newer version of the schema. Proto2 will store
unknown enum values in the unknown field set whereas proto3 will just store
them normally in the field.

On Thu, Mar 14, 2019 at 7:29 PM Jason Huang <jasonhuangh...@gmail.com>
wrote:

> thanks for your reply , as for the `unknown enum values` , do you mean the
> case of a unseted enum field ?
>
> On Friday, 15 March 2019 02:12:31 UTC+8, Adam Cozzette wrote:
>>
>> Going from proto3 to proto2 should be fine. There are some slight
>> differences but I can't think of any major problems. The only thing that
>> comes to mind is that proto2 handles unknown enum values a little bit
>> differently from proto3. I doubt that would be a problem but if you want to
>> be extra cautious you could double-check that you're not storing any
>> unknown enum values.
>>
>> However, there is no need to downgrade to version 2.6.1 and if anything
>> that would only introduce bugs and make the code slower. The proto2
>> semantics are still fully supported in all versions going forward, so all
>> you have to do is put syntax = "proto2"; at the top of your .proto
>> files. You can stick with 3.6.1 or even upgrade to any newer version.
>>
>> On Thu, Mar 14, 2019 at 10:21 AM Jason Huang <jasonhu...@gmail.com>
>> wrote:
>>
>>> i chose proto3 for cache (serialize) for my application , and it have
>>> run for several month . but now i wanna change my mind for proto2 , because
>>> the hasField is really needed .
>>>
>>> the problem is , there're still lots of data in the cache which are
>>> serialized with proto3 , if i can't deserialize with them with proto2 . it
>>> will be unacceptable .
>>>
>>> my question is , is it safe to switch from proto3 to proto2 ? i made
>>> some test i could work in some case . but i'm afraid this is not full
>>> coverage test .
>>>
>>> my current proto3 version is 3.6.1 , and the proto2 version i want to
>>> use is 2.6.1
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Protocol Buffers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to protobuf+u...@googlegroups.com.
>>> To post to this group, send email to prot...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/protobuf.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to