From 7660491e77604271ab56856f4c75e3c1b69815c5 Mon Sep 17 00:00:00 2001 From: Braydon Kains Date: Fri, 17 Nov 2023 17:25:18 -0500 Subject: [PATCH] flb_input_chunk: skip overlimit check in mem mode 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 --- src/flb_input_chunk.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/flb_input_chunk.c b/src/flb_input_chunk.c index df8876b3dd4..8aa81df8c7b 100644 --- a/src/flb_input_chunk.c +++ b/src/flb_input_chunk.c @@ -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); @@ -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, @@ -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); }