From 5fa004f3c4924dd6d83aecd5f33fc58badbe9305 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Fri, 20 Jul 2018 10:52:22 +0530 Subject: features/shard: Make lru limit of inode list configurable Currently this lru limit is hard-coded to 16384. This patch makes it configurable to make it easier to hit the lru limit and enable testing of different cases that arise when the limit is reached. The option is features.shard-lru-limit. It is by design allowed to be configured only in init() but not in reconfigure(). This is to avoid all the complexity associated with eviction of least recently used shards when the list is shrunk. Change-Id: Ifdcc2099f634314fafe8444e2d676e192e89e295 updates: bz#1605056 Signed-off-by: Krutika Dhananjay --- tests/bugs/shard/configure-lru-limit.t | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/bugs/shard/configure-lru-limit.t (limited to 'tests/bugs') diff --git a/tests/bugs/shard/configure-lru-limit.t b/tests/bugs/shard/configure-lru-limit.t new file mode 100644 index 00000000000..a8ba8ed8509 --- /dev/null +++ b/tests/bugs/shard/configure-lru-limit.t @@ -0,0 +1,48 @@ +#!/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 + +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 -- cgit