glusterfs

Форк
0
/
issue-1358.t 
99 строк · 2.8 Кб
1
#!/bin/bash
2

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

6
cleanup;
7

8
FILE_COUNT_TIME=5
9

10
function get_file_count {
11
    ls $1* | wc -l
12
}
13

14
TEST glusterd
15
TEST pidof glusterd
16
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
17
TEST $CLI volume set $V0 features.shard on
18
TEST $CLI volume set $V0 features.shard-block-size 4MB
19
TEST $CLI volume set $V0 performance.quick-read off
20
TEST $CLI volume set $V0 performance.io-cache off
21
TEST $CLI volume set $V0 performance.read-ahead off
22
TEST $CLI volume set $V0 performance.write-behind off
23
TEST $CLI volume start $V0
24

25
TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
26

27
TEST mkdir $M0/dir
28
TEST dd if=/dev/urandom of=$M0/dir/foo bs=4M count=5
29
gfid_new=$(get_gfid_string $M0/dir/foo)
30

31
# Ensure its shards dir is created now.
32
TEST stat $B0/${V0}0/.shard/$gfid_new.1
33
TEST stat $B0/${V0}1/.shard/$gfid_new.1
34
TEST stat $B0/${V0}0/.shard/$gfid_new.2
35
TEST stat $B0/${V0}1/.shard/$gfid_new.2
36

37
# Open a file and store descriptor in fd = 5
38
exec 5>$M0/dir/foo
39

40
# Write something on the file using the open fd = 5
41
echo "issue-1358" >&5
42

43
# Write on the descriptor should be succesful
44
EXPECT 0 echo $?
45

46
# Unlink the same file which is opened in prev step
47
TEST unlink $M0/dir/foo
48

49
# Check the base file
50
TEST ! stat $M0/dir/foo
51
TEST ! stat $B0/${V0}0/foo
52
TEST ! stat $B0/${V0}1/foo
53

54
# Write something on the file using the open fd = 5
55
echo "issue-1281" >&5
56

57
# Write on the descriptor should be succesful
58
EXPECT 0 echo $?
59

60
# Check ".shard/.remove_me"
61
EXPECT_WITHIN $FILE_COUNT_TIME 1 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_new
62
EXPECT_WITHIN $FILE_COUNT_TIME 1 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_new
63

64
# Close the fd = 5
65
exec 5>&-
66

67
###### To see the shards deleted, wait for 10 mins or repeat the same steps i.e open a file #####
68
###### write something to it, unlink it and close it. This will wake up the thread that is ######
69
###### responsible to delete the shards
70

71
TEST touch $M0/dir/new
72
exec 6>$M0/dir/new
73
echo "issue-1358" >&6
74
EXPECT 0 echo $?
75
TEST unlink $M0/dir/new
76
exec 6>&-
77

78
# Now check the ".shard/remove_me" and the gfid will not be there
79
EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_new
80
EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_new
81

82
# check for the absence of shards
83
TEST ! stat $B0/${V0}0/.shard/$gfid_new.1
84
TEST ! stat $B0/${V0}1/.shard/$gfid_new.1
85
TEST ! stat $B0/${V0}0/.shard/$gfid_new.2
86
TEST ! stat $B0/${V0}1/.shard/$gfid_new.2
87

88
#### Create the file with same name and check creation and deletion works fine ######
89
TEST dd if=/dev/urandom of=$M0/dir/foo bs=4M count=5
90
gfid_new=$(get_gfid_string $M0/dir/foo)
91

92
# Ensure its shards dir is created now.
93
TEST stat $B0/${V0}0/.shard/$gfid_new.1
94
TEST stat $B0/${V0}1/.shard/$gfid_new.1
95
TEST stat $B0/${V0}0/.shard/$gfid_new.2
96
TEST stat $B0/${V0}1/.shard/$gfid_new.2
97

98
TEST unlink $M0/dir/foo
99
cleanup
100

101

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

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

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

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