[ 
https://issues.apache.org/jira/browse/THRIFT-5299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223685#comment-17223685
 ] 

Allen George commented on THRIFT-5299:
--------------------------------------

[~shuoli84] I'm sorry - I'm a little confused by what's being reported here. Is 
this a problem with the rust library, or {{integer_encoding}}'s implementation 
of {{read_varint}} and {{write_varint}} or both?

It appears that the desired state is:

* Sequence number: varint
* All other instances of numbers: varint(zigzag)

My understanding of the problem is that currently in the Rust compact impl the 
sequence number is **also** in varint(zigzag), which is wrong. Fixing this in 
{{integer-encoding-rs}} appears to be a breaking API change. Probably the 
simplest thing to do is add two new methods to the compact implementation:

* {{read_i32_seq_num}}
* {{write_i32_seq_num}}

Which works around the problem within the lib itself. Does that seem right?

> rs implementation compact protocol seq_id should not use zigzag encoding.
> -------------------------------------------------------------------------
>
>                 Key: THRIFT-5299
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5299
>             Project: Thrift
>          Issue Type: Bug
>          Components: Rust - Library
>    Affects Versions: 0.13.0
>            Reporter: shuo li
>            Priority: Major
>
> While reviewing code, I discovered a bug in compact protocol.
> The seq_id in message header is decoded with integer-encoding's i32, which 
> uses zigzag decode implicitly. 
>  
>  
> EDIT: correct the title and desc.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to