glusterfs

Форк
0
/
bug-1734370-entry-heal-restore-time.t 
102 строки · 3.6 Кб
1
#!/bin/bash
2

3
. $(dirname $0)/../../include.rc
4
. $(dirname $0)/../../volume.rc
5
. $(dirname $0)/../../afr.rc
6

7
cleanup;
8

9
function time_stamps_match {
10
        path=$1
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)
17

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 ) ]]
21
        then
22
            echo "Y"
23
        else
24
            echo "Mtimes: $mtime_source_b0:$mtime_sink_b1:$mtime_source_b2 Atimes: $atime_source_b0:$atime_sink_b1:$atime_source_b2"
25
        fi
26

27
}
28

29
function mtimes_match {
30
        path=$1
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)
34

35
        if [[ ( $mtime_source_b0 -eq $mtime_sink_b1) || \
36
              ( $mtime_source_b2 -eq $mtime_sink_b1) ]]
37
        then
38
            echo "Y"
39
        else
40
            echo "Mtimes: $mtime_source_b0:$mtime_sink_b1:$mtime_source_b2"
41
        fi
42

43
}
44

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
48

49
TEST glusterd;
50
TEST pidof glusterd;
51
TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2};
52
TEST $CLI volume start $V0;
53

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
58

59
###############################################################################
60
TEST mkdir $M0/DIR
61
TEST kill_brick $V0 $H0 $B0/${V0}1
62
TEST touch $M0/DIR/FILE
63

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
72

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 ]
79

80

81
###############################################################################
82
# Repeat the test with ctime feature disabled.
83
TEST $CLI volume set $V0 features.ctime off
84
TEST mkdir $M0/DIR2
85
TEST kill_brick $V0 $H0 $B0/${V0}1
86
TEST touch $M0/DIR2/FILE
87

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
98

99
EXPECT "Y" mtimes_match DIR2
100

101
TEST rm $GET_MDATA_PATH/get-mdata-xattr
102
cleanup;
103

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.