diff options
author | Anuradha <atalur@redhat.com> | 2014-11-13 10:59:52 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2014-11-13 11:55:41 -0800 |
commit | c11c9deb3cf77101c7e440522ab8f5961f815222 (patch) | |
tree | f30ae75a9763243f9aa6baf2a6b2eee4ad5749b6 /heal | |
parent | 909eb5671db37ff1388613929fe22883a4677da0 (diff) |
cluster/afr : Prevent excessive logging of split-brain messages.
Running the volume heal info command would result in
excessive logging of split-brain messages. After this patch,
running heal info command will not log the split brain messages.
This info is now displayed in the output of heal info command
instead.
If a file is in split-brain, a message "Is in split-brain"
will be written against its name.
Change-Id: Ib8979be04f5ac7c59ce3ad1185886bb54b8be808
BUG: 1161102
Signed-off-by: Anuradha <atalur@redhat.com>
Reviewed-on: http://review.gluster.org/9069
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'heal')
-rw-r--r-- | heal/src/glfs-heal.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index 78716ad64da..236361c2605 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -141,6 +141,20 @@ _is_possibly_healing (dict_t *xattr_rsp) return _gf_false; } +static gf_boolean_t +_is_in_split_brain (dict_t *xattr_rsp) +{ + int ret = 0; + int spb = 0; + + ret = dict_get_int32 (xattr_rsp, "split-brain", &spb); + if ((ret == 0) && spb) { + return _gf_true; + } + + return _gf_false; +} + #define RESET_ENTRIES(loc, shf, ope, pth, rsp, grsp) \ do { \ loc_wipe (&loc); \ @@ -240,9 +254,10 @@ glfsh_process_entries (xlator_t *xl, loc_t *parentloc, gf_dirent_t *entries, continue; } - ret = dict_get_int32 (xattr_rsp, "sh-failed", &sh_failed); - - sh_pending = _is_self_heal_pending (xattr_rsp); + if (xattr_rsp) { + ret = dict_get_int32 (xattr_rsp, "sh-failed", &sh_failed); + sh_pending = _is_self_heal_pending (xattr_rsp); + } //File/dir is undergoing I/O if (!op_errno && !sh_failed && !sh_pending) continue; @@ -260,7 +275,10 @@ glfsh_process_entries (xlator_t *xl, loc_t *parentloc, gf_dirent_t *entries, ret = dict_get_str (getxattr_rsp, GFID_TO_PATH_KEY, &path); (*num_entries)++; - if (_is_possibly_healing (xattr_rsp)) { + if (xattr_rsp && _is_in_split_brain (xattr_rsp)) { + printf ("%s - Is in split-brain\n", + path ? path : uuid_utoa (entry_loc.gfid)); + } else if (xattr_rsp && _is_possibly_healing (xattr_rsp)) { printf ("%s - Possibly undergoing heal\n", path ? path : uuid_utoa (entry_loc.gfid)); } else { |