diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2016-03-31 14:40:09 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-04-20 04:51:20 -0700 |
commit | b6a0780d86e7c6afe7ae0d9a87e6fe5c62b4d792 (patch) | |
tree | 007ec14554354094abe0995dd24847e825d69437 /tests/basic/afr/heal-info.t | |
parent | bc89311aff62c78102ab6920077b6782ee99689a (diff) |
cluster/afr: Fix spurious entries in heal info
Problem:
Locking schemes in afr-v1 were locking the directory/file completely during
self-heal. Newer schemes of locking don't require Full directory, file locking.
But afr-v2 still has compatibility code to work-well with older clients, where
in entry-self-heal it takes a lock on a special 256 character name which can't
be created on the fs. Similarly for data self-heal there used to be a lock on
(LLONG_MAX-2, 1). Old locking scheme requires heal info to take sh-domain locks
before examining heal-state. If it doesn't take sh-domain locks, then there is
a possibility of heal-info hanging till self-heal completes because of
compatibility locks. But the problem with heal-info taking sh-domain locks is
that if two heal-info or shd, heal-info try to inspect heal state in parallel
using trylocks on sh-domain, there is a possibility that both of them assuming
a heal is in progress. This was leading to spurious entries being shown in
heal-info.
Fix:
As long as there is afr-v1 way of locking, we can't fix this problem with
simple solutions. If we know that the cluster is running newer versions of
locking schemes, in those cases we can give accurate information in heal-info.
So introduce a new option called 'locking-scheme' which if it is 'granular'
will give correct information in heal-info. Not only that, Extra network hops
for taking compatibility locks, sh-domain locks in heal info will not be
necessary anymore. Thus it improves performance.
BUG: 1322850
Change-Id: Ia563c5f096b5922009ff0ec1c42d969d55d827a3
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/13873
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-by: Anuradha Talur <atalur@redhat.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'tests/basic/afr/heal-info.t')
-rw-r--r-- | tests/basic/afr/heal-info.t | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/basic/afr/heal-info.t b/tests/basic/afr/heal-info.t new file mode 100644 index 00000000000..b4da50b3ae9 --- /dev/null +++ b/tests/basic/afr/heal-info.t @@ -0,0 +1,36 @@ +#!/bin/bash +#Test that parallel heal-info command execution doesn't result in spurious +#entries with locking-scheme granular + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function heal_info_to_file { + while [ -f $M0/a.txt ]; do + $CLI volume heal $V0 info | grep -i number | grep -v 0 >> $1 + done +} + +function write_and_del_file { + dd of=$M0/a.txt if=/dev/zero bs=1024k count=100 + rm -f $M0/a.txt +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{0,1} +TEST $CLI volume set $V0 locking-scheme granular +TEST $CLI volume start $V0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0; +TEST touch $M0/a.txt +write_and_del_file & +touch $B0/f1 $B0/f2 +heal_info_to_file $B0/f1 & +heal_info_to_file $B0/f2 & +wait +EXPECT "^0$" echo $(wc -l $B0/f1 | awk '{print $1}') +EXPECT "^0$" echo $(wc -l $B0/f2 | awk '{print $1}') + +cleanup; |