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

Thiruvalluvan M. G. edited comment on AVRO-2280 at 12/25/18 2:11 AM:
---------------------------------------------------------------------

Merged the Pull Request


was (Author: thiru_mg):
Merged the Pull Requet

> Calling DataFileWriter::flush() when there is no data to write can 
> subsequently cause an exception when the file is read
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-2280
>                 URL: https://issues.apache.org/jira/browse/AVRO-2280
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: c++
>            Reporter: Brian Walshe
>            Assignee: Thiruvalluvan M. G.
>            Priority: Major
>              Labels: newbie, pull-request-available
>             Fix For: 1.9.0
>
>
> If you call flush() on a DataFileWriter object that has no data waiting to be 
> written, this will produce an empty block at the end of the file which will 
> cause an exception on the last call to DataFileReader::read(T& datum)
> h2. Example
> For example adding the following to the Data File unit tests will cause them 
> to break 
> [https://github.com/bwalshe/avro/blob/7c6a229b2fcbb0b88368e1503a58daef9f43ee64/lang/c%2B%2B/test/DataFileTests.cc#L192]
> h2. Possible Solution
> Altering DataFileWriter::sync() to check if there are objects to be written 
> before proceeding will get the code to pass the unit tests. e.g.: 
> [https://github.com/bwalshe/avro/blob/7c6a229b2fcbb0b88368e1503a58daef9f43ee64/lang/c%2B%2B/impl/DataFile.cc#L141
>  
> |https://github.com/bwalshe/avro/blob/7c6a229b2fcbb0b88368e1503a58daef9f43ee64/lang/c%2B%2B/impl/DataFile.cc#L141]
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to