From 2b1bf891f550487d2c05fc9e377f0d15d4a08d0a Mon Sep 17 00:00:00 2001 From: Venkatesh Somyajula Date: Fri, 23 Nov 2012 18:12:52 +0530 Subject: Cluster/afr: Fix output for gluster volume heal vn info healed Problem: Whenever gluster volume heal vol full command is executed, the entries stored in the circual buffer for sh->healed are added in the dictionary in the _crawl_post_sh_action function irrespective of whether actual self heal (due to non-zero values in chage log) takes place or not. Fix: Value of key (actual-sh-done) will be set to 1 whenever self heal takes place due to non-zero change log values and if for some FOP self heal daemon finds that no self heal required after examining the pending matrix, the value will be 0. Change-Id: I11fd0b9ee76759af17c5bca6bfafbaf66bcaacbc BUG: 863068 Signed-off-by: Venkatesh Somyajula Reviewed-on: http://review.gluster.org/4181 Reviewed-by: Pranith Kumar Karampuri Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-863068.t | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 tests/bugs/bug-863068.t (limited to 'tests/bugs') diff --git a/tests/bugs/bug-863068.t b/tests/bugs/bug-863068.t new file mode 100644 index 00000000000..56041b15dd3 --- /dev/null +++ b/tests/bugs/bug-863068.t @@ -0,0 +1,76 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +## This function get the No. of entries for +## gluster volume heal volnmae info healed command for brick1 and brick2 +## and compare the initial value (Before volume heal full) and final value +## (After gluster volume heal vol full) and compare. + +function getdiff() +{ + val=10 + if [ "$1" == "$3" ] + then + if [ "$2" == "$4" ] + then + val=0 + else + val=20 + fi + fi + + echo $val +} + + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; +TEST $CLI volume create $V0 replica 2 $H0:$B0/brick1 $H0:$B0/brick2; +TEST $CLI volume start $V0; +mount -t glusterfs $H0:/$V0 $M0; +B0_hiphenated=`echo $B0 | tr '/' '-'` +kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0$B0_hiphenated-brick1.pid` ; + +mkdir $M0/{a,b,c}; +echo "GLUSTERFS" >> $M0/a/file; + +TEST $CLI volume start $V0 force; +sleep 5 +TEST $CLI volume heal $V0 full; +sleep 5 + +##First Brick Initial(Before full type self heal) value +FBI=`gluster volume heal $V0 info healed | grep entries | awk '{print $4}' | head -n 1` + +##Second Brick Initial Value +SBI=`gluster volume heal $V0 info healed | grep entries | awk '{print $4}' | tail -n 1` +TEST $CLI volume heal $V0 full; + +sleep 5 + +##First Brick Final value +##Number of entries from output of + +FBF=`gluster volume heal $V0 info healed | grep entries | awk '{print $4}' | head -n 1` + +##Second Brick Final Value +SBF=`gluster volume heal $V0 info healed | grep entries | awk '{print $4}' | tail -n 1` + +##get the difference of values +EXPECT "0" getdiff $FBI $SBI $FBF $SBF; + +## Tests after this comment checks for the background self heal + +TEST mkdir $M0/d +kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0$B0_hiphenated-brick1.pid` ; +TEST $CLI volume set $V0 self-heal-daemon off +dd if=/dev/random of=$M0/d/file1 bs=100M count=1 2>/dev/null; +TEST $CLI volume start $V0 force +sleep 3 +TEST ls -l $M0/d + +cleanup; -- cgit