summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-shared.c
diff options
context:
space:
mode:
authorShyam <srangana@redhat.com>2015-05-15 15:50:42 -0400
committerRaghavendra G <rgowdapp@redhat.com>2015-06-02 03:03:07 -0700
commit9f29401791ad374015c3d0927b7cf967d66471a6 (patch)
tree524c29d32133d89056704f02539ae3a5e56ad71f /xlators/cluster/dht/src/dht-shared.c
parent2df57ab7dc7b9d7deb0eebad96036149760d607b (diff)
dht: Add lookup-optimize configuration option for DHT
Currently with commit 4eaaf5 a mixed version cluster would have issues if lookup-uhashed is set to auto, as older clients would fail to validate the layouts if newer clients (i.e 3.7 or upwards) create directories. Also, in a mixed version cluster rebalance daemon would set commit hash for some subvolumes and not for the others. This commit fixes this problem by moving the enabling of the functionality introduced in the above mentioned commit to a new dht option. This option also has a op_version of 3_7_1 thereby preventing it from being set in a mixed version cluster. It brings in the following changes, - Option can be set only if min version of the cluster is 3.7.1 or more - Rebalance and mkdir update the layout with the commit hashes only if this option is set, hence ensuring rebalance works in a mixed version cluster, and also directories created by newer clients do not cause layout errors when read by older clients - This option also supersedes lookup-unhased, to enable the optimization for lookups more deterministic and not conflict with lookup-unhashed settings. Option added is cluster.lookup-optimize, which is a boolean. Usage: # gluster volume set VOLNAME cluster.lookup-optimize on Change-Id: Ifd1d4ce3f6438fcbcd60ffbfdbfb647355ea1ae0 BUG: 1222126 Signed-off-by: Shyam <srangana@redhat.com> Reviewed-on: http://review.gluster.org/10797 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-shared.c')
-rw-r--r--xlators/cluster/dht/src/dht-shared.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c
index 8a15fb2a2b9..b8f42fb145b 100644
--- a/xlators/cluster/dht/src/dht-shared.c
+++ b/xlators/cluster/dht/src/dht-shared.c
@@ -426,6 +426,9 @@ dht_reconfigure (xlator_t *this, dict_t *options)
}
}
+ GF_OPTION_RECONF ("lookup-optimize", conf->lookup_optimize, options,
+ bool, out);
+
GF_OPTION_RECONF ("min-free-disk", conf->min_free_disk, options,
percent_or_size, out);
/* option can be any one of percent or bytes */
@@ -662,6 +665,8 @@ dht_init (xlator_t *this)
conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_AUTO;
}
+ GF_OPTION_INIT ("lookup-optimize", conf->lookup_optimize, bool, err);
+
GF_OPTION_INIT ("unhashed-sticky-bit", conf->unhashed_sticky_bit, bool,
err);
@@ -833,6 +838,14 @@ struct volume_options options[] = {
"from the hash subvolume. If set to OFF, it does not do a lookup "
"on the remaining subvolumes."
},
+ { .key = {"lookup-optimize"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .description = "This option if set to ON enables the optimization "
+ "of -ve lookups, by not doing a lookup on non-hashed subvolumes for "
+ "files, in case the hashed subvolume does not return any result. "
+ "This option disregards the lookup-unhashed setting, when enabled."
+ },
{ .key = {"min-free-disk"},
.type = GF_OPTION_TYPE_PERCENT_OR_SIZET,
.default_value = "10%",