File: 077

package info (click to toggle)
sheepdog 0.8.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,364 kB
  • ctags: 3,951
  • sloc: ansic: 30,552; sh: 3,573; perl: 2,924; asm: 453; makefile: 391; python: 192
file content (148 lines) | stat: -rwxr-xr-x 2,584 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash

# Test vdi repair functionality

. ./common

for i in `seq 0 2`; do
    _start_sheep $i
done

_wait_for_sheep 3

_cluster_format

$DOG vdi create test 12M
_vdi_list

echo "original data" | $DOG vdi write test

$DOG cluster shutdown

# single object lost

rm $STORE/0/obj/007c2b2500000000

for i in `seq 0 2`; do
    _start_sheep $i
done

_wait_for_sheep 3

$DOG vdi check test

$DOG vdi read test 0 14

$DOG cluster shutdown

# single broken object

_random | dd of=$STORE/1/obj/007c2b2500000000 bs=4096 count=1024 &> /dev/null

for i in `seq 0 2`; do
    _start_sheep $i
done

_wait_for_sheep 3

$DOG vdi check test

$DOG vdi read test 0 14

$DOG cluster shutdown

# two object lost

rm $STORE/0/obj/007c2b2500000000
rm $STORE/1/obj/007c2b2500000000

for i in `seq 0 2`; do
    _start_sheep $i
done

_wait_for_sheep 3

$DOG vdi check test

$DOG vdi read test 0 14

$DOG cluster shutdown

# single object lost, single broken object. no majority

rm $STORE/0/obj/007c2b2500000000
_random | dd of=$STORE/1/obj/007c2b2500000000 bs=4096 count=1024 &> /dev/null

for i in `seq 0 2`; do
    _start_sheep $i
done

_wait_for_sheep 3

$DOG vdi check test

$DOG cluster shutdown



read_vdi_from_nodes()
{
	for i in `seq 0 $(($1-1))`; do
		$DOG vdi read test 0 12 -p $((7000+$i))
		echo ""
	done
}

check_vdi_consistance()
{
	read_vdi_from_nodes $1
	$DOG vdi check test
	read_vdi_from_nodes $1
}

echo ""

for i in 0 1 2; do
    _start_sheep $i
done
_wait_for_sheep 3

echo "yes" | $DOG cluster format -c 3
$DOG vdi create test 4M
echo "hello, copy0" | $DOG vdi write test 0 12
cp $STORE/0/obj/007c2b2500000000 $STORE/copy0
echo "hello, copy1" | $DOG vdi write test 0 12
cp $STORE/1/obj/007c2b2500000000 $STORE/copy1
echo "hello, copy2" | $DOG vdi write test 0 12

# three copies, two broken objects, no majority

cp $STORE/copy0 $STORE/0/obj/007c2b2500000000
cp $STORE/copy1 $STORE/1/obj/007c2b2500000000
check_vdi_consistance 3

for i in 3 4; do
    _start_sheep $i
done
_wait_for_sheep 5

echo "yes" | $DOG cluster format -c 5
$DOG vdi create test 4M
echo "hello, copy0" | $DOG vdi write test 0 12
cp $STORE/0/obj/007c2b2500000000 $STORE/copy0
echo "hello, copy1" | $DOG vdi write test 0 12
cp $STORE/1/obj/007c2b2500000000 $STORE/copy1

# five copies, two broken objects(AABBB)

cp $STORE/copy0 $STORE/0/obj/007c2b2500000000
cp $STORE/copy0 $STORE/1/obj/007c2b2500000000
check_vdi_consistance 5

# five copies, two broken objects(BABAB)

cp $STORE/copy0 $STORE/1/obj/007c2b2500000000
cp $STORE/copy0 $STORE/3/obj/007c2b2500000000
check_vdi_consistance 5

$DOG cluster shutdown