Skip to content

Commit

Permalink
input_chunk: skip overlimit check in mem mode (#8199)
Browse files Browse the repository at this point in the history
*input_chunk: storage type when overlimit

When an output plugin is configured to use `storage.total_limit_size`
while the input plugin uses memory storage mode, it would previously
  continue calculating and eventually pass an empty pointer to the
  storage context in the function that releases space. This PR adds a
  validationg in the overlimit route check that will cause the check to
  be skipped, ensuring that the rest of the space freeing routines are
  never executed.

Signed-off-by: Braydon Kains <[email protected]>

* 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 <[email protected]>

---------

Signed-off-by: Braydon Kains <[email protected]>
  • Loading branch information
braydonk authored Dec 18, 2023
1 parent d8601df commit 1c1f934
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/flb_input_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +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;
overlimit = flb_input_chunk_has_overlimit_routes(ic, chunk_size);
if (overlimit != 0) {
flb_input_chunk_find_space_new_data(ic, chunk_size, overlimit);
}
struct flb_input_instance *i_ins = ic->in;

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 1c1f934

Please sign in to comment.