summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2017-08-11 15:43:58 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-09-30 02:15:21 +0000
commit1e2d6537875d16b783e3c50ada7ee61487c6d796 (patch)
treec373a484d9b712fcd18f1a851367c7f22dce5e8b
parent306164fb4121e814b61e9b5685319f889f6b7547 (diff)
cluster/afr: Make choose-local "reconfigurable"
With this change, enabling choose-local (which means its state makes transition from "off" to "on") will be effective after the first gfid-lookup on "/" since volume-set was executed. Change-Id: Ibab292ba705d993b475cd0303fb3318211fb2500 BUG: 1480525 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
-rw-r--r--tests/bugs/replicate/bug-1480525.t18
-rw-r--r--xlators/cluster/afr/src/afr.c11
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/bugs/replicate/bug-1480525.t b/tests/bugs/replicate/bug-1480525.t
new file mode 100644
index 00000000000..7c63bb2e4ea
--- /dev/null
+++ b/tests/bugs/replicate/bug-1480525.t
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
+TEST $CLI volume start $V0
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
+
+EXPECT_NOT "-1" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep read_child |awk '{print $3}'`
+TEST $CLI volume set $V0 choose-local off
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "-1" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep read_child |awk '{print $3}'`
+
+cleanup
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 14805c2c007..84dbcc04680 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -135,6 +135,7 @@ reconfigure (xlator_t *this, dict_t *options)
char *qtype = NULL;
char *fav_child_policy = NULL;
gf_boolean_t consistent_io = _gf_false;
+ gf_boolean_t choose_local_old = _gf_false;
priv = this->private;
@@ -202,6 +203,16 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("read-subvolume", read_subvol, options, xlator, out);
+ choose_local_old = priv->choose_local;
+ GF_OPTION_RECONF ("choose-local", priv->choose_local, options, bool,
+ out);
+
+ if (choose_local_old != priv->choose_local) {
+ priv->read_child = -1;
+ if (choose_local_old == _gf_false)
+ priv->did_discovery = _gf_false;
+ }
+
GF_OPTION_RECONF ("read-hash-mode", priv->hash_mode,
options, uint32, out);