Skip to content

Commit

Permalink
flb_input_chunk: skip overlimit check in mem mode
Browse files Browse the repository at this point in the history
This commit uses a different implementation than the previous; instead
of checking in each output plugin and logging, this will just skip the
check entirely when not in FS mode.

The downside is that there is no log indicating that the memory plugin
is going to an output with `storage.total_limit_size` where it has no
effect, but this is a reasonable expectation to configure for so that
would just be adding extra work just to be able to do some debug
logging.

Signed-off-by: Braydon Kains <[email protected]>
  • Loading branch information
braydonk committed Nov 17, 2023
1 parent fe062da commit 7660491
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/flb_input_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,6 @@ int flb_input_chunk_has_overlimit_routes(struct flb_input_chunk *ic,
int overlimit = 0;
struct mk_list *head;
struct flb_output_instance *o_ins;
struct flb_input_instance *i_ins = ic->in;


mk_list_foreach(head, &ic->in->config->outputs) {
o_ins = mk_list_entry(head, struct flb_output_instance, _head);
Expand All @@ -486,12 +484,6 @@ int flb_input_chunk_has_overlimit_routes(struct flb_input_chunk *ic,
continue;
}

if (i_ins->storage_type == CIO_STORE_MEM) {
flb_plg_debug(i_ins, "plugin is in memory storage mode, storage.total_limit_size "
"from output %s has no effect", o_ins->name);
continue;
}

FS_CHUNK_SIZE_DEBUG(o_ins);
flb_debug("[input chunk] chunk %s required %ld bytes and %ld bytes left "
"in plugin %s", flb_input_chunk_get_name(ic), chunk_size,
Expand All @@ -516,12 +508,14 @@ int flb_input_chunk_has_overlimit_routes(struct flb_input_chunk *ic,
int flb_input_chunk_place_new_chunk(struct flb_input_chunk *ic, size_t chunk_size)
{
int overlimit;
struct flb_input_instance *i_ins = ic->in;

overlimit = flb_input_chunk_has_overlimit_routes(ic, chunk_size);
if (overlimit != 0) {
flb_input_chunk_find_space_new_data(ic, chunk_size, overlimit);
if (i_ins->storage_type == CIO_STORE_FS) {
overlimit = flb_input_chunk_has_overlimit_routes(ic, chunk_size);
if (overlimit != 0) {
flb_input_chunk_find_space_new_data(ic, chunk_size, overlimit);
}
}

return !flb_routes_mask_is_empty(ic->routes_mask);
}

Expand Down

0 comments on commit 7660491

Please sign in to comment.