diff options
author | Ravishankar N <ravishankar@redhat.com> | 2016-03-25 18:48:30 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-03-29 12:08:35 -0700 |
commit | 08d18ef9257067fac510af408665360019566000 (patch) | |
tree | e3249b6473048e86ce9fb264fb84ba0af2fd82f9 /tests | |
parent | a28484443f27332c1a87e00e474ca56427a83669 (diff) |
afr: add mtime based split-brain resolution to CLI
Extended the CLI to include support for split-brain resolution based on
mtime. The command syntax is:
$:gluster volume heal <VOLNAME> split-brain latest-mtime <FILE>
where <FILE> can be either the full file name as seen from the root of the
volume (or) the gfid-string representation of the file.
Change-Id: I7a16f72ff1a4495aa69f43f22758a9404e958b4f
BUG: 1321322
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/13828
Smoke: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic/afr/split-brain-healing.t | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/basic/afr/split-brain-healing.t b/tests/basic/afr/split-brain-healing.t index 4132d327511..390579c0288 100644 --- a/tests/basic/afr/split-brain-healing.t +++ b/tests/basic/afr/split-brain-healing.t @@ -148,6 +148,49 @@ fi EXPECT "0" echo $? EXPECT $SMALLER_FILE_SIZE stat -c %s file4 +################ Heal file5 using the latest-mtime option ############## +subvolume=$(get_replicate_subvol_number file5) +if [ $subvolume == 0 ] +then + mtime1=$(stat -c %Y $B0/${V0}1/file5) + mtime2=$(stat -c %Y $B0/${V0}2/file5) + LATEST_MTIME=$(($mtime1 > $mtime2 ? $mtime1:$mtime2)) +elif [ $subvolume == 1 ] +then + mtime1=$(stat -c %Y $B0/${V0}3/file5) + mtime2=$(stat -c %Y $B0/${V0}4/file5) + LATEST_MTIME=$(($mtime1 > $mtime2 ? $mtime1:$mtime2)) +fi +$CLI volume heal $V0 split-brain latest-mtime /file5 +EXPECT "0" echo $? + +#TODO: Uncomment the below after posix_do_utimes() supports utimensat(2) accuracy +#TEST [ $LATEST_MTIME -eq $mtime1 ] +#TEST [ $LATEST_MTIME -eq $mtime2 ] + +################ Heal file6 using the latest-mtime option and its gfid ############## +subvolume=$(get_replicate_subvol_number file6) +if [ $subvolume == 0 ] +then + GFID=$(gf_get_gfid_xattr $B0/${V0}1/file6) + mtime1=$(stat -c %Y $B0/${V0}1/file5) + mtime2=$(stat -c %Y $B0/${V0}2/file5) + LATEST_MTIME=$(($mtime1 > $mtime2 ? $mtime1:$mtime2)) +elif [ $subvolume == 1 ] +then + GFID=$(gf_get_gfid_xattr $B0/${V0}3/file6) + mtime1=$(stat -c %Y $B0/${V0}3/file5) + mtime2=$(stat -c %Y $B0/${V0}4/file5) + LATEST_MTIME=$(($mtime1 > $mtime2 ? $mtime1:$mtime2)) +fi +GFIDSTR="gfid:$(gf_gfid_xattr_to_str $GFID)" +$CLI volume heal $V0 split-brain latest-mtime $GFIDSTR +EXPECT "0" echo $? + +#TODO: Uncomment the below after posix_do_utimes() supports utimensat(2) accuracy +#TEST [ $LATEST_MTIME -eq $mtime1 ] +#TEST [ $LATEST_MTIME -eq $mtime2 ] + ################ Heal remaining SB'ed files of replica_0 using B1 as source ############## $CLI volume heal $V0 split-brain source-brick $H0:$B0/${V0}1 EXPECT "0" echo $? |