21ab4e
From 98578c10146e7e0e837771b050f884d8c0b3a3d3 Mon Sep 17 00:00:00 2001
21ab4e
From: Ashish Pandey <aspandey@redhat.com>
21ab4e
Date: Mon, 28 Nov 2016 13:42:33 +0530
21ab4e
Subject: [PATCH 346/361] cluster/ec: Healing should not start if only "data"
21ab4e
 bricks are UP
21ab4e
21ab4e
Problem: In a disperse volume with "K+R" configuration, where
21ab4e
"K" is the number of data bricks and "R" is the number of redundancy
21ab4e
bricks (Total number of bricks, N = K+R), if only K bricks are UP,
21ab4e
we should NOT start heal process. This is because the bricks, which
21ab4e
are supposed to be healed, are not UP. This will unnecessary
21ab4e
eat up the resources.
21ab4e
21ab4e
Solution: Check for the number of xl_up_count and only
21ab4e
if it is greater than ec->fragments (number of data bricks),
21ab4e
start heal process.
21ab4e
21ab4e
mainline:
21ab4e
> BUG: 1399072
21ab4e
> Reviewed-on: http://review.gluster.org/15937
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
21ab4e
(cherry picked from commit e64227dc7c70e91f662f4bab32e4d81c76cbb8e8)
21ab4e
21ab4e
BUG: 1396010
21ab4e
Change-Id: I8579f39cfb47b65ff0f76e623b048bd67b15473b
21ab4e
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/101286
21ab4e
Tested-by: Milind Changire <mchangir@redhat.com>
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/cluster/ec/src/ec-heald.c | 28 +++++++++++++++++-----------
21ab4e
 1 file changed, 17 insertions(+), 11 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/cluster/ec/src/ec-heald.c b/xlators/cluster/ec/src/ec-heald.c
21ab4e
index 9860f10..ffb78d5 100644
21ab4e
--- a/xlators/cluster/ec/src/ec-heald.c
21ab4e
+++ b/xlators/cluster/ec/src/ec-heald.c
21ab4e
@@ -330,18 +330,20 @@ ec_shd_index_healer (void *data)
21ab4e
 
21ab4e
         healer = data;
21ab4e
         THIS = this = healer->this;
21ab4e
+        ec_t *ec = this->private;
21ab4e
 
21ab4e
         for (;;) {
21ab4e
                 ec_shd_healer_wait (healer);
21ab4e
 
21ab4e
                 ASSERT_LOCAL(this, healer);
21ab4e
 
21ab4e
-                gf_msg_debug (this->name, 0,
21ab4e
-                        "starting index sweep on subvol %s",
21ab4e
-                        ec_subvol_name (this, healer->subvol));
21ab4e
-
21ab4e
-                ec_shd_index_sweep (healer);
21ab4e
 
21ab4e
+                if (ec->xl_up_count > ec->fragments) {
21ab4e
+                        gf_msg_debug (this->name, 0,
21ab4e
+                                "starting index sweep on subvol %s",
21ab4e
+                                ec_subvol_name (this, healer->subvol));
21ab4e
+                        ec_shd_index_sweep (healer);
21ab4e
+                }
21ab4e
                 gf_msg_debug (this->name, 0,
21ab4e
                         "finished index sweep on subvol %s",
21ab4e
                         ec_subvol_name (this, healer->subvol));
21ab4e
@@ -362,6 +364,7 @@ ec_shd_full_healer (void *data)
21ab4e
 
21ab4e
         healer = data;
21ab4e
         THIS = this = healer->this;
21ab4e
+        ec_t *ec = this->private;
21ab4e
 
21ab4e
         rootloc.inode = this->itable->root;
21ab4e
         for (;;) {
21ab4e
@@ -378,13 +381,16 @@ ec_shd_full_healer (void *data)
21ab4e
 
21ab4e
                 ASSERT_LOCAL(this, healer);
21ab4e
 
21ab4e
-                gf_msg (this->name, GF_LOG_INFO, 0,
21ab4e
-                        EC_MSG_FULL_SWEEP_START,
21ab4e
-                        "starting full sweep on subvol %s",
21ab4e
-                        ec_subvol_name (this, healer->subvol));
21ab4e
 
21ab4e
-                ec_shd_selfheal (healer, healer->subvol, &rootloc);
21ab4e
-                ec_shd_full_sweep (healer, this->itable->root);
21ab4e
+                if (ec->xl_up_count > ec->fragments) {
21ab4e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
21ab4e
+                                EC_MSG_FULL_SWEEP_START,
21ab4e
+                                "starting full sweep on subvol %s",
21ab4e
+                                ec_subvol_name (this, healer->subvol));
21ab4e
+
21ab4e
+                        ec_shd_selfheal (healer, healer->subvol, &rootloc);
21ab4e
+                        ec_shd_full_sweep (healer, this->itable->root);
21ab4e
+                }
21ab4e
 
21ab4e
                 gf_msg (this->name, GF_LOG_INFO, 0,
21ab4e
                         EC_MSG_FULL_SWEEP_STOP,
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e