diff --git a/src/test/test_lost.sh b/src/test/test_lost.sh index c93f1a656a5..ae0ae04318b 100755 --- a/src/test/test_lost.sh +++ b/src/test/test_lost.sh @@ -8,10 +8,6 @@ source "`dirname $0`/test_common.sh" # Functions -my_write_objects() { - write_objects $1 $2 200 4000 -} - setup() { export CEPH_NUM_OSD=$1 @@ -24,13 +20,13 @@ setup() { recovery1_impl() { # Write lots and lots of objects - my_write_objects 1 1 + write_objects 1 1 200 4000 # Take down osd1 stop_osd 1 # Continue writing a lot of objects - my_write_objects 2 2 + write_objects 2 2 200 4000 # Bring up osd1 restart_osd 1 @@ -65,8 +61,56 @@ recovery1() { recovery1_impl } +lost1_impl() { + # Write lots and lots of objects + write_objects 1 1 20 8000 + + # Take down osd1 + stop_osd 1 + + # Continue writing a lot of objects + write_objects 2 2 20 8000 + + # Bring up osd1 + restart_osd 1 + + # Finish peering. + sleep 15 + + # Stop osd0. + # At this point we have peered, but *NOT* recovered. + # Objects should be lost. + stop_osd 0 + + # Since recovery can't proceed, stuff should be unfound. + poll_cmd "./ceph pg debug unfound_objects_exist" TRUE 3 120 + [ $? -eq 1 ] || die "Failed to see unfound objects." + + # Lose all objects. + ./ceph osd lost 0 --yes-i-really-mean-it + + # Unfound objects go away and are turned into lost objects. + poll_cmd "./ceph pg debug unfound_objects_exist" FALSE 3 120 + [ $? -eq 1 ] || die "Unfound objects didn't go away." + + # Reading from a lost object gives back an error code. + # TODO: check error code + ./rados -p data get obj01 $TEMPDIR/obj01 &&\ + die "expected radostool error" +} + +# TODO: lost2 test where we ask for an object while it's still unfound, and +# verify we get woken to an error when it's declared lost. + +lost1() { + setup 2 + lost1_impl +} + run() { recovery1 || die "test failed" + + lost1 || die "test failed" } $@