]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add stray_test to test_unfound.sh
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Sat, 13 Nov 2010 07:44:50 +0000 (23:44 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 15 Nov 2010 20:15:15 +0000 (12:15 -0800)
This test is designed to produce a stray that nonetheless has some
useful objects. The primary should be able to find those objects and ask
for them.

Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/test/test_unfound.sh

index c7a03eb0dee83b238a7e1e485523bf962eb68c35..20c53d018ea29eed73191c6f992eabf8acd618fd 100755 (executable)
@@ -13,14 +13,16 @@ my_write_objects() {
 }
 
 setup() {
+        export CEPH_NUM_OSD=$1
+
         # Start ceph
         ./stop.sh
 
         # set recovery start to a really long time to ensure that we don't start recovery
-        CEPH_NUM_OSD=2 ./vstart.sh -d -n -o 'osd recovery delay start = 10000' || die "vstart failed"
+        ./vstart.sh -d -n -o 'osd recovery delay start = 10000' || die "vstart failed"
 }
 
-do_test() {
+osd_resurrection_1_impl() {
         # Write lots and lots of objects
         my_write_objects 1 2
 
@@ -59,14 +61,79 @@ do_test() {
         wait
         [ -e $TEMPDIR/obj01 ] || die "unexpected error: failed to fetched newly-found object"
 
+        # TODO: turn off recovery delay start and verify that every osd gets copies of the correct objects.
+
         # success
         return 1
 }
 
+osd_resurrection_1() {
+        setup 2
+        osd_resurrection_1_impl
+}
+
+stray_test_impl() {
+        ./ceph osd down 0
+        ./ceph osd out 0
+        # 0:out 1:active 2:active
+
+        my_write_objects 1 1
+
+        ./ceph osd down 1
+        ./ceph osd out 1
+        sleep 15
+        # 0:out 1:out(ver1) 2:active(ver1)
+
+        my_write_objects 2 2
+
+        ./ceph osd up 1
+        ./ceph osd in 1
+        sleep 15
+        # 0:out 1:active(ver1) 2:active(ver2)
+
+        ./ceph osd down 2
+        ./ceph osd out 2
+        sleep 15
+        # 0:out 1:active(ver1) 2:out(ver2)
+
+        ./ceph osd up 0
+        ./ceph osd in 0
+        sleep 15
+        # 0:active 1:active(ver1) 2:out(ver2)
+
+       poll_cmd "./ceph pg debug unfound_objects_exist" TRUE 3 120
+        [ $? -eq 1 ] || die "Failed to see unfound objects."
+
+        #
+        # Now, when we bring up osd2, it wil be considered a stray. However, it
+        # has the version that we need-- the very latest version of the
+        # objects.
+        #
+
+        ./ceph osd up 2
+        ./ceph osd in 2
+        sleep 15
+
+       poll_cmd "./ceph pg debug unfound_objects_exist" FALSE 3 120
+        [ $? -eq 1 ] || die "Failed to discover unfound objects."
+
+        # success
+        return 1
+}
+
+stray_test() {
+        setup 3
+        stray_test_impl
+}
+
 run() {
-        setup
+        osd_resurrection_1
+        [ $? -eq 1 ] || return 0
+        ./stop.sh
 
-        do_test
+        stray_test
+        [ $? -eq 1 ] || return 0
+        ./stop.sh
 }
 
 $@