You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sehrope Sarkuni (JIRA)" <ji...@apache.org> on 2015/06/18 02:02:47 UTC

[jira] [Updated] (AVRO-1685) Allow specifying sync in DataFileWriter.create

     [ https://issues.apache.org/jira/browse/AVRO-1685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sehrope Sarkuni updated AVRO-1685:
----------------------------------
    Attachment: AVRO-1685.patch

> Allow specifying sync in DataFileWriter.create
> ----------------------------------------------
>
>                 Key: AVRO-1685
>                 URL: https://issues.apache.org/jira/browse/AVRO-1685
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sehrope Sarkuni
>            Priority: Minor
>         Attachments: AVRO-1685.patch
>
>
> Currently DataFileWriter generates a random 16-byte sync each time a new file is created. This means that even if you write the exact same data in a new file writer, the file itself will be slightly different (specifically the sync will be different).
> I'd like to be able to generate the exact same file multiple times. To do so, I need a way to specify the 16-byte sync.
> I've created a patch that adds this functionality by adding an overload of the create() that takes a byte[] array as the third parameter. If the byte array is null then a random sync is generated using the same internal static generateSync() method as before. If it's not null then the length is checked and it's used as the sync. The other two overloads of create(...) have been modified to call the three parameter version with a null sync.
> The patch includes three additional tests to check the error cases (invalid length) and verify that generating the same file twice results in the same byte array (i.e. exact match).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)