]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/standalone/osd/pg-split-merge: fix import_after_merge_and_gap 26727/head
authorSage Weil <sage@redhat.com>
Fri, 1 Mar 2019 21:48:24 +0000 (15:48 -0600)
committerSage Weil <sage@redhat.com>
Sun, 3 Mar 2019 16:23:27 +0000 (10:23 -0600)
This test introduces a map gap.  What *should* happen is that when there is
such a gap, we cannot import.  Previously, the test didn't reliably produce
a map gap at all, and didn't check that import failed--it verified that it
passed.

Fix the test so that it reliably produces a gap *and* reports
min_last_epoch_clean to the mon so we can trim.  Then verify we fail to
import, but can with --force.  But remove the pg again, because if we
force an import with a map gap the osd will refuse to start.

Fixes: http://tracker.ceph.com/issues/38525
Signed-off-by: Sage Weil <sage@redhat.com>
qa/standalone/osd/pg-split-merge.sh

index 7e9b8ed8b73ce5fbe07fc055bff5e4148d57ba15..11d1c4387439510912b13998be4a096d2aee88cd 100755 (executable)
@@ -53,20 +53,38 @@ function TEST_import_after_merge_and_gap() {
        ceph osd set nodown
        ceph osd unset nodown
     done
+
+    # poke and prod to ensure last_epech_clean is big, reported to mon, and
+    # the osd is able to trim old maps
+    rados -p foo bench 1 write -b 1024 --no-cleanup || return 1
     wait_for_clean || return 1
-    ceph osd down 0
-    sleep 3
-    wait_for_clean || return 1
+    ceph tell osd.0 send_beacon
+    sleep 5
+    ceph osd set nodown
+    ceph osd unset nodown
+    sleep 5
 
     kill_daemons $dir TERM osd.0 || return 1
 
     # this should fail.. 1.1 still doesn't exist
     ! ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 || return 1
 
-    # this should not
+    ceph-objectstore-tool --data-path $dir/0 --op export-remove --pgid 1.0 --force --file $dir/1.0.later || return 1
+
+    # this should fail too because of the gap
+    ! ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 || return 1
+    ! ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0 || return 1
+
+    # we can force it...
+    ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 --force || return 1
+    ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0 --force || return 1
+
+    # ...but the osd won't start, so remove it again.
     ceph-objectstore-tool --data-path $dir/0 --op remove --pgid 1.0 --force || return 1
-    ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 || return 1
-    ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0 || return 1
+    ceph-objectstore-tool --data-path $dir/0 --op remove --pgid 1.1 --force || return 1
+
+    ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0.later --force || return 1
+
 
     activate_osd $dir 0 || return 1