summaryrefslogtreecommitdiffstats
path: root/tests/bugs/shard/configure-lru-limit.t
blob: 923a4d8d7478f2ac225f596e90246e20f9399c12 (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
#!/bin/bash

. $(dirname $0)/../../include.rc
. $(dirname $0)/../../volume.rc
cleanup

TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
TEST $CLI volume set $V0 features.shard on
TEST $CLI volume set $V0 features.shard-block-size 4MB
TEST $CLI volume set $V0 features.shard-lru-limit 25
TEST $CLI volume start $V0
EXPECT 'Started' volinfo_field $V0 'Status';
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2

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

# Perform a write that would cause 25 shards to be created, 24 of them under .shard
TEST dd if=/dev/zero of=$M0/foo bs=1M count=100

statedump=$(generate_mount_statedump $V0)
sleep 1
EXPECT "25" echo $(grep "lru-max-limit" $statedump | cut -f2 -d'=' | tail -1)

# Base shard is never added to this list. So all other shards should make up for 24 inodes in lru list
EXPECT "24" echo $(grep "inode-count" $statedump | cut -f2 -d'=' | tail -1)

rm -f $statedump

# Test to ensure there's no "reconfiguration" of the value once set.
TEST $CLI volume set $V0 features.shard-lru-limit 30
statedump=$(generate_mount_statedump $V0)
sleep 1
EXPECT "25" echo $(grep "lru-max-limit" $statedump | cut -f2 -d'=' | tail -1)
rm -f $statedump

EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0

TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
statedump=$(generate_mount_statedump $V0)
sleep 1
EXPECT "30" echo $(grep "lru-max-limit" $statedump | cut -f2 -d'=' | tail -1)
rm -f $statedump

EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
TEST $CLI volume stop $V0
TEST $CLI volume delete $V0

cleanup