From e357c4d712e785b9eefc86dd085ccc63cee72c83 Mon Sep 17 00:00:00 2001 From: Keith Mannthey Date: Thu, 11 Jul 2013 22:33:04 -0700 Subject: [PATCH] LU-2902 test: ost stat parameters were not present A few tests use roc_hit to sort out cache hits. These tests were failing for a while because the lproc stats needed were not present. Use roc_hit_init with setstripe to correctly identify that basic cache_access stats are working for each individual ost before using roc_hit. Signed-off-by: Keith Mannthey Change-Id: Iea501433ddcdb367fe5d9614361b4aff049cb1f1 Reviewed-on: http://review.whamcloud.com/6564 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 5b5b0dd..26b3d95 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -8617,12 +8617,48 @@ test_150() { } run_test 150 "truncate/append tests" +#LU-2902 roc_hit was not able to read all values from lproc +function roc_hit_init() { + local list=$(comma_list $(osts_nodes)) + local dir=$DIR/$tdir-check + local file=$dir/file + local BEFORE + local AFTER + local idx + + test_mkdir -p $dir + #use setstripe to do a write to every ost + for i in $(seq 0 $((OSTCOUNT-1))); do + $SETSTRIPE -c 1 -i $i $dir || error "$SETSTRIPE $file failed" + dd if=/dev/urandom of=$file bs=4k count=4 2>&1 > /dev/null + idx=$(printf %04x $i) + BEFORE=$(get_osd_param $list *OST*$idx stats | + awk '$1 == "cache_access" {sum += $2} END { print sum }') + if [ -z "$BEFORE" ]; then + BEFORE=0 + fi + + cancel_lru_locks osc + cat $file >/dev/null + + AFTER=$(get_osd_param $list *OST*$idx stats | + awk '$1 == "cache_access" {sum += $2} END { print sum }') + + echo BEFORE:$BEFORE AFTER:$AFTER + if ! let "AFTER - BEFORE == 4"; then + rm -rf $dir + error "roc_hit is not safe to use" + fi + rm $file + done + + rm -rf $dir +} + function roc_hit() { local list=$(comma_list $(osts_nodes)) - #debug temp debug for LU-2902: lets see what values we get back - echo $(get_osd_param $list '' stats) 1>&2 echo $(get_osd_param $list '' stats | - awk '/'cache_hit'/ {sum+=$2} END {print sum}') + awk '$1 == "cache_hit" {sum += $2} END { print sum }') } function set_cache() { @@ -8664,6 +8700,8 @@ test_151() { return 0 fi + roc_hit_init + #define OBD_FAIL_OBD_NO_LRU 0x609 do_nodes $list $LCTL set_param fail_loc=0x609 @@ -9079,6 +9117,8 @@ test_156() { skip "LU-1956/LU-2261: stats unimplemented on OSD ZFS" && return + roc_hit_init + log "Turn on read and write cache" set_cache read on set_cache writethrough on -- 1.8.3.1