From 88545a091909b5f7cdb4280f280288b9951aed63 Mon Sep 17 00:00:00 2001 From: Richard Treu Date: Fri, 12 Jul 2024 02:19:24 +0200 Subject: [PATCH] input: Config parsing order fixed for FS storage pause parameter (#8720) This commit fixes a dependency issue for the storage.pause_on_chunks_overlimit parameter. In case the order in the config file was storage.pause_on_chunks_overlimit On storage.type Filesystem then the storage.pause_on_chunks_overlimit was ignored. This commit changes this behavior, so that the storage.pause_on_chunks_overlimit parameter will be parsed and set. It will be reset in case the storage.type is set to a different type than FS later. Signed-off-by: Richard Treu --- src/flb_input.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/flb_input.c b/src/flb_input.c index d3d8052f1b5..e7d6d48f735 100644 --- a/src/flb_input.c +++ b/src/flb_input.c @@ -596,7 +596,15 @@ int flb_input_set_property(struct flb_input_instance *ins, flb_sds_destroy(tmp); return -1; } + + if (ins->storage_type != FLB_STORAGE_FS && + ins->storage_pause_on_chunks_overlimit == FLB_TRUE) { + flb_debug("[input] storage.pause_on_chunks_overlimit will be " + "reset because storage.type is not filesystem"); + ins->storage_pause_on_chunks_overlimit = FLB_FALSE; + } flb_sds_destroy(tmp); + } else if (prop_key_check("threaded", k, len) == 0 && tmp) { enabled = flb_utils_bool(tmp); @@ -609,14 +617,12 @@ int flb_input_set_property(struct flb_input_instance *ins, ins->is_threaded = enabled; } else if (prop_key_check("storage.pause_on_chunks_overlimit", k, len) == 0 && tmp) { - if (ins->storage_type == FLB_STORAGE_FS) { - ret = flb_utils_bool(tmp); - flb_sds_destroy(tmp); - if (ret == -1) { - return -1; - } - ins->storage_pause_on_chunks_overlimit = ret; + ret = flb_utils_bool(tmp); + flb_sds_destroy(tmp); + if (ret == -1) { + return -1; } + ins->storage_pause_on_chunks_overlimit = ret; } else { /*