Fix online PG count change, add a test for it

This commit is contained in:
Vitaliy Filippov
2025-07-15 02:33:28 +03:00
parent 3fff667f13
commit 68905cbf41
6 changed files with 94 additions and 2 deletions
+2
View File
@@ -10,6 +10,8 @@ cd $(dirname $0)
./test_change_pg_count.sh
SCHEME=ec ./test_change_pg_count.sh
./test_change_pg_count_online.sh
./test_change_pg_size.sh
./test_create_nomaxid.sh
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash -ex
OSD_COUNT=${OSD_COUNT:-6}
PG_COUNT=16
GLOBAL_CONFIG=',"client_retry_interval":1000'
. `dirname $0`/run_3osds.sh
LD_PRELOAD="build/src/client/libfio_vitastor.so" \
fio -thread -name=test -ioengine=build/src/client/libfio_vitastor.so -bs=4M -direct=1 -iodepth=1 -fsync=1 -rw=write \
-etcd=$ETCD_URL -pool=1 -inode=2 -size=128M
LD_PRELOAD="build/src/client/libfio_vitastor.so" \
fio -thread -name=test -ioengine=build/src/client/libfio_vitastor.so -bs=4k -direct=1 -iodepth=4 -rw=randrw \
-etcd=$ETCD_URL -pool=1 -inode=2 -size=128M -loops=100 -cluster_log_level=3 -runtime=60 &>./testdata/fio.log &
FIO_PID=$!
try_change()
{
n=$1
for i in {1..6}; do
echo --- Change PG count to $n --- >>testdata/osd$i.log
done
echo --- Change PG count to $n --- >>testdata/mon.log
$ETCDCTL put /vitastor/config/pools '{"1":{'$POOLCFG',"pg_size":'$PG_SIZE',"pg_minsize":'$PG_MINSIZE',"pg_count":'$n'}}'
echo "Pool 1 (testpool) PG count changed from $PG_COUNT to $n" >> testdata/pgr.log
PG_COUNT=$n
sleep 10
}
sleep 5
# 16 -> 32
try_change 32
# 32 -> 16
try_change 16
# 16 -> 25
try_change 25
# 25 -> 17
try_change 17
# 17 -> 16
try_change 16
wait $FIO_PID
grep -P 'Pool 1 \(testpool\) PG count changed from \d+ to \d+' testdata/fio.log > testdata/pgc.log
diff testdata/pgr.log testdata/pgc.log
format_green OK