From 0baa65b651036ada96d9fc190232e4f100dc12e8 Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Fri, 23 Mar 2012 16:44:38 -0400 Subject: 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 Reviewed-on: http://review.gluster.com/3005 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/afr/src/afr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'xlators/cluster/afr/src/afr.c') diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index b7ba2619..4f7bf2de 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 }, -- cgit