summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2015-07-15 16:37:37 +0530
committergluster-ant <bugzilla-bot@gluster.org>2015-07-15 16:37:37 +0530
commit583aeced93928fe800924394cb6d4752cf3fa906 (patch)
tree6b229900f13df2957fdf56320508628abb0f2260
parent3b738ae9b3ab61f65d65697872ac54c5e7671dae (diff)
downloadglusterfs-583aeced93928fe800924394cb6d4752cf3fa906.tar.gz
glusterfs-583aeced93928fe800924394cb6d4752cf3fa906.tar.xz
glusterfs-583aeced93928fe800924394cb6d4752cf3fa906.zip
ec : trusted.ec.version xattr of all root directories of all bricks should be same.
Problem: After replacing the brick using "replace-brick" command and running "heal full", the version of the root directory of the newly added brick is not getting healed. heal starts running on the dentries of the root but does not run on root directory. Solution: Run heal on root directory. Change-Id: Ifd42a3fb341b049c895817e892e5b484a5aa6f80 BUG: 1243382 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/11676 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
-rw-r--r--tests/basic/ec/ec-root-heal.t33
-rw-r--r--tests/volume.rc20
-rw-r--r--xlators/cluster/ec/src/ec-heald.c3
3 files changed, 53 insertions, 3 deletions
diff --git a/tests/basic/ec/ec-root-heal.t b/tests/basic/ec/ec-root-heal.t
new file mode 100644
index 0000000000..91e668c470
--- /dev/null
+++ b/tests/basic/ec/ec-root-heal.t
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup
+function num_entries {
+ ls -l $1 | wc -l
+}
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5}
+TEST $CLI volume start $V0
+TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0
+touch $M0/{1..10}
+TEST $CLI volume replace-brick $V0 $H0:$B0/${V0}5 $H0:$B0/${V0}6 commit force
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count_shd $V0 0
+
+# active heal
+TEST $CLI volume heal $V0 full
+#ls -l gives "Total" line so number of lines will be 1 more
+EXPECT_WITHIN $HEAL_TIMEOUT "^11$" num_entries $B0/${V0}6
+ec_version=$(get_hex_xattr trusted.ec.version $B0/${V0}0)
+EXPECT "$ec_version" get_hex_xattr trusted.ec.version $B0/${V0}1
+EXPECT "$ec_version" get_hex_xattr trusted.ec.version $B0/${V0}2
+EXPECT "$ec_version" get_hex_xattr trusted.ec.version $B0/${V0}3
+EXPECT "$ec_version" get_hex_xattr trusted.ec.version $B0/${V0}4
+EXPECT "$ec_version" get_hex_xattr trusted.ec.version $B0/${V0}6
+
+cleanup;
diff --git a/tests/volume.rc b/tests/volume.rc
index a100bde55a..11ef9939d4 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -121,7 +121,7 @@ function ec_get_info {
local vol=$1
local dist_id=$2
local key=$3
- local fpath=$(generate_mount_statedump $vol)
+ local fpath=$4
local value=$(sed -n "/^\[cluster\/disperse\.$vol-disperse-$dist_id\]/,/^\[/{s/^$key=\(.*\)/\1/p;}" $fpath | head -1)
rm -f $fpath
echo "$value"
@@ -131,14 +131,28 @@ function ec_child_up_status {
local vol=$1
local dist_id=$2
local brick_id=$(($3 + 1))
- local mask=$(ec_get_info $vol $dist_id "childs_up_mask")
+ local mask=$(ec_get_info $vol $dist_id "childs_up_mask" $(generate_mount_statedump $vol))
echo "${mask: -$brick_id:1}"
}
function ec_child_up_count {
local vol=$1
local dist_id=$2
- ec_get_info $vol $dist_id "childs_up"
+ ec_get_info $vol $dist_id "childs_up" $(generate_mount_statedump $vol)
+}
+
+function ec_child_up_status_shd {
+ local vol=$1
+ local dist_id=$2
+ local brick_id=$(($3 + 1))
+ local mask=$(ec_get_info $vol $dist_id "childs_up_mask" $(generate_shd_statedump $vol))
+ echo "${mask: -$brick_id:1}"
+}
+
+function ec_child_up_count_shd {
+ local vol=$1
+ local dist_id=$2
+ ec_get_info $vol $dist_id "childs_up" $(generate_shd_statedump $vol)
}
function get_shd_process_pid {
diff --git a/xlators/cluster/ec/src/ec-heald.c b/xlators/cluster/ec/src/ec-heald.c
index 75f5848726..4498d2e8db 100644
--- a/xlators/cluster/ec/src/ec-heald.c
+++ b/xlators/cluster/ec/src/ec-heald.c
@@ -379,12 +379,14 @@ ec_shd_full_healer (void *data)
{
struct subvol_healer *healer = NULL;
xlator_t *this = NULL;
+ loc_t rootloc = {0};
int run = 0;
healer = data;
THIS = this = healer->this;
+ rootloc.inode = this->itable->root;
for (;;) {
pthread_mutex_lock (&healer->mutex);
{
@@ -404,6 +406,7 @@ ec_shd_full_healer (void *data)
"starting full sweep on subvol %s",
ec_subvol_name (this, healer->subvol));
+ ec_shd_selfheal (healer, healer->subvol, &rootloc);
ec_shd_full_sweep (healer, this->itable->root);
gf_msg (this->name, GF_LOG_INFO, 0,