Skip to content

AVRO-4063: Call flush on the inner writer during Writer::flush - #14

Merged
martin-g merged 4 commits into
apache:mainfrom
snowsignal:fix/avro-4063
Oct 2, 2024
Merged

martin-g merged 4 commits into
apache:mainfrom
snowsignal:fix/avro-4063

Conversation

@snowsignal

Copy link
Copy Markdown
Contributor

Overview

Fixes #10.

Description

This PR calls std::io::Write::flush on the inner writer of apache_avro::Writer at the end of apache_avro::Writer::flush. This ensures that the flush is propagated and the previously written bytes are fully sent.

This PR also includes a unit test that confirms Writer::flush now works as expected.

Comment thread avro/src/writer.rs Resolved
Comment thread avro/src/writer.rs Resolved
Comment thread avro/src/writer.rs Resolved
Comment thread avro/src/writer.rs Resolved
Comment thread avro/src/writer.rs Resolved
Comment thread avro/src/writer.rs Resolved
…Cell<Vec>>`

IMO this way it is more clear why the wrappers are needed - to get the
length of the most inner buffer after the flush.
Using `Arc<Mutex<Vec>>` makes it look like there is concurrency involved.

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
@martin-g
martin-g merged commit 0868a8b into apache:main Oct 2, 2024
@martin-g

martin-g commented Oct 2, 2024

Copy link
Copy Markdown
Member

Thank you, @snowsignal !

@snowsignal
snowsignal deleted the fix/avro-4063 branch October 17, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apache_avro::Writer::flush does not call std::io::Write::flush on the inner writer

2 participants