From cf35c54224b3ebed6d50b5b38a2390c4394dfee8 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 29 Jul 2022 16:02:04 -0600 Subject: [PATCH] LU-14745 tests: ensure sanity/51d has enough objects Ensure that sanity test_51d has precreated enough objects on the OSTs for the tests to finish without running out. Otherwise, some OSTs may be skipped and skew the results. Test-Parameters: trivial testlist=sanity env=ONLY=51d,ONLY_REPEAT=5 mdscount=2 mdtcount=4 Test-Parameters: testlist=sanity env=ONLY=51d,ONLY_REPEAT=5 mdscount=2 mdtcount=4 Test-Parameters: testlist=sanity env=ONLY=51d,ONLY_REPEAT=5 mdscount=2 mdtcount=4 Test-Parameters: testlist=sanity env=ONLY=51d,ONLY_REPEAT=5 mdscount=2 mdtcount=4 Test-Parameters: testlist=sanity env=ONLY=51d,ONLY_REPEAT=5 mdscount=2 mdtcount=4 Test-Parameters: testlist=sanity env=ONLY=51d,ONLY_REPEAT=5 mdscount=2 mdtcount=4 Test-Parameters: testlist=sanity env=ONLY=51d,ONLY_REPEAT=5 mdscount=2 mdtcount=4 Fixes: fd5c915eff ("LU-15282 tests: improve sanity test_51d coverage") Signed-off-by: Andreas Dilger Change-Id: Ifaf79173aa34fc7f3b3b1ad3d2876b65c16d1474 Reviewed-on: https://review.whamcloud.com/48086 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Lai Siyao --- lustre/tests/sanity.sh | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c78d2b0..4b0b3bb 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5847,7 +5847,7 @@ run_test 51b "exceed 64k subdirectory nlink limit on create, verify unlink" test_51d_sub() { local stripecount=$1 - local nfiles=$((200 * $OSTCOUNT)) + local nfiles=$2 log "create files with stripecount=$stripecount" $LFS setstripe -C $stripecount $DIR/$tdir @@ -5878,20 +5878,24 @@ test_51d_sub() { for ((nlast=0, n = 1; n < $OSTCOUNT; nlast=n,n++)); do (( ${objs[$n]} > ${objs[$nlast]} * 4 / 5 )) || { $LFS df && $LFS df -i && - error "OST $n has fewer objects vs. OST $nlast " \ + error "stripecount=$stripecount: " \ + "OST $n has fewer objects vs. OST $nlast " \ "(${objs[$n]} < ${objs[$nlast]} x 4/5)"; } (( ${objs[$n]} < ${objs[$nlast]} * 5 / 4 )) || { $LFS df && $LFS df -i && - error "OST $n has fewer objects vs. OST $nlast " \ + error "stripecount=$stripecount: " \ + "OST $n has more objects vs. OST $nlast " \ "(${objs[$n]} > ${objs[$nlast]} x 5/4)"; } (( ${objs0[$n]} > ${objs0[$nlast]} * $min / $max )) || { $LFS df && $LFS df -i && - error "OST $n has fewer #0 objects vs. OST $nlast " \ + error "stripecount=$stripecount: " \ + "OST $n has fewer #0 objects vs. OST $nlast " \ "(${objs0[$n]} < ${objs0[$nlast]} x $min/$max)"; } (( ${objs0[$n]} < ${objs0[$nlast]} * $max / $min )) || { $LFS df && $LFS df -i && - error "OST $n has fewer #0 objects vs. OST $nlast " \ + error "stripecount=$stripecount: " \ + "OST $n has more #0 objects vs. OST $nlast " \ "(${objs0[$n]} > ${objs0[$nlast]} x $max/$min)"; } done } @@ -5901,21 +5905,44 @@ test_51d() { [[ $OSTCOUNT -lt 3 ]] && skip_env "needs >= 3 OSTs" local stripecount + local per_ost=100 + local nfiles=$((per_ost * OSTCOUNT)) + local mdts=$(comma_list $(mdts_nodes)) + local param="osp.*.create_count" local qos_old=$(do_facet mds1 \ "$LCTL get_param -n lod.$FSNAME-*.qos_threshold_rr" | head -n 1) - do_nodes $(comma_list $(mdts_nodes)) \ + do_nodes $mdts \ "$LCTL set_param lod.$FSNAME-*.qos_threshold_rr=100" - stack_trap "do_nodes $(comma_list $(mdts_nodes)) \ + stack_trap "do_nodes $mdts \ '$LCTL set_param lod.$FSNAME-*.qos_threshold_rr=${qos_old%%%}'" test_mkdir $DIR/$tdir + local dirstripes=$(lfs getdirstripe -c $DIR/$tdir) + + # Ensure enough OST objects precreated for tests to pass without + # running out of objects. This is an LOV r-r OST algorithm test, + # not an OST object precreation test. + local old=$(do_facet mds1 "$LCTL get_param -n $param" | head -n 1) + (( old >= nfiles )) || + { + local create_count=$((nfiles * OSTCOUNT / dirstripes)) + + do_nodes $mdts "$LCTL set_param $param=$create_count" + stack_trap "do_nodes $mdts $LCTL set_param $param=$old" + + # trigger precreation from all MDTs for all OSTs + for ((i = 0; i < $MDSCOUNT * 2; i++ )); do + $LFS setstripe -c -1 $DIR/$tdir/wide.$i + done + } for ((stripecount = 3; stripecount <= $OSTCOUNT; stripecount++)); do - test_51d_sub $stripecount + sleep 8 # allow object precreation to catch up + test_51d_sub $stripecount $nfiles done } -run_test 51d "check object distribution" +run_test 51d "check LOV round-robin OST object distribution" test_51e() { if [ "$mds1_FSTYPE" != ldiskfs ]; then -- 1.8.3.1