Skip to content

Flush task should not flush messages that were written since last flu…#7743

Merged
normanmaurer merged 1 commit into
4.1from
flush_unsafe
Mar 2, 2018
Merged

Flush task should not flush messages that were written since last flu…#7743
normanmaurer merged 1 commit into
4.1from
flush_unsafe

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

…sh attempt.

Motivation:

The flush task is currently using flush() which will have the affect of have the flush traverse the whole ChannelPipeline and also flush messages that were written since we gave up flushing. This is not really correct as we should only continue to flush messages that were flushed at the point in time when the flush task was submitted for execution if the user not explicit call flush() by him/herself.

Modification:

Call *Unsafe.flush0() via the flush task which will only continue flushing messages that were marked as flushed before.

Result:

More correct behaviour when the flush task is used.

…sh attempt.

Motivation:

The flush task is currently using flush() which will have the affect of have the flush traverse the whole ChannelPipeline and also flush messages that were written since we gave up flushing. This is not really correct as we should only continue to flush messages that were flushed at the point in time when the flush task was submitted for execution if the user not explicit call flush() by him/herself.

Modification:

Call *Unsafe.flush0() via the flush task which will only continue flushing messages that were marked as flushed before.

Result:

More correct behaviour when the flush task is used.
@normanmaurer
Copy link
Copy Markdown
Member Author

I am still thinking about how to add a proper test... Please review in the meantime tho

@normanmaurer normanmaurer self-assigned this Feb 22, 2018
@normanmaurer normanmaurer added this to the 4.1.23.Final milestone Feb 22, 2018
@Scottmitch
Copy link
Copy Markdown
Member

unit test could involve using writing write quota elements (taking into account gathering writes) flushing, then writing 1 more element and not flushing and verify the last element is not actually flushed. You will have to be careful to defeat gathering writes, or limit how much data a gathering write is allowed to write somehow.

@normanmaurer
Copy link
Copy Markdown
Member Author

@Scottmitch I had no time yet for a test... are you cool with merge it and do a test as a followup ... I am not sure when I have time as the test is a bit tricky :(

@Scottmitch
Copy link
Copy Markdown
Member

@normanmaurer - sure that is fine. I added tests previously to ensure the flush is actually done.

@normanmaurer normanmaurer merged commit 0a8e1aa into 4.1 Mar 2, 2018
@normanmaurer normanmaurer deleted the flush_unsafe branch March 2, 2018 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants