diff options
author | Venkatesh Somyajulu <vsomyaju@redhat.com> | 2013-10-07 13:47:47 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-10-14 14:41:54 -0700 |
commit | 75caba63714c7f7f9ab810937dae69a1a28ece53 (patch) | |
tree | 36e810729072177e9ec69ab8e7a65aca3221e7cd /tests/bugs/bug-1015990-rep.t | |
parent | 047882750e0e97f5eed21ebe3445cdb216b15a9d (diff) |
cluster/afr: [Feature] Command implementation to get heal-count
Currently to know the number of files to be healed, either user
has to go to backend and check the number of entries present in
indices/xattrop directory. But if a volume consists of large
number of bricks, going to each backend and counting the number
of entries is a time-taking task. Otherwise user can give
gluster volume heal vol-name info command but with this
approach if no. of entries are very hugh in the indices/
xattrop directory, it will comsume time.
So as a feature, new command is implemented.
Command 1: gluster volume heal vn statistics heal-count
This command will get the number of entries present in
every brick of a volume. The output displays only entries
count.
Command 2: gluster volume heal vn statistics heal-count
replica 192.168.122.1:/home/user/brickname
Here if we are concerned with just one replica.
So providing any one of the brick of a replica will get
the number of entries to be healed for that replica only.
Example:
Replicate volume with replica count 2.
Backend status:
--------------
[root@dhcp-0-17 xattrop]# ls -lia | wc -l
1918
NOTE: Out of 1918, 2 entries are <xattrop-gfid> dummy
entries so actual no. of entries to be healed are
1916.
[root@dhcp-0-17 xattrop]# pwd
/home/user/2ty/.glusterfs/indices/xattrop
Command output:
--------------
Gathering count of entries to be healed on volume volume3 has been successful
Brick 192.168.122.1:/home/user/22iu
Status: Brick is Not connected
Entries count is not available
Brick 192.168.122.1:/home/user/2ty
Number of entries: 1916
Change-Id: I72452f3de50502dc898076ec74d434d9e77fd290
BUG: 1015990
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/6044
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests/bugs/bug-1015990-rep.t')
-rwxr-xr-x | tests/bugs/bug-1015990-rep.t | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/bugs/bug-1015990-rep.t b/tests/bugs/bug-1015990-rep.t new file mode 100755 index 00000000000..f59bb2f75ba --- /dev/null +++ b/tests/bugs/bug-1015990-rep.t @@ -0,0 +1,81 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../afr.rc +cleanup; + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}; + +## Verify volume is is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + + +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + + + +TEST kill_brick $V0 $H0 $B0/$V0"1" +sleep 5 +TEST kill_brick $V0 $H0 $B0/$V0"3" +sleep 5 + +for i in {1..100}; do echo "STRING" > $M0/File$i; done + +brick_2_sh_entries=$(count_sh_entries $B0/$V0"2") +brick_4_sh_entries=$(count_sh_entries $B0/$V0"4") + + +command_output=$(gluster volume heal $V0 statistics heal-count replica $H0:$B0/$V0"1") + + +substring="Number of entries:" +count=0 +while read -r line; +do + if [[ "$line" == *$substring* ]] + then + value=$(echo $line | cut -f 2 -d :) + count=$(($count + $value)) + fi + +done <<< "$command_output" + +brick_2_entries_count=$(($count-$value)) + +EXPECT "0" echo $brick_2_entries_count + +brick_2_entries_count=$count + + +xattrop_count_brick_2=$(count_sh_entries $B0/$V0"2") +##Remove the count of the xattrop-gfid entry count as it does not contribute +##to the number of files to be healed + +sub_val=1 +xattrop_count_brick_2=$(($xattrop_count_brick_2-$sub_val)) + +ret=0 +if [ "$xattrop_count_brick_2" -eq "$brick_2_entries_count" ] + then + ret=$(($ret + $sub_val)) +fi + +EXPECT "1" echo $ret +## Finish up +TEST $CLI volume stop $V0; +EXPECT 'Stopped' volinfo_field $V0 'Status'; +TEST $CLI volume delete $V0; +TEST ! $CLI volume info $V0 + +cleanup; |