From 22fdfc42b690f86ee096f861c59385a021100675 Mon Sep 17 00:00:00 2001 From: Richard Treu Date: Tue, 16 Apr 2024 11:11:27 +0200 Subject: [PATCH] flb_input: Config parsing order fixed for FS storage pause parameter 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 a990a9d2805..2cba5a21776 100644 --- a/src/flb_input.c +++ b/src/flb_input.c @@ -591,7 +591,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); @@ -604,14 +612,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 { /*