diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2012-04-20 17:22:43 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-05-17 00:16:58 -0700 |
commit | d8ede99e6f429d3a63b794c495f99fc8f76e9651 (patch) | |
tree | 4d063819bee4cefd8f812797cdec15e62ce08e87 /xlators/cluster/afr | |
parent | 1d02db63ae17788c7ab28ac81dea0675500be845 (diff) |
Self-heald: Print the time stamp of the event-history
Change-Id: I45767e26288ef6de6446ddf2ea82ed31e128d227
BUG: 796579
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3277
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 32 |
1 files changed, 22 insertions, 10 deletions
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); |