Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 239: Add flush for event writer #297

Closed
wants to merge 3 commits into from
Closed

Conversation

Tristan1900
Copy link
Member

Change log description
Add flush for event writer.

Purpose of the change
Fix #239

What the code does
Add a flush method for event writer. Applications use flush to make sure events are persisted in Pravega.

How to verify it
Tests should pass

Signed-off-by: Wenqi Mou <[email protected]>
Wenqi Mou added 2 commits July 21, 2021 18:50
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #297 (23f89c9) into master (c3b9268) will increase coverage by 5.96%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
+ Coverage   66.37%   72.33%   +5.96%     
==========================================
  Files          43       44       +1     
  Lines       10717    10848     +131     
==========================================
+ Hits         7113     7847     +734     
+ Misses       3604     3001     -603     
Impacted Files Coverage Δ
src/event/writer.rs 100.00% <ø> (ø)
src/segment/reactor.rs 69.87% <0.00%> (ø)
src/segment/writer.rs 84.00% <0.00%> (+0.47%) ⬆️
controller-client/src/model_helper.rs 5.42% <0.00%> (-49.62%) ⬇️
controller-client/src/lib.rs 6.65% <0.00%> (-47.47%) ⬇️
retry/src/retry_result.rs 78.57% <0.00%> (-7.15%) ⬇️
shared/src/lib.rs 74.75% <0.00%> (-5.45%) ⬇️
wire_protocol/src/tests.rs 99.40% <0.00%> (ø)
wire_protocol/src/client_connection.rs 94.62% <0.00%> (+1.03%) ⬆️
... and 5 more

/// ```
pub async fn write_event(&mut self, event: Vec<u8>) -> oneshot::Receiver<Result<(), Error>> {
pub async fn write_event(&mut self, event: Vec<u8>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can make this change.
Unlike a byteStream where if one write fails all those after it are sure to fail, and we can resume knowing the offset;
EventStreams have multiple segments, so one event can error while other events before and after can succeed. Similarly the order of acks may be different for different segments.

We can have a flush method, but it does not remove the need for the ack callbacks.

@Tristan1900
Copy link
Member Author

Close this as it does not fit anymore.

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.

Document how to ensure durable write with event writer
3 participants