diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 65 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 76 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 22 |
3 files changed, 162 insertions, 1 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 5b4c833fbc0..2a5eedefbd3 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -2673,6 +2673,8 @@ reconfigure (xlator_t *this, dict_t *options) int log_level = -1; int log_format = -1; int logger = -1; + uint32_t log_buf_size = 0; + uint32_t log_flush_timeout = 0; if (!this || !this->private) goto out; @@ -2712,6 +2714,13 @@ reconfigure (xlator_t *this, dict_t *options) gf_log_set_logformat (log_format); } + GF_OPTION_RECONF ("log-buf-size", log_buf_size, options, uint32, out); + gf_log_set_log_buf_size (log_buf_size); + + GF_OPTION_RECONF ("log-flush-timeout", log_flush_timeout, options, + time, out); + gf_log_set_log_flush_timeout (log_flush_timeout); + ret = 0; out: gf_log (this->name, GF_LOG_DEBUG, "reconfigure returning %d", ret); @@ -2751,6 +2760,8 @@ init (xlator_t *this) char *log_str = NULL; int log_level = -1; int ret = -1; + uint32_t log_buf_size = 0; + uint32_t log_flush_timeout = 0; if (!this) return -1; @@ -2817,6 +2828,12 @@ init (xlator_t *this) gf_log_set_logformat (log_format); } + GF_OPTION_INIT ("log-buf-size", log_buf_size, uint32, out); + gf_log_set_log_buf_size (log_buf_size); + + GF_OPTION_INIT ("log-flush-timeout", log_flush_timeout, time, out); + gf_log_set_log_flush_timeout (log_flush_timeout); + this->private = conf; ret = 0; @@ -3094,6 +3111,54 @@ struct volume_options options[] = { .description = "Changes the log format for the bricks", .value = { GF_LOG_FORMAT_NO_MSG_ID, GF_LOG_FORMAT_WITH_MSG_ID} }, + { .key = {"log-buf-size"}, + .type = GF_OPTION_TYPE_INT, + .min = GF_LOG_LRU_BUFSIZE_MIN, + .max = GF_LOG_LRU_BUFSIZE_MAX, + .default_value = "5", + }, + { .key = {"client-log-buf-size"}, + .type = GF_OPTION_TYPE_INT, + .min = GF_LOG_LRU_BUFSIZE_MIN, + .max = GF_LOG_LRU_BUFSIZE_MAX, + .default_value = "5", + .description = "This option determines the maximum number of unique " + "log messages that can be buffered for a time equal to" + " the value of the option client-log-flush-timeout." + }, + { .key = {"brick-log-buf-size"}, + .type = GF_OPTION_TYPE_INT, + .min = GF_LOG_LRU_BUFSIZE_MIN, + .max = GF_LOG_LRU_BUFSIZE_MAX, + .default_value = "5", + .description = "This option determines the maximum number of unique " + "log messages that can be buffered for a time equal to" + " the value of the option brick-log-flush-timeout." + }, + { .key = {"log-flush-timeout"}, + .type = GF_OPTION_TYPE_TIME, + .min = GF_LOG_FLUSH_TIMEOUT_MIN, + .max = GF_LOG_FLUSH_TIMEOUT_MAX, + .default_value = "120", + }, + { .key = {"client-log-flush-timeout"}, + .type = GF_OPTION_TYPE_TIME, + .min = GF_LOG_FLUSH_TIMEOUT_MIN, + .max = GF_LOG_FLUSH_TIMEOUT_MAX, + .default_value = "120", + .description = "This option determines the maximum number of unique " + "log messages that can be buffered for a time equal to" + " the value of the option client-log-flush-timeout." + }, + { .key = {"brick-log-flush-timeout"}, + .type = GF_OPTION_TYPE_TIME, + .min = GF_LOG_FLUSH_TIMEOUT_MIN, + .max = GF_LOG_FLUSH_TIMEOUT_MAX, + .default_value = "120", + .description = "This option determines the maximum number of unique " + "log messages that can be buffered for a time equal to" + " the value of the option brick-log-flush-timeout." + }, { .key = {NULL} }, }; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 6ce38e91b5b..197e4b9ecdb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1366,6 +1366,46 @@ log_format_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, } static int +log_buf_size_option_handler (volgen_graph_t *graph, + struct volopt_map_entry *vme, + void *param) +{ + char *role = NULL; + struct volopt_map_entry vme2 = {0,}; + + role = (char *) param; + + if (strcmp (vme->option, "!log-buf-size") != 0 || + !strstr (vme->key, role)) + return 0; + + memcpy (&vme2, vme, sizeof (vme2)); + vme2.option = "log-buf-size"; + + return basic_option_handler (graph, &vme2, NULL); +} + +static int +log_flush_timeout_option_handler (volgen_graph_t *graph, + struct volopt_map_entry *vme, + void *param) +{ + char *role = NULL; + struct volopt_map_entry vme2 = {0,}; + + role = (char *) param; + + if (strcmp (vme->option, "!log-flush-timeout") != 0 || + !strstr (vme->key, role)) + return 0; + + memcpy (&vme2, vme, sizeof (vme2)); + vme2.option = "log-flush-timeout"; + + return basic_option_handler (graph, &vme2, NULL); +} + +static int volgen_graph_set_xl_options (volgen_graph_t *graph, dict_t *dict) { int32_t ret = -1; @@ -1423,6 +1463,12 @@ server_spec_option_handler (volgen_graph_t *graph, if (!ret) ret = log_format_option_handler (graph, vme, "brick"); + if (!ret) + ret = log_buf_size_option_handler (graph, vme, "brick"); + + if (!ret) + ret = log_flush_timeout_option_handler (graph, vme, "brick"); + return ret; } @@ -2780,6 +2826,18 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, gf_log (this->name, GF_LOG_WARNING, "changing client log format" " failed"); + ret = volgen_graph_set_options_generic (graph, set_dict, "client", + &log_buf_size_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "Failed to change " + "log-buf-size option"); + + ret = volgen_graph_set_options_generic (graph, set_dict, "client", + &log_flush_timeout_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "Failed to change " + "log-flush-timeout option"); + out: return ret; } @@ -3139,7 +3197,23 @@ build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict) &log_format_option_handler); if (ret) gf_log (this->name, GF_LOG_WARNING, "changing log " - "format level of self-heal daemon failed"); + "format of self-heal daemon failed"); + + ret = volgen_graph_set_options_generic (graph, set_dict, + "client", + &log_buf_size_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "changing " + "log-buf-size for self-heal daemon failed"); + + ret = volgen_graph_set_options_generic (graph, set_dict, + "client", + &log_flush_timeout_option_handler); + if (ret) + gf_log (this->name, GF_LOG_WARNING, "changing " + "log-flush-timeout for self-heal daemon " + "failed"); + ret = dict_reset (set_dict); if (ret) diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index 9ad808bedbc..8998d8478d0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -632,6 +632,28 @@ struct volopt_map_entry glusterd_volopt_map[] = { .op_version = 4, .flags = OPT_FLAG_CLIENT_OPT }, + { .key = "diagnostics.brick-log-buf-size", + .voltype = "debug/io-stats", + .option = "!log-buf-size", + .op_version = 4 + }, + { .key = "diagnostics.client-log-buf-size", + .voltype = "debug/io-stats", + .option = "!log-buf-size", + .op_version = 4, + .flags = OPT_FLAG_CLIENT_OPT + }, + { .key = "diagnostics.brick-log-flush-timeout", + .voltype = "debug/io-stats", + .option = "!log-flush-timeout", + .op_version = 4 + }, + { .key = "diagnostics.client-log-flush-timeout", + .voltype = "debug/io-stats", + .option = "!log-flush-timeout", + .op_version = 4, + .flags = OPT_FLAG_CLIENT_OPT + }, /* IO-cache xlator options */ { .key = "performance.cache-max-file-size", |