filter_rewrite_tag: fix in_emitter data loss when using ring buffers.#10097
Open
filter_rewrite_tag: fix in_emitter data loss when using ring buffers.#10097
Conversation
7 tasks
…eek. Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
…add missing skip_count argument. Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
…mbers and skip the size check. Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
e1d6562 to
01deb22
Compare
niedbalski
reviewed
Mar 31, 2025
Contributor
Author
|
Is this functionality actually used? It might be best to actually drop it since it can cause a lot of corner cases and is actually redundant with the base ring buffer functionality. |
Contributor
|
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR seeks to avoid data loss when using the optional ring_buffer on emitters when using
filter_rewrite_tag. To do so two new functions were added for the ring buffer API: peek and seek.Description
During my work on #9919 I noticed that
in_emitterhad code to enable a ring buffer:fluent-bit/plugins/in_emitter/emitter.c
Line 221 in cfc9ba9
This PR seeks to solve it by:
emitter_ring_buffer_sizetofilter_rewrite_tagto enable and set the size of the ring buffer for it'sin_emitter.flb_ring_buffer_peekandflb_ring_buffer_seekto theflb_ring_bufferAPI so buffers can be read then absorbed only once they have been successfully submitted.I changed the use of
flb_ring_buffer_readtoflb_ring_buffer_peekandflb_ring_buffer_seekso that when the buffer is ingested it first callspeekto read the buffer then submit it and only seeks the buffer only if the buffer has been successfully ingested byflb_input_log_append, ie: it returns a non-error value.The work adding the
flb_ring_bufferAPIs could and should be applied to the main ring buffer as well. If this is required now I can split out that part of the work into a separate PR and leave just the fixes for the emitter andfilter_rewrite_taghere.Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.