blob: b2d382a2ce5a68bec6bb225c26dd3f2255ba03b6 (
plain)
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
|
#!/bin/bash
. $(dirname $0)/../../include.rc
. $(dirname $0)/../../volume.rc
LAST_BRICK=3
CACHE_BRICK_FIRST=4
CACHE_BRICK_LAST=5
cleanup
# Start glusterd [1-2]
TEST glusterd
TEST pidof glusterd
# Set-up tier cluster [3-4]
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
TEST $CLI volume start $V0
TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
# Start and mount the volume after enabling CTR and trash [5-8]
TEST $CLI volume set $V0 features.ctr-enabled on
TEST $CLI volume set $V0 features.trash on
TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
# Create an empty file
touch $M0/foo
# gf_file_tb and gf_flink_tb should contain one entry each [9]
ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
TEST [ $ENTRY_COUNT -eq 2 ]
# Create two hard links
ln $M0/foo $M0/lnk1
ln $M0/foo $M0/lnk2
# Now gf_flink_tb should contain 3 entries [10]
ENTRY_COUNT=$(echo "select * from gf_flink_tb;" | \
sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
TEST [ $ENTRY_COUNT -eq 3 ]
# Delete the hard link
rm -rf $M0/lnk1
# Corresponding hard link entry must be removed from gf_flink_tb
# but gf_file_tb should still contain the file entry [11]
ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
TEST [ $ENTRY_COUNT -eq 3 ]
# Remove the file
rm -rf $M0/foo
# Another hardlink removed [12]
ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
TEST [ $ENTRY_COUNT -eq 2 ]
# Remove the last hardlink
rm -rf $M0/lnk2
# All entried must be removed from gf_flink_tb and gf_file_tb [13]
ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
TEST [ $ENTRY_COUNT -eq 0 ]
cleanup
#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|