}
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
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
}
$@