|
|
12a457 |
From 821ff5e9964323b4161fa873554b1596c79f0c11 Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
Date: Thu, 17 Mar 2016 09:32:17 +0530
|
|
|
12a457 |
Subject: [PATCH 75/80] cluster/afr: Use parallel dir scan functionality
|
|
|
12a457 |
|
|
|
12a457 |
>BUG: 1221737
|
|
|
12a457 |
>Change-Id: I0ed71a72f0e33bd733723e00a01cf28378c5534e
|
|
|
12a457 |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/13755
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/13992
|
|
|
12a457 |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
>BUG: 1325857
|
|
|
12a457 |
>Change-Id: I7c6b2ea065edd7f5dafffeb42fd6c601b4ab8d14
|
|
|
12a457 |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/14010
|
|
|
12a457 |
>Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
|
|
|
12a457 |
BUG: 1314724
|
|
|
12a457 |
Change-Id: I0858bd709028a139d26e852fba4cb6258835d6ec
|
|
|
12a457 |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/72373
|
|
|
12a457 |
---
|
|
|
12a457 |
libglusterfs/src/globals.h | 2 +
|
|
|
12a457 |
xlators/cluster/afr/src/afr-self-heald.c | 40 ++++++++++++++++-------
|
|
|
12a457 |
xlators/cluster/afr/src/afr-self-heald.h | 2 +
|
|
|
12a457 |
xlators/cluster/afr/src/afr.c | 29 ++++++++++++++++
|
|
|
12a457 |
xlators/cluster/afr/src/afr.h | 1 -
|
|
|
12a457 |
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 11 ++++++
|
|
|
12a457 |
6 files changed, 72 insertions(+), 13 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/libglusterfs/src/globals.h b/libglusterfs/src/globals.h
|
|
|
12a457 |
index 4fe4bcb..35e7b4b 100644
|
|
|
12a457 |
--- a/libglusterfs/src/globals.h
|
|
|
12a457 |
+++ b/libglusterfs/src/globals.h
|
|
|
12a457 |
@@ -74,6 +74,8 @@
|
|
|
12a457 |
|
|
|
12a457 |
#define GD_OP_VERSION_3_7_10 30710 /* Op-version for GlusterFS 3.7.10 */
|
|
|
12a457 |
|
|
|
12a457 |
+#define GD_OP_VERSION_3_7_12 30712 /* Op-version for GlusterFS 3.7.12 */
|
|
|
12a457 |
+
|
|
|
12a457 |
#include "xlator.h"
|
|
|
12a457 |
|
|
|
12a457 |
/* THIS */
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
|
|
|
12a457 |
index 21b13b7..d89692d 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-self-heald.c
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-self-heald.c
|
|
|
12a457 |
@@ -320,14 +320,18 @@ afr_shd_selfheal (struct subvol_healer *healer, int child, uuid_t gfid)
|
|
|
12a457 |
|
|
|
12a457 |
ret = afr_selfheal (this, gfid);
|
|
|
12a457 |
|
|
|
12a457 |
- if (ret == -EIO) {
|
|
|
12a457 |
- eh = shd->split_brain;
|
|
|
12a457 |
- crawl_event->split_brain_count++;
|
|
|
12a457 |
- } else if (ret < 0) {
|
|
|
12a457 |
- crawl_event->heal_failed_count++;
|
|
|
12a457 |
- } else if (ret == 0) {
|
|
|
12a457 |
- crawl_event->healed_count++;
|
|
|
12a457 |
- }
|
|
|
12a457 |
+ LOCK (&priv->lock);
|
|
|
12a457 |
+ {
|
|
|
12a457 |
+ if (ret == -EIO) {
|
|
|
12a457 |
+ eh = shd->split_brain;
|
|
|
12a457 |
+ crawl_event->split_brain_count++;
|
|
|
12a457 |
+ } else if (ret < 0) {
|
|
|
12a457 |
+ crawl_event->heal_failed_count++;
|
|
|
12a457 |
+ } else if (ret == 0) {
|
|
|
12a457 |
+ crawl_event->healed_count++;
|
|
|
12a457 |
+ }
|
|
|
12a457 |
+ }
|
|
|
12a457 |
+ UNLOCK (&priv->lock);
|
|
|
12a457 |
|
|
|
12a457 |
if (eh) {
|
|
|
12a457 |
shd_event = GF_CALLOC (1, sizeof(*shd_event),
|
|
|
12a457 |
@@ -430,6 +434,7 @@ afr_shd_index_sweep (struct subvol_healer *healer, char *vgfid)
|
|
|
12a457 |
afr_private_t *priv = NULL;
|
|
|
12a457 |
int ret = 0;
|
|
|
12a457 |
xlator_t *subvol = NULL;
|
|
|
12a457 |
+ dict_t *xdata = NULL;
|
|
|
12a457 |
|
|
|
12a457 |
priv = healer->this->private;
|
|
|
12a457 |
subvol = priv->children[healer->subvol];
|
|
|
12a457 |
@@ -439,17 +444,28 @@ afr_shd_index_sweep (struct subvol_healer *healer, char *vgfid)
|
|
|
12a457 |
gf_msg (healer->this->name, GF_LOG_WARNING,
|
|
|
12a457 |
0, AFR_MSG_INDEX_DIR_GET_FAILED,
|
|
|
12a457 |
"unable to get index-dir on %s", subvol->name);
|
|
|
12a457 |
- return -errno;
|
|
|
12a457 |
+ ret = -errno;
|
|
|
12a457 |
+ goto out;
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
- ret = syncop_dir_scan (subvol, &loc, GF_CLIENT_PID_SELF_HEALD,
|
|
|
12a457 |
- healer, afr_shd_index_heal);
|
|
|
12a457 |
+ xdata = dict_new ();
|
|
|
12a457 |
+ if (!xdata || dict_set_int32 (xdata, "get-gfid-type", 1)) {
|
|
|
12a457 |
+ ret = -ENOMEM;
|
|
|
12a457 |
+ goto out;
|
|
|
12a457 |
+ }
|
|
|
12a457 |
|
|
|
12a457 |
- loc_wipe (&loc;;
|
|
|
12a457 |
+ ret = syncop_mt_dir_scan (subvol, &loc, GF_CLIENT_PID_SELF_HEALD,
|
|
|
12a457 |
+ healer, afr_shd_index_heal, xdata,
|
|
|
12a457 |
+ priv->shd.max_threads, priv->shd.wait_qlength);
|
|
|
12a457 |
|
|
|
12a457 |
if (ret == 0)
|
|
|
12a457 |
ret = healer->crawl_event.healed_count;
|
|
|
12a457 |
|
|
|
12a457 |
+out:
|
|
|
12a457 |
+ loc_wipe (&loc;;
|
|
|
12a457 |
+
|
|
|
12a457 |
+ if (xdata)
|
|
|
12a457 |
+ dict_unref (xdata);
|
|
|
12a457 |
return ret;
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-self-heald.h b/xlators/cluster/afr/src/afr-self-heald.h
|
|
|
12a457 |
index 58b088e..f591515 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-self-heald.h
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-self-heald.h
|
|
|
12a457 |
@@ -56,6 +56,8 @@ typedef struct {
|
|
|
12a457 |
|
|
|
12a457 |
eh_t *split_brain;
|
|
|
12a457 |
eh_t **statistics;
|
|
|
12a457 |
+ uint32_t max_threads;
|
|
|
12a457 |
+ uint32_t wait_qlength;
|
|
|
12a457 |
} afr_self_heald_t;
|
|
|
12a457 |
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
|
|
|
12a457 |
index 49ce495..c47e637 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr.c
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr.c
|
|
|
12a457 |
@@ -221,6 +221,12 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
12a457 |
GF_OPTION_RECONF ("consistent-metadata", priv->consistent_metadata,
|
|
|
12a457 |
options, bool, out);
|
|
|
12a457 |
|
|
|
12a457 |
+ GF_OPTION_RECONF ("shd-max-threads", priv->shd.max_threads,
|
|
|
12a457 |
+ options, uint32, out);
|
|
|
12a457 |
+
|
|
|
12a457 |
+ GF_OPTION_RECONF ("shd-wait-qlength", priv->shd.wait_qlength,
|
|
|
12a457 |
+ options, uint32, out);
|
|
|
12a457 |
+
|
|
|
12a457 |
priv->did_discovery = _gf_false;
|
|
|
12a457 |
|
|
|
12a457 |
ret = 0;
|
|
|
12a457 |
@@ -331,6 +337,11 @@ init (xlator_t *this)
|
|
|
12a457 |
fav_child->name, fav_child->name);
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
+ GF_OPTION_INIT ("shd-max-threads", priv->shd.max_threads,
|
|
|
12a457 |
+ uint32, out);
|
|
|
12a457 |
+
|
|
|
12a457 |
+ GF_OPTION_INIT ("shd-wait-qlength", priv->shd.wait_qlength,
|
|
|
12a457 |
+ uint32, out);
|
|
|
12a457 |
|
|
|
12a457 |
GF_OPTION_INIT ("background-self-heal-count",
|
|
|
12a457 |
priv->background_self_heal_count, uint32, out);
|
|
|
12a457 |
@@ -833,5 +844,23 @@ struct volume_options options[] = {
|
|
|
12a457 |
.type = GF_OPTION_TYPE_INT,
|
|
|
12a457 |
.description = "subset of child_count. Has to be 0 or 1."
|
|
|
12a457 |
},
|
|
|
12a457 |
+ { .key = {"shd-max-threads"},
|
|
|
12a457 |
+ .type = GF_OPTION_TYPE_INT,
|
|
|
12a457 |
+ .min = 1,
|
|
|
12a457 |
+ .max = 64,
|
|
|
12a457 |
+ .default_value = "1",
|
|
|
12a457 |
+ .description = "Maximum number of threads SHD can use per local "
|
|
|
12a457 |
+ "brick. This can substantially lower heal times, "
|
|
|
12a457 |
+ "but can also crush your bricks if you don't have "
|
|
|
12a457 |
+ "the storage hardware to support this."
|
|
|
12a457 |
+ },
|
|
|
12a457 |
+ { .key = {"shd-wait-qlength"},
|
|
|
12a457 |
+ .type = GF_OPTION_TYPE_INT,
|
|
|
12a457 |
+ .min = 1,
|
|
|
12a457 |
+ .max = 655536,
|
|
|
12a457 |
+ .default_value = "1024",
|
|
|
12a457 |
+ .description = "This option can be used to control number of heals"
|
|
|
12a457 |
+ " that can wait in SHD per subvolume",
|
|
|
12a457 |
+ },
|
|
|
12a457 |
{ .key = {NULL} },
|
|
|
12a457 |
};
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
|
|
|
12a457 |
index e507fd7..1a08ff5 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr.h
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr.h
|
|
|
12a457 |
@@ -144,7 +144,6 @@ typedef struct _afr_private {
|
|
|
12a457 |
/* pump dependencies */
|
|
|
12a457 |
void *pump_private;
|
|
|
12a457 |
gf_boolean_t use_afr_in_pump;
|
|
|
12a457 |
-
|
|
|
12a457 |
} afr_private_t;
|
|
|
12a457 |
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
12a457 |
index 0381dd1..274248d 100644
|
|
|
12a457 |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
12a457 |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
12a457 |
@@ -2699,6 +2699,17 @@ struct volopt_map_entry glusterd_volopt_map[] = {
|
|
|
12a457 |
.op_version = GD_OP_VERSION_3_7_6,
|
|
|
12a457 |
.flags = OPT_FLAG_CLIENT_OPT
|
|
|
12a457 |
},
|
|
|
12a457 |
+ { .key = "cluster.shd-max-threads",
|
|
|
12a457 |
+ .voltype = "cluster/replicate",
|
|
|
12a457 |
+ .op_version = GD_OP_VERSION_3_7_12,
|
|
|
12a457 |
+ .flags = OPT_FLAG_CLIENT_OPT
|
|
|
12a457 |
+ },
|
|
|
12a457 |
+ { .key = "cluster.shd-wait-qlength",
|
|
|
12a457 |
+ .voltype = "cluster/replicate",
|
|
|
12a457 |
+ .op_version = GD_OP_VERSION_3_7_12,
|
|
|
12a457 |
+ .flags = OPT_FLAG_CLIENT_OPT
|
|
|
12a457 |
+ },
|
|
|
12a457 |
+
|
|
|
12a457 |
{ .key = NULL
|
|
|
12a457 |
}
|
|
|
12a457 |
};
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|