From 753f8c13245220c4b9ec6364a5e644274a36b1d6 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Fri, 17 Aug 2012 14:19:39 +0530 Subject: afr: Avoid excessive logging in self-heal. - (Excessive) Logging has been very useful as 'bread-crumbs' in many a root-cause analyses. This patch aims at avoiding logging when the information could be reconstructed using the xattrs, statedump, and/or "volume heal" CLI commands. Change-Id: I8f646cbee44e98495ea6963f9dfcae95375c8900 BUG: 844804 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.com/3827 Reviewed-by: Pranith Kumar Karampuri Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-common.c | 12 ++++++------ xlators/cluster/afr/src/afr-self-heal-algorithm.c | 6 +++--- xlators/cluster/afr/src/afr-self-heal-common.c | 14 ++++++++++---- xlators/cluster/afr/src/afr-self-heal-data.c | 4 ++-- xlators/cluster/afr/src/afr-self-heal-metadata.c | 6 +++--- xlators/cluster/afr/src/afr-self-heald.c | 4 ++-- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index f416ed921ce..d3e51822fe3 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1171,7 +1171,7 @@ afr_detect_self_heal_by_iatt (afr_local_t *local, xlator_t *this, { if (PERMISSION_DIFFERS (buf, lookup_buf)) { /* mismatching permissions */ - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "permissions differ for %s ", local->loc.path); local->self_heal.do_metadata_self_heal = _gf_true; } @@ -1179,13 +1179,13 @@ afr_detect_self_heal_by_iatt (afr_local_t *local, xlator_t *this, if (OWNERSHIP_DIFFERS (buf, lookup_buf)) { /* mismatching permissions */ local->self_heal.do_metadata_self_heal = _gf_true; - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "ownership differs for %s ", local->loc.path); } if (SIZE_DIFFERS (buf, lookup_buf) && IA_ISREG (buf->ia_type)) { - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "size differs for %s ", local->loc.path); local->self_heal.do_data_self_heal = _gf_true; } @@ -1210,7 +1210,7 @@ afr_detect_self_heal_by_lookup_status (afr_local_t *local, xlator_t *this, local->self_heal.do_entry_self_heal = _gf_true; local->self_heal.do_gfid_self_heal = _gf_true; local->self_heal.do_missing_entry_self_heal = _gf_true; - gf_log(this->name, GF_LOG_INFO, + gf_log(this->name, GF_LOG_DEBUG, "entries are missing in lookup of %s.", local->loc.path); //If all self-heals are needed no need to check for other rules @@ -1221,7 +1221,7 @@ afr_detect_self_heal_by_lookup_status (afr_local_t *local, xlator_t *this, IA_ISREG (local->cont.lookup.inode->ia_type)) { local->self_heal.do_data_self_heal = _gf_true; local->self_heal.do_metadata_self_heal = _gf_true; - gf_log (this->name, GF_LOG_WARNING, + gf_log (this->name, GF_LOG_DEBUG, "split brain detected during lookup of %s.", local->loc.path); } @@ -1335,7 +1335,7 @@ afr_launch_self_heal (call_frame_t *frame, xlator_t *this, inode_t *inode, if (background) bg = "background"; - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "%s %s self-heal triggered. path: %s, reason: %s", bg, sh_type_str, local->loc.path, reason); diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index 18edca8c1eb..30e117b652d 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -104,7 +104,7 @@ sh_loop_driver_done (call_frame_t *sh_frame, xlator_t *this, if (sh->op_failed) { GF_ASSERT (!last_loop_frame); //loop_finish should have happened and the old_loop should be NULL - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "self-heal aborting on %s", local->loc.path); @@ -112,10 +112,10 @@ sh_loop_driver_done (call_frame_t *sh_frame, xlator_t *this, } else { GF_ASSERT (last_loop_frame); if (diff_blocks == total_blocks) { - gf_log (this->name, GF_LOG_INFO, "full self-heal " + gf_log (this->name, GF_LOG_DEBUG, "full self-heal " "completed on %s",local->loc.path); } else { - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "diff self-heal on %s: completed. " "(%d blocks of %d were different (%.2f%%))", local->loc.path, diff_blocks, total_blocks, diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index be8809a5de7..e86f82f402f 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -989,7 +989,7 @@ afr_sh_missing_entries_done (call_frame_t *frame, xlator_t *this) afr_sh_reset (frame, this); if (local->govinda_gOvinda) { - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "split brain found, aborting selfheal of %s", local->loc.path); sh->op_failed = 1; @@ -1081,7 +1081,7 @@ afr_sh_common_lookup_resp_handler (call_frame_t *frame, void *cookie, sh->success_count++; sh->xattr[child_index] = dict_ref (xattr); } else { - gf_log (this->name, GF_LOG_ERROR, "path %s on subvolume" + gf_log (this->name, GF_LOG_DEBUG, "path %s on subvolume" " %s => -1 (%s)", loc->path, priv->children[child_index]->name, strerror (op_errno)); @@ -2152,11 +2152,17 @@ afr_self_heal_completion_cbk (call_frame_t *bgsh_frame, xlator_t *this) afr_self_heal_type_str_get (sh, sh_type_str, sizeof(sh_type_str)); if (sh->op_failed) { - gf_log (this->name, GF_LOG_ERROR, "background %s self-heal " + gf_loglevel_t loglevel = GF_LOG_ERROR; + if (priv->shd.iamshd) + loglevel = GF_LOG_DEBUG; + + gf_log (this->name, loglevel, "background %s self-heal " "failed on %s", sh_type_str, local->loc.path); + } else { - gf_log (this->name, GF_LOG_INFO, "background %s self-heal " + gf_log (this->name, GF_LOG_DEBUG, "background %s self-heal " "completed on %s", sh_type_str, local->loc.path); + } FRAME_SU_UNDO (bgsh_frame, afr_local_t); diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 72bf8d4b917..423e1c8049c 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -91,7 +91,7 @@ afr_sh_data_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { if (op_ret == -1) { - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_ERROR, "flush failed on %s on subvolume %s: %s", local->loc.path, priv->children[child_index]->name, strerror (op_errno)); @@ -826,7 +826,7 @@ afr_lookup_select_read_child_by_txn_type (xlator_t *this, afr_local_t *local, sources, success_children, txn_type, &subvol_status, _gf_false); if (subvol_status & SPLIT_BRAIN) { - gf_log (this->name, GF_LOG_WARNING, "%s: Possible split-brain", + gf_log (this->name, GF_LOG_DEBUG, "%s: Possible split-brain", local->loc.path); switch (txn_type) { case AFR_DATA_TRANSACTION: diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 6c3989e8490..7611088dbd1 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -51,7 +51,7 @@ afr_sh_metadata_done (call_frame_t *frame, xlator_t *this) afr_sh_reset (frame, this); if (sh->mdata_spb) { - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, GF_LOG_DEBUG, "split-brain detected, aborting selfheal of %s", local->loc.path); sh->op_failed = 1; @@ -535,9 +535,9 @@ afr_sh_metadata_post_nonblocking_inodelk_cbk (call_frame_t *frame, int_lock = &local->internal_lock; if (int_lock->lock_op_ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Non Blocking metadata " + gf_log (this->name, GF_LOG_DEBUG, "Non Blocking metadata " "inodelks failed for %s.", local->loc.path); - gf_log (this->name, GF_LOG_ERROR, "Metadata self-heal " + gf_log (this->name, GF_LOG_DEBUG, "Metadata self-heal " "failed for %s.", local->loc.path); afr_sh_metadata_done (frame, this); } else { diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 3a6295749b5..f425572b047 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -278,10 +278,10 @@ _remove_stale_index (xlator_t *this, xlator_t *readdir_xl, ret = _build_index_loc (this, &index_loc, fname, parent); if (ret) goto out; - gf_log (this->name, GF_LOG_INFO, "Removing stale index " + gf_log (this->name, GF_LOG_DEBUG, "Removing stale index " "for %s on %s", index_loc.name, readdir_xl->name); ret = syncop_unlink (readdir_xl, &index_loc); - if (ret) { + if (ret && (errno != ENOENT)) { gf_log (this->name, GF_LOG_ERROR, "%s: Failed to remove" " index on %s - %s", index_loc.name, readdir_xl->name, strerror (errno)); -- cgit