]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: Making "objectstore" calls parallel in osd-scrub-repair.sh
authorErwan Velu <erwan@redhat.com>
Mon, 21 Mar 2016 10:47:51 +0000 (11:47 +0100)
committerErwan Velu <erwan@redhat.com>
Tue, 5 Apr 2016 07:36:25 +0000 (09:36 +0200)
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 <erwan@redhat.com>
src/test/osd/osd-scrub-repair.sh

index 06d7b6bf5e06956d9b21f292bceba60cd64d68ec..3b9b1d85673ae530c78e32a97e73f01794b8e39c 100755 (executable)
@@ -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)