From: Erwan Velu Date: Mon, 21 Mar 2016 10:47:51 +0000 (+0100) Subject: tests: Making "objectstore" calls parallel in osd-scrub-repair.sh X-Git-Tag: v10.1.1~3^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0dccb6c1640cda4423ef5adc703d11c409d8ae51;p=ceph.git tests: Making "objectstore" calls parallel in osd-scrub-repair.sh osd-scrub-repair is making several similar objectore calls in a sequential way while they could be easily parallelized. Each single objectore call can spent up to dozen of seconds so making the call parallel is saving a lot of time while keeping the code pretty simple. This particular patch saves approx. 2 minutes on the actual code on a recent laptop. The global running time of osd-scrub-repair drops from 9m33 to 7m37 ! Signed-off-by: Erwan Velu --- diff --git a/src/test/osd/osd-scrub-repair.sh b/src/test/osd/osd-scrub-repair.sh index 06d7b6bf5e06..3b9b1d85673a 100755 --- a/src/test/osd/osd-scrub-repair.sh +++ b/src/test/osd/osd-scrub-repair.sh @@ -75,8 +75,13 @@ function corrupt_and_repair_two() { # # 1) remove the corresponding file from the OSDs # - objectstore_tool $dir $first SOMETHING remove || return 1 - objectstore_tool $dir $second SOMETHING remove || return 1 + pids="" + run_in_background pids objectstore_tool $dir $first SOMETHING remove + run_in_background pids objectstore_tool $dir $second SOMETHING remove + wait_background pids + return_code=$? + if [ $return_code -ne 0 ]; then return $return_code; fi + # # 2) repair the PG # @@ -85,8 +90,13 @@ function corrupt_and_repair_two() { # # 3) The files must be back # - objectstore_tool $dir $first SOMETHING list-attrs || return 1 - objectstore_tool $dir $second SOMETHING list-attrs || return 1 + pids="" + run_in_background pids objectstore_tool $dir $first SOMETHING list-attrs + run_in_background pids objectstore_tool $dir $second SOMETHING list-attrs + wait_background pids + return_code=$? + if [ $return_code -ne 0 ]; then return $return_code; fi + rados --pool $poolname get SOMETHING $dir/COPY || return 1 diff $dir/ORIGINAL $dir/COPY || return 1 } @@ -258,9 +268,14 @@ function TEST_unfound_erasure_coded() { # # 1) remove the corresponding file from the OSDs # - objectstore_tool $dir $not_primary_first SOMETHING remove || return 1 - objectstore_tool $dir $not_primary_second SOMETHING remove || return 1 - objectstore_tool $dir $not_primary_third SOMETHING remove || return 1 + pids="" + run_in_background pids objectstore_tool $dir $not_primary_first SOMETHING remove + run_in_background pids objectstore_tool $dir $not_primary_second SOMETHING remove + run_in_background pids objectstore_tool $dir $not_primary_third SOMETHING remove + wait_background pids + return_code=$? + if [ $return_code -ne 0 ]; then return $return_code; fi + # # 2) repair the PG # @@ -299,14 +314,26 @@ function TEST_list_missing_erasure_coded() { # Put an object and remove the two shards (including primary) add_something $dir $poolname OBJ0 || return 1 local -a osds=($(get_osds $poolname OBJ0)) - objectstore_tool $dir ${osds[0]} OBJ0 remove || return 1 - objectstore_tool $dir ${osds[1]} OBJ0 remove || return 1 + + pids="" + run_in_background pids objectstore_tool $dir ${osds[0]} OBJ0 remove + run_in_background pids objectstore_tool $dir ${osds[1]} OBJ0 remove + wait_background pids + return_code=$? + if [ $return_code -ne 0 ]; then return $return_code; fi + # Put another object and remove two shards (excluding primary) add_something $dir $poolname OBJ1 || return 1 local -a osds=($(get_osds $poolname OBJ1)) - objectstore_tool $dir ${osds[1]} OBJ1 remove || return 1 - objectstore_tool $dir ${osds[2]} OBJ1 remove || return 1 + + pids="" + run_in_background pids objectstore_tool $dir ${osds[1]} OBJ1 remove + run_in_background pids objectstore_tool $dir ${osds[2]} OBJ1 remove + wait_background pids + return_code=$? + if [ $return_code -ne 0 ]; then return $return_code; fi + # Get get - both objects should in the same PG local pg=$(get_pg $poolname OBJ0)