buffer: add feature to evacuate chunk files when retry limit #4986
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.
Which issue(s) this PR fixes:
None.
What this PR does / why we need it:
Add feature to evacuate chunk files when retry limit.
When reached the retry limit,
buf_file
andbuf_file_single
evacuates all the chunk files (and the meta files) in the queue to the following dir before purging.(root_dir)/buffer/(plugin-id)/
root_dir
issystem_config.root_dir
if it is configured.Otherwise,
DEFAULT_BACKUP_DIR
is applied.(
/tmp/fluent
. We can change this by env varFLUENT_BACKUP_DIR
)There is no separate directory for each worker because the IDs of each chunk are entirely unique.
This makes recovery easier.
After the problem with the flush (such as a network issue) is resolved, we can put back the files and restart Fluentd to flush them again.
Difference from the
backup
feature:The
backup
feature is for unrecoverable errors, mainly for bad chunks.On the other hand, this feature is for normal chunks.
The main motivation for this feature is to enable recovery by evacuating buffer files
when the retry limit is reached due to external factors such as network issues.
Difference from the
secondary
feature:The
secondary
feature is not suitable for recovery.It can be difficult to recover files made by
out_secondary_file
because the metadata is lost.For file buffers, the easiest way for recovery is to evacuate the chunk files as is.
Once the issue is recovered, we can put back the chunk files, and restart Fluentd to load them.
This feature enables it.
Docs Changes:
TODO
Release Note:
TODO
TODO:
Organize tests.