summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-name.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2016-09-01 13:01:22 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-09-06 23:05:37 -0700
commit86e312d872a957afff1e508f13f62c4102dba22d (patch)
tree3339b2180693ab20e8971538632331a59d23a9f3 /xlators/cluster/afr/src/afr-self-heal-name.c
parentf20e41aec392a45f860fa7e80ad5ee9d5607a45c (diff)
afr: add replication events
Added the following events for the eventing framework: "EVENT_AFR_QUORUM_MET", --> Sent when quorum is met. "EVENT_AFR_QUORUM_FAIL" -->Sent when quorum is lost. "EVENT_AFR_SUBVOL_UP" -->Sent when afr witnesses the first up subvolume. "EVENT_AFR_SUBVOLS_DOWN"-->Sent when all children of an afr subvol are down. "EVENT_AFR_SPLIT_BRAIN" -->Sent when self-heal detects split-brain in heal path (not read/write path). Change-Id: I937c61ca1ce78b5922ade73c7bfa3051df59c513 BUG: 1371485 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/15349 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-name.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index b11285ca54e..a0ee7e0419f 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -9,6 +9,7 @@
*/
+#include "events.h"
#include "afr.h"
#include "afr-self-heal.h"
#include "afr-messages.h"
@@ -274,6 +275,7 @@ afr_selfheal_name_type_mismatch_check (xlator_t *this, struct afr_reply *replies
int i = 0;
int type_idx = -1;
ia_type_t inode_type = IA_INVAL;
+ ia_type_t inode_type1 = IA_INVAL;
afr_private_t *priv = NULL;
priv = this->private;
@@ -290,21 +292,32 @@ afr_selfheal_name_type_mismatch_check (xlator_t *this, struct afr_reply *replies
type_idx = i;
continue;
}
-
+ inode_type1 = replies[i].poststat.ia_type;
if (sources[i] || source == -1) {
if ((sources[type_idx] || source == -1) &&
- (inode_type != replies[i].poststat.ia_type)) {
+ (inode_type != inode_type1)) {
gf_msg (this->name, GF_LOG_WARNING, 0,
AFR_MSG_SPLIT_BRAIN,
"Type mismatch for <gfid:%s>/%s: "
- "%d on %s and %d on %s",
+ "%s on %s and %s on %s",
uuid_utoa(pargfid), bname,
- replies[i].poststat.ia_type,
+ gf_inode_type_to_str (inode_type1),
priv->children[i]->name,
- replies[type_idx].poststat.ia_type,
+ gf_inode_type_to_str (inode_type),
priv->children[type_idx]->name);
-
- return -EIO;
+ gf_event (EVENT_AFR_SPLIT_BRAIN,
+ "subvol=%s;msg=file type mismatch;"
+ "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,
+ gf_inode_type_to_str (inode_type1),
+ type_idx,
+ priv->children[type_idx]->name,
+ type_idx,
+ gf_inode_type_to_str (inode_type));
+ return -EIO;
}
inode_type = replies[i].poststat.ia_type;
type_idx = i;
@@ -322,6 +335,7 @@ afr_selfheal_name_gfid_mismatch_check (xlator_t *this, struct afr_reply *replies
int i = 0;
int gfid_idx_iter = -1;
void *gfid = NULL;
+ void *gfid1 = NULL;
afr_private_t *priv = NULL;
char g1[64], g2[64];
@@ -340,18 +354,31 @@ afr_selfheal_name_gfid_mismatch_check (xlator_t *this, struct afr_reply *replies
continue;
}
+ gfid1 = &replies[i].poststat.ia_gfid;
if (sources[i] || source == -1) {
if ((sources[gfid_idx_iter] || source == -1) &&
- gf_uuid_compare (gfid, replies[i].poststat.ia_gfid)) {
+ gf_uuid_compare (gfid, gfid1)) {
gf_msg (this->name, GF_LOG_WARNING, 0,
AFR_MSG_SPLIT_BRAIN,
"GFID mismatch for <gfid:%s>/%s "
"%s on %s and %s on %s",
uuid_utoa (pargfid), bname,
- uuid_utoa_r (replies[i].poststat.ia_gfid, g1),
+ uuid_utoa_r (gfid1, g1),
priv->children[i]->name,
- uuid_utoa_r (replies[gfid_idx_iter].poststat.ia_gfid, g2),
+ uuid_utoa_r (gfid, g2),
priv->children[gfid_idx_iter]->name);
+ gf_event (EVENT_AFR_SPLIT_BRAIN,
+ "subvol=%s;msg=gfid mismatch;"
+ "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,
+ uuid_utoa_r (gfid1, g1),
+ gfid_idx_iter,
+ priv->children[gfid_idx_iter]->name,
+ gfid_idx_iter,
+ uuid_utoa_r (gfid, g2));
return -EIO;
}