summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr.c
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2012-03-23 16:44:38 -0400
committerAnand Avati <avati@redhat.com>2012-06-05 10:43:34 -0700
commit0baa65b651036ada96d9fc190232e4f100dc12e8 (patch)
treebe3b9f395558577d0f3f9f9db124e3517af07e4f /xlators/cluster/afr/src/afr.c
parent4ffd6292486f42628e1e9e01e3267daadc86698a (diff)
replicate: default read_child to a local brick if there is one.
Controlled by the "choose-local" option (on by default). Change-Id: I560f27c81703f2c9c62fdb51532c8eb763826df7 BUG: 806462 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.com/3005 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r--xlators/cluster/afr/src/afr.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index b7ba26197..4f7bf2de0 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -170,6 +170,9 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("heal-timeout", priv->shd.timeout, options,
int32, out);
+ /* Reset this so we re-discover in case the topology changed. */
+ priv->did_discovery = _gf_false;
+
ret = 0;
out:
return ret;
@@ -227,7 +230,6 @@ init (xlator_t *this)
priv->child_count = child_count;
-
priv->read_child = -1;
GF_OPTION_INIT ("read-subvolume", read_subvol, xlator, out);
@@ -239,6 +241,7 @@ init (xlator_t *this)
goto out;
}
}
+ GF_OPTION_INIT ("choose-local", priv->choose_local, bool, out);
GF_OPTION_INIT ("read-hash-mode", priv->hash_mode, uint32, out);
@@ -508,6 +511,12 @@ struct volume_options options[] = {
"1 = hash by GFID (all clients use same subvolume), "
"2 = hash by GFID and client PID",
},
+ { .key = {"choose-local" },
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "true",
+ .description = "Choose a local subvolume to read from if "
+ "read-subvolume is not explicitly set.",
+ },
{ .key = {"favorite-child"},
.type = GF_OPTION_TYPE_XLATOR
},