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

Fixes file sink to work with multiple threads #1842

Merged
merged 3 commits into from
Oct 5, 2022

Conversation

dlvenable
Copy link
Member

@dlvenable dlvenable commented Sep 30, 2022

Description

The file sink was not working with multiple processor threads. Each thread would re-open the file without append, which prevented it from working as expected. Now, it keeps a Writer open as long as it is running. It will flush on each output() call.

Issues Resolved

Resolves #1843

Check List

  • New functionality includes testing.
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…rite the other threads which prevents it from working as expected. Now, it keeps a Writer open as long as it is running. It will flush on each output() call.

Signed-off-by: David Venable <[email protected]>
@dlvenable dlvenable requested a review from a team as a code owner September 30, 2022 00:58
…sink now will attempt to write to the file on construction.

Signed-off-by: David Venable <[email protected]>
Copy link
Collaborator

@oeyh oeyh left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -16,7 +16,7 @@ raw-pipeline:
- string_converter:
upper_case: false
sink:
- file:
- stdout:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the concern here that file writer is open on pipeline construction but will not be closed properly in tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is that now the sink is opening the file in the constructor. But, there is no path set in these tests. These tests don't really test the file or output anyway, so there seems little need to keep it at file.

@dlvenable dlvenable merged commit 87cb655 into opensearch-project:main Oct 5, 2022
@dlvenable dlvenable deleted the file-sink-fix branch October 6, 2022 22:45
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.

[BUG] File sink does not write correctly with multiple threads
3 participants