diff options
-rw-r--r-- | cli/src/cli-rpc-ops.c | 19 | ||||
-rw-r--r-- | libglusterfs/src/circ-buff.c | 1 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 32 |
3 files changed, 40 insertions, 12 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index da66af6a312..434e9a6b13c 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -5801,6 +5801,9 @@ cmd_heal_volume_brick_out (dict_t *dict, int brick) char *path = NULL; char *status = NULL; uint64_t i = 0; + uint32_t time = 0; + char timestr[256]; + struct tm *tm = NULL; snprintf (key, sizeof (key), "%d-hostname", brick); ret = dict_get_str (dict, key, &hostname); @@ -5823,7 +5826,21 @@ cmd_heal_volume_brick_out (dict_t *dict, int brick) ret = dict_get_str (dict, key, &path); if (ret) continue; - cli_out ("%s", path); + time = 0; + snprintf (key, sizeof (key), "%d-%"PRIu64"-time", brick, i); + ret = dict_get_uint32 (dict, key, &time); + if (!time) { + cli_out ("%s", path); + } else { + tm = localtime ((time_t*)(&time)); + strftime (timestr, sizeof (timestr), + "%Y-%m-%d %H:%M:%S", tm); + if (i ==0) { + cli_out ("at path on brick"); + cli_out ("-----------------------------------"); + } + cli_out ("%s %s", timestr, path); + } } out: return; diff --git a/libglusterfs/src/circ-buff.c b/libglusterfs/src/circ-buff.c index 0eab436d48b..6c7907a095c 100644 --- a/libglusterfs/src/circ-buff.c +++ b/libglusterfs/src/circ-buff.c @@ -49,7 +49,6 @@ __cb_add_entry_buffer (buffer_t *buffer, void *item) if (ret == -1) gf_log_callingfn ("", GF_LOG_WARNING, "getting time of" "the day failed"); - buffer->w_index++; buffer->w_index %= buffer->size_buffer - 1; //used_buffer size cannot be greater than the total buffer size diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 19c3dd98c35..3a6295749b5 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -126,8 +126,8 @@ _build_index_loc (xlator_t *this, loc_t *loc, char *name, loc_t *parent) } int -_add_str_to_dict (xlator_t *this, dict_t *output, int child, char *str, - gf_boolean_t dyn) +_add_path_to_dict (xlator_t *this, dict_t *output, int child, char *path, + struct timeval *tv, gf_boolean_t dyn) { //subkey not used for now int ret = -1; @@ -146,15 +146,27 @@ _add_str_to_dict (xlator_t *this, dict_t *output, int child, char *str, snprintf (key, sizeof (key), "%d-%d-%"PRIu64, xl_id, child, count); if (dyn) - ret = dict_set_dynstr (output, key, str); + ret = dict_set_dynstr (output, key, path); else - ret = dict_set_str (output, key, str); + ret = dict_set_str (output, key, path); if (ret) { gf_log (this->name, GF_LOG_ERROR, "%s: Could not add to output", - str); + path); goto out; } + if (!tv) + goto inc_count; + snprintf (key, sizeof (key), "%d-%d-%"PRIu64"-time", xl_id, + child, count); + ret = dict_set_uint32 (output, key, tv->tv_sec); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "%s: Could not set time", + path); + goto out; + } + +inc_count: snprintf (key, sizeof (key), "%d-%d-count", xl_id, child); ret = dict_set_uint64 (output, key, count + 1); if (ret) { @@ -209,9 +221,9 @@ _add_event_to_dict (circular_buffer_t *cb, void *data) shd_event = cb->data; if (shd_event->child != dump_data->child) goto out; - ret = _add_str_to_dict (dump_data->this, dump_data->dict, - dump_data->child, shd_event->path, - _gf_false); + ret = _add_path_to_dict (dump_data->this, dump_data->dict, + dump_data->child, shd_event->path, &cb->tv, + _gf_false); out: return ret; } @@ -248,8 +260,8 @@ _add_summary_to_dict (xlator_t *this, afr_crawl_data_t *crawl_data, if (ret) goto out; - ret = _add_str_to_dict (this, output, crawl_data->child, path, - _gf_true); + ret = _add_path_to_dict (this, output, crawl_data->child, path, NULL, + _gf_true); out: if (ret && path) GF_FREE (path); |