diff options
| author | Richard Wareing <rwareing@fb.com> | 2015-10-06 20:09:35 -0700 |
|---|---|---|
| committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-07-31 21:23:56 +0000 |
| commit | 7c422b6fd0028300f7b46a084bcd5123c2439cc9 (patch) | |
| tree | ac4a1c66491d81241765cbd3a8362ddbfe1a3d82 /tests/basic/afr/shd-force-inspect.t | |
| parent | 3f91ecd8acffcae01486a0b4f0227dd97f487a7d (diff) | |
afr/cluster: PGFID heal support
Summary:
PGFID healing enables heals which might otherwise fail due
due to the lack of a entry heal to succeed by performing
the entry healing within the same heal flow.
It does this by leveraging the PGFID tracking feature of
the POSIX xlator, and examining lookup replies for the
PGFID attribute. If detected, the pgfid will be decoded
and stored for later use in case the heal fails for whatever
reason. Cascading heal failures are handled through
recursion.
This feature is critical for a couple reasons:
1. General healing predictability - When the SHD
attempts to heal a given GFID, it should be able
to do so without having to wait for some other
dependent heal to take place.
2. Reliability - In some cases the parent directory
may require healing, but the req'd entry in the
indices/xattrop directory may not exist
(e.g. bugs/crashes etc). Prior to PGFID heal support
some sort of external script would be required to
queue up these heals by using FS specific utilities
to lookup the parent directory by hardlink or
worse...do a costly full heal to clean them up.
3. Performance - In combination with multi-threaded SHD
this feature will make SHD healing _much_ faster as
directories with large amount of files to be healed
will no longer have to wait for an entry heal to
come along, the first file in that directory queued
for healing will trigger an entry heal for the directory
and this will allow the other files in that directory
to be (immediatelly) healed in parallel.
Test Plan:
- run prove tests/basic/afr/shd_pgfid_heal.t
- run prove tests/basic/afr/shd*.t
- run prove tests/basic/afr/gfid*.t
Differential Revision: https://phabricator.fb.com/D2546133
Change-Id: I25f586047f8bcafa900c0cc9ee8f0e2128688c73
Signed-off-by: Jeff Darcy <jdarcy@fb.com>
Reviewed-on: https://review.gluster.org/17929
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Jeff Darcy <jeff@pl.atyp.us>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'tests/basic/afr/shd-force-inspect.t')
| -rw-r--r-- | tests/basic/afr/shd-force-inspect.t | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/basic/afr/shd-force-inspect.t b/tests/basic/afr/shd-force-inspect.t new file mode 100644 index 00000000000..caceb841322 --- /dev/null +++ b/tests/basic/afr/shd-force-inspect.t @@ -0,0 +1,61 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +# Setup a cluster with 3 replicas, and fav child by majority on +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1..3}; +TEST $CLI volume set $V0 cluster.choose-local off +TEST $CLI volume set $V0 cluster.self-heal-daemon on +TEST $CLI volume set $V0 nfs.disable on +TEST $CLI volume set $V0 cluster.quorum-type none +TEST $CLI volume set $V0 cluster.favorite-child-policy majority +#EST $CLI volume set $V0 cluster.favorite-child-by-majority on +#EST $CLI volume set $V0 cluster.favorite-child-by-mtime on +TEST $CLI volume set $V0 cluster.metadata-self-heal off +TEST $CLI volume set $V0 cluster.data-self-heal off +TEST $CLI volume set $V0 cluster.entry-self-heal off +TEST $CLI volume start $V0 +sleep 5 + +# Part I: FUSE Test +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 \ + --attribute-timeout=0 --entry-timeout=0 + +cd $M0 +mkdir foo +dd if=/dev/urandom of=foo/testfile bs=128k count=5 2>/dev/null +MD5=$(md5sum foo/testfile | cut -d\ -f1) + +# Kill the SHD while we setup the test +pkill -f gluster/glustershd + +# Grab the GFID of the file and parent dir +GFID_PARENT_RAW=$(getfattr -n trusted.gfid -e hex $B0/${V0}1/foo 2>/dev/null | grep trusted.gfid | cut -d= -f2) +GFID_PARENT_FORMATTED=$(echo "$GFID_PARENT_RAW" | awk '{print substr($1,3,8)"-"substr($1,11,4)"-"substr($1,15,4)"-"substr($1,19,4)"-"substr($1,23,12)}') +GFID_RAW=$(getfattr -n trusted.gfid -e hex $B0/${V0}1/foo/testfile 2>/dev/null | grep trusted.gfid | cut -d= -f2) +GFID_FORMATTED=$(echo "$GFID_RAW" | awk '{print substr($1,3,8)"-"substr($1,11,4)"-"substr($1,15,4)"-"substr($1,19,4)"-"substr($1,23,12)}') +GFID_LINK_B1="$B0/${V0}1/.glusterfs/$(echo $GFID_RAW | awk '{print substr($0,3,2)"/"substr($0,5,2)"/"substr($1,3,8)"-"substr($1,11,4)"-"substr($1,15,4)"-"substr($1,19,4)"-"substr($1,23,12)}')" + +# Nuke the file from brick 1 +rm -f $GFID_LINK_B1 +rm -f $B0/${V0}1/foo/testfile + +# Now manually queue up the parent directory for healing +touch $B0/${V0}2/.glusterfs/indices/xattrop/$GFID_PARENT_FORMATTED +touch $B0/${V0}3/.glusterfs/indices/xattrop/$GFID_PARENT_FORMATTED + +# Kick off the SHD and wait 30 seconds for healing to take place +TEST gluster vol start patchy force +EXPECT_WITHIN 30 "0" get_pending_heal_count $V0 + +# Verify the file was healed back to brick 1 +TEST stat $B0/${V0}1/foo/testfile + +cleanup |
