You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/01/07 13:31:00 UTC

[jira] [Work logged] (AVRO-3240) Schema deserialization is not backwards compatible

     [ https://issues.apache.org/jira/browse/AVRO-3240?focusedWorklogId=705026&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-705026 ]

ASF GitHub Bot logged work on AVRO-3240:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Jan/22 13:30
            Start Date: 07/Jan/22 13:30
    Worklog Time Spent: 10m 
      Work Description: martin-g commented on pull request #1379:
URL: https://github.com/apache/avro/pull/1379#issuecomment-1007408920


   I've checked out you PR locally but I am not able to push to your branch. 
   I am not sure whether it is just because I don't do something right or it is ASF policy...
   
   Anyway, I've fixed the formatting and now I will have to squash all commits for this PR into one and then push it to master. 
   The problem is that this way you won't appear in the commit log. All your work will be credited to me... :-/
   Any concerns ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 705026)
    Time Spent: 2h 20m  (was: 2h 10m)

> Schema deserialization is not backwards compatible
> --------------------------------------------------
>
>                 Key: AVRO-3240
>                 URL: https://issues.apache.org/jira/browse/AVRO-3240
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: rust
>            Reporter: Ultrabug
>            Priority: Critical
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Hello,
>  
> When providing your own schema to `from_avro_datum`, the deserialization is not backward compatible with messages containing a previous schema even if the schemas are created to be backward compatible.
> This is due to the `decode_variable` function in `utils` returning `Error::ReadVariableIntegerBytes` when the reader object is smaller than expected when reading a message with previous schema version (which is indeed smaller) and trying to decode it with a backward compatible schema.
> I have fixed the issue locally with the following patch which I will submit as a PR
>  
> ```
> diff --git a/lang/rust/src/util.rs b/lang/rust/src/util.rs
> index f9daf285..3538399e 100644
> --- a/lang/rust/src/util.rs
> +++ b/lang/rust/src/util.rs
> @@ -96,7 +96,7 @@ fn decode_variable<R: Read>(reader: &mut R) -> AvroResult<u64> {
>  }
>  reader
>  .read_exact(&mut buf[..])
> - .map_err(Error::ReadVariableIntegerBytes)?;
> + .or(Ok(()))?; // return nullable to support avro schemas backward compatibility
>  i |= (u64::from(buf[0] & 0x7F)) << (j * 7);
>  if (buf[0] >> 7) == 0 {
>  break;
> ```



--
This message was sent by Atlassian Jira
(v8.20.1#820001)