3
. $(dirname $0)/../../include.rc
4
. $(dirname $0)/../../volume.rc
5
. $(dirname $0)/../../afr.rc
9
function time_stamps_match {
11
mtime_source_b0=$(get_mtime $B0/${V0}0/$path)
12
atime_source_b0=$(get_atime $B0/${V0}0/$path)
13
mtime_source_b2=$(get_mtime $B0/${V0}2/$path)
14
atime_source_b2=$(get_atime $B0/${V0}2/$path)
15
mtime_sink_b1=$(get_mtime $B0/${V0}1/$path)
16
atime_sink_b1=$(get_atime $B0/${V0}1/$path)
18
#The same brick must be the source of heal for both atime and mtime.
19
if [[ ( $mtime_source_b0 -eq $mtime_sink_b1 && $atime_source_b0 -eq $atime_sink_b1 ) || \
20
( $mtime_source_b2 -eq $mtime_sink_b1 && $atime_source_b2 -eq $atime_sink_b1 ) ]]
24
echo "Mtimes: $mtime_source_b0:$mtime_sink_b1:$mtime_source_b2 Atimes: $atime_source_b0:$atime_sink_b1:$atime_source_b2"
29
function mtimes_match {
31
mtime_source_b0=$(get_mtime $B0/${V0}0/$path)
32
mtime_source_b2=$(get_mtime $B0/${V0}2/$path)
33
mtime_sink_b1=$(get_mtime $B0/${V0}1/$path)
35
if [[ ( $mtime_source_b0 -eq $mtime_sink_b1) || \
36
( $mtime_source_b2 -eq $mtime_sink_b1) ]]
40
echo "Mtimes: $mtime_source_b0:$mtime_sink_b1:$mtime_source_b2"
45
# Test that the parent dir's timestamps are restored during entry-heal.
46
GET_MDATA_PATH=$(dirname $0)/../../utils
47
build_tester $GET_MDATA_PATH/get-mdata-xattr.c
51
TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2};
52
TEST $CLI volume start $V0;
54
TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 --attribute-timeout=0 --entry-timeout=0 $M0
55
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
56
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1
57
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 2
59
###############################################################################
61
TEST kill_brick $V0 $H0 $B0/${V0}1
62
TEST touch $M0/DIR/FILE
64
TEST $CLI volume start $V0 force
65
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
66
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
67
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
68
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
69
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2
70
TEST $CLI volume heal $V0
71
EXPECT_WITHIN $HEAL_TIMEOUT "0" get_pending_heal_count $V0
73
EXPECT "Y" time_stamps_match DIR
74
ctime_source1=$(get_ctime $B0/${V0}0/$path)
75
ctime_source2=$(get_ctime $B0/${V0}2/$path)
76
ctime_sink=$(get_ctime $B0/${V0}1/$path)
77
TEST [ $ctime_source1 -eq $ctime_sink ]
78
TEST [ $ctime_source2 -eq $ctime_sink ]
81
###############################################################################
82
# Repeat the test with ctime feature disabled.
83
TEST $CLI volume set $V0 features.ctime off
85
TEST kill_brick $V0 $H0 $B0/${V0}1
86
TEST touch $M0/DIR2/FILE
88
TEST $CLI volume start $V0 force
89
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
90
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
91
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
92
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
93
EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2
94
TEST $CLI volume heal $V0
95
#Executing parallel heal may lead to changing atime after heal. So better
96
#to test just the mtime
97
EXPECT_WITHIN $HEAL_TIMEOUT "0" get_pending_heal_count $V0
99
EXPECT "Y" mtimes_match DIR2
101
TEST rm $GET_MDATA_PATH/get-mdata-xattr