glusterfs

Форк
0
76 строк · 1.8 Кб
1
#!/bin/bash
2
#
3
# Bug <915554>
4
#
5
# This test checks for a condition where a rebalance migrates a file and does
6
# not preserve the original file size. This can occur due to hole preservation
7
# logic in the file migration code. If a file size is aligned to a disk sector
8
# boundary (512b) and the tail portion of the file is zero-filled, the file
9
# may end up truncated to the end of the last data region in the file.
10
#
11
###
12

13
. $(dirname $0)/../../include.rc
14
. $(dirname $0)/../../dht.rc
15
. $(dirname $0)/../../volume.rc
16

17
cleanup;
18

19
TEST glusterd
20
TEST pidof glusterd
21

22
BRICK_COUNT=3
23
# create, start and mount a two brick DHT volume
24
TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1 $H0:$B0/${V0}2
25
TEST $CLI volume start $V0
26

27
TEST glusterfs --attribute-timeout=0 --entry-timeout=0 --gid-timeout=0 -s $H0 --volfile-id $V0 $M0;
28

29
i=1
30
# Write some data to a file and extend such that the file is sparse to a sector
31
# aligned boundary.
32
echo test > $M0/$i
33
TEST truncate -s 1M $M0/$i
34

35
# cache the original size
36
SIZE1=`stat -c %s $M0/$i`
37

38
# rename till file gets a linkfile
39

40
while [ $i -ne 0 ]
41
do
42
        test=`mv $M0/$i $M0/$(( $i+1 )) 2>/dev/null`
43
        if [ $? -ne 0 ]
44
        then
45
                echo "rename failed"
46
                break
47
        fi
48
        let i++
49
        file_has_linkfile $i
50
        has_link=$?
51
        if [ $has_link -eq 2 ]
52
        then
53
                break;
54
        fi
55
done
56

57
# start a rebalance (force option to overide checks) to trigger migration of
58
# file
59

60
TEST $CLI volume rebalance $V0 start force
61

62
# check if rebalance has completed for up to 15 secs
63

64
EXPECT_WITHIN $REBALANCE_TIMEOUT "0" rebalance_completed
65

66
# validate the file size after the migration
67
SIZE2=`stat -c %s $M0/$i`
68

69
TEST [ $SIZE1 -eq $SIZE2 ]
70

71
TEST rm -f $M0/$i
72
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
73
TEST $CLI volume stop $V0
74
TEST $CLI volume delete $V0
75

76
cleanup;
77

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

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

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

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