4 # Creates some unfound objects and then tests finding them.
8 source "`dirname $0`/test_common.sh"
14 write_objects $1 $2 10 1000000 $TEST_POOL
18 export CEPH_NUM_OSD=$1
23 # set recovery start to a really long time to ensure that we don't start recovery
24 ./vstart.sh -d -n -o 'osd recovery delay start = 10000
25 osd max scrubs = 0' || die "vstart failed"
28 osd_resurrection_1_impl() {
29 # Write lots and lots of objects
35 # Continue writing a lot of objects
45 # At this point we have peered, but *NOT* recovered.
46 # Objects should be lost.
49 poll_cmd "./ceph pg debug unfound_objects_exist" TRUE 3 120
50 [ $? -eq 1 ] || die "Failed to see unfound objects."
51 echo "Got unfound objects."
54 ./rados -c ./ceph.conf -p $TEST_POOL get obj01 $TEMPDIR/obj01 || die "radostool failed"
57 [ -e $TEMPDIR/obj01 ] && die "unexpected error: fetched unfound object?"
61 poll_cmd "./ceph pg debug unfound_objects_exist" FALSE 3 120
62 [ $? -eq 1 ] || die "Failed to recover unfound objects."
65 [ -e $TEMPDIR/obj01 ] || die "unexpected error: failed to fetched newly-found object"
67 # Turn off recovery delay start and verify that every osd gets copies
68 # of the correct objects.
69 echo "starting recovery..."
76 osd_resurrection_1() {
78 osd_resurrection_1_impl
83 # 0:stopped 1:active 2:active
89 # 0:stopped 1:stopped(ver1) 2:active(ver1)
95 # 0:stopped 1:active(ver1) 2:active(ver2)
99 # 0:stopped 1:active(ver1) 2:stopped(ver2)
103 # 0:active 1:active(ver1) 2:stopped(ver2)
105 poll_cmd "./ceph pg debug unfound_objects_exist" TRUE 5 300
106 [ $? -eq 1 ] || die "Failed to see unfound objects."
109 # Now, when we bring up osd2, it wil be considered a stray. However, it
110 # has the version that we need-- the very latest version of the
117 poll_cmd "./ceph pg debug unfound_objects_exist" FALSE 4 240
118 [ $? -eq 1 ] || die "Failed to discover unfound objects."
120 echo "starting recovery..."
133 osd_resurrection_1 || die "test failed"
135 stray_test || die "test failed"