summaryrefslogtreecommitdiffstats
path: root/tests/features/unhashed-auto.t
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 /tests/features/unhashed-auto.t
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 'tests/features/unhashed-auto.t')
-rwxr-xr-xtests/features/unhashed-auto.t28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/features/unhashed-auto.t b/tests/features/unhashed-auto.t
index 97663c20e10..cba5b772106 100755
--- a/tests/features/unhashed-auto.t
+++ b/tests/features/unhashed-auto.t
@@ -39,6 +39,11 @@ get_xattr () {
$cmd $1 | od -tx1 -An | tr -d ' '
}
+get_xattr_hash () {
+ cmd="getfattr --absolute-names --only-values -n trusted.glusterfs.dht"
+ $cmd $1 | od -tx1 -An | awk '{printf("%s%s%s%s\n", $1, $2, $3, $4);}'
+}
+
cleanup
TEST glusterd
@@ -49,7 +54,7 @@ TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}
EXPECT "$V0" volinfo_field $V0 'Volume Name'
EXPECT 'Created' volinfo_field $V0 'Status'
-TEST $CLI volume set $V0 cluster.lookup-unhashed auto
+TEST $CLI volume set $V0 cluster.lookup-optimize ON
TEST $CLI volume start $V0
EXPECT 'Started' volinfo_field $V0 'Status'
@@ -96,4 +101,25 @@ TEST wait_for_rebalance
new_val=$(get_xattr $B0/${V0}1/dir)
TEST [ ! x"$old_val" = x"$new_val" ]
+# Force an anomoly on an existing layout and heal it
+## The healed layout should not carry a commit-hash (or should carry 1 in the
+## commit-hash)
+TEST setfattr -x trusted.glusterfs.dht $B0/${V0}1/dir
+TEST $GFS -s $H0 --volfile-id $V0 $M0
+TEST [ -d $M0/dir ]
+new_hash=$(get_xattr_hash $B0/${V0}1/dir)
+TEST [ x"$new_hash" = x"00000001" ]
+new_hash=$(get_xattr_hash $B0/${V0}2/dir)
+TEST [ x"$new_hash" = x"00000001" ]
+
+# Unset the option and check that newly created directories get 1 in the
+# disk layout
+TEST $CLI volume reset $V0 cluster.lookup-optimize
+TEST mkdir $M0/dir1
+new_hash=$(get_xattr_hash $B0/${V0}1/dir1)
+TEST [ x"$new_hash" = x"00000001" ]
+new_hash=$(get_xattr_hash $B0/${V0}2/dir1)
+TEST [ x"$new_hash" = x"00000001" ]
+
+
cleanup