Blob Blame History Raw
From 46394669958da41f68fb98aac33efa2a567bdc13 Mon Sep 17 00:00:00 2001
From: Ravishankar N <ravishankar@redhat.com>
Date: Fri, 23 Sep 2016 15:16:46 +0530
Subject: [PATCH 88/94] afr: Modifications to afr events

Patch in master: http://review.gluster.org/15550
Patch in release-3.9: http://review.gluster.org/15565

Modified afr event message to add a 'type' key as detailed in the BZ.
Also added events for data and metadata split-brain.

Change-Id: I8156674b4b6a501499fc10fd68e05115fdaef3e4
BUG: 1378300
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/85605
---
 xlators/cluster/afr/src/afr-self-heal-common.c   |    2 +-
 xlators/cluster/afr/src/afr-self-heal-data.c     |    6 +++++-
 xlators/cluster/afr/src/afr-self-heal-entry.c    |    6 ++----
 xlators/cluster/afr/src/afr-self-heal-metadata.c |    4 ++++
 xlators/cluster/afr/src/afr-self-heal-name.c     |    4 ++--
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index d7ffb35..8d73a80 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1655,7 +1655,7 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this,
 				priv->children[i]->name,
 				uuid_utoa (replies[i].poststat.ia_gfid));
                         gf_event (EVENT_AFR_SPLIT_BRAIN, "subvol=%s;"
-                                "msg=file type mismatch;gfid=%s;"
+                                "type=file;gfid=%s;"
                                 "ia_type-%d=%s;ia_type-%d=%s",
                                 this->name,
                                 uuid_utoa (replies[i].poststat.ia_gfid), first,
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 4becfb8..fbbbd19 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -14,6 +14,7 @@
 #include "byte-order.h"
 #include "protocol-common.h"
 #include "afr-messages.h"
+#include "events.h"
 
 enum {
 	AFR_SELFHEAL_DATA_FULL = 0,
@@ -597,8 +598,11 @@ __afr_selfheal_data_finalize_source (call_frame_t *frame, xlator_t *this,
                                                             healed_sinks,
                                                             locked_on, replies,
                                                           AFR_DATA_TRANSACTION);
-                if (source < 0)
+                if (source < 0) {
+                        gf_event (EVENT_AFR_SPLIT_BRAIN, "subvol=%s;type=data;"
+                                 "file=%s", this->name, uuid_utoa(inode->gfid));
                         return -EIO;
+                }
                 return source;
 	}
 
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index bf55ede..fb904f3 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -249,8 +249,7 @@ afr_selfheal_detect_gfid_and_type_mismatch (xlator_t *this,
                                 uuid_utoa_r (replies[src_idx].poststat.ia_gfid,
                                 g2), priv->children[src_idx]->name);
                         gf_event (EVENT_AFR_SPLIT_BRAIN,
-                                 "subvol=%s;msg=gfid mismatch. Skipping "
-                                 "conservative merge.;file=<gfid:%s>/%s>;count=2;"
+                                 "subvol=%s;type=gfid;file=<gfid:%s>/%s>;count=2;"
                                  "child-%d=%s;gfid-%d=%s;child-%d=%s;gfid-%d=%s",
                                  this->name, uuid_utoa (pargfid), bname, i,
                                  priv->children[i]->name, i,
@@ -272,8 +271,7 @@ afr_selfheal_detect_gfid_and_type_mismatch (xlator_t *this,
                        gf_inode_type_to_str (replies[src_idx].poststat.ia_type),
                                 priv->children[src_idx]->name);
                         gf_event (EVENT_AFR_SPLIT_BRAIN,
-                                 "subvol=%s;msg=file type mismatch. Skipping "
-                                 "conservative merge;file=<gfid:%s>/%s>;count=2;"
+                                 "subvol=%s;type=file;file=<gfid:%s>/%s>;count=2;"
                                  "child-%d=%s;type-%d=%s;child-%d=%s;type-%d=%s",
                                  this->name, uuid_utoa (pargfid), bname, i,
                                  priv->children[i]->name, i,
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c
index 85aaca7..9dfe4a1 100644
--- a/xlators/cluster/afr/src/afr-self-heal-metadata.c
+++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c
@@ -13,6 +13,7 @@
 #include "afr-self-heal.h"
 #include "byte-order.h"
 #include "protocol-common.h"
+#include "events.h"
 
 #define AFR_HEAL_ATTR (GF_SET_ATTR_UID|GF_SET_ATTR_GID|GF_SET_ATTR_MODE)
 
@@ -241,6 +242,9 @@ __afr_selfheal_metadata_finalize_source (call_frame_t *frame, xlator_t *this,
 		}
 
 		if (!priv->metadata_splitbrain_forced_heal) {
+                        gf_event (EVENT_AFR_SPLIT_BRAIN, "subvol=%s;"
+                                  "type=metadata;file=%s",
+                                  this->name, uuid_utoa(inode->gfid));
 			return -EIO;
 		}
 
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index acacea8..1d7b0cc 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -306,7 +306,7 @@ afr_selfheal_name_type_mismatch_check (xlator_t *this, struct afr_reply *replies
                                         gf_inode_type_to_str (inode_type),
                                         priv->children[type_idx]->name);
                                 gf_event (EVENT_AFR_SPLIT_BRAIN,
-                                         "subvol=%s;msg=file type mismatch;"
+                                         "subvol=%s;type=file;"
                                          "file=<gfid:%s>/%s;count=2;"
                                          "child-%d=%s;type-%d=%s;child-%d=%s;"
                                          "type-%d=%s", this->name,
@@ -368,7 +368,7 @@ afr_selfheal_name_gfid_mismatch_check (xlator_t *this, struct afr_reply *replies
 					uuid_utoa_r (gfid, g2),
 					priv->children[gfid_idx_iter]->name);
                                 gf_event (EVENT_AFR_SPLIT_BRAIN,
-                                        "subvol=%s;msg=gfid mismatch;"
+                                        "subvol=%s;type=gfid;"
                                         "file=<gfid:%s>/%s;count=2;"
                                         "child-%d=%s;gfid-%d=%s;child-%d=%s;"
                                         "gfid-%d=%s", this->name,
-- 
1.7.1