]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: test repair when file is removed 3034/head
authorLoic Dachary <ldachary@redhat.com>
Thu, 4 Dec 2014 11:15:30 +0000 (12:15 +0100)
committerLoic Dachary <ldachary@redhat.com>
Fri, 9 Jan 2015 12:19:07 +0000 (13:19 +0100)
Add tests for when files disappear from the file system :

  * file is missing from the primary OSD
  * file is missing from an OSD that is not the primary
  * files are missing from two OSDs that are not the primary
  * files are missing from two OSDs, one of which is the primary

http://tracker.ceph.com/issues/10017 Refs: #10017

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/osd/osd-scrub-repair.sh

index 1170b1535704d8b19374c626e20c52f213558ab7..90c51c047153a0f5b873f67c3e8a3c1593d6c0e5 100755 (executable)
@@ -120,15 +120,44 @@ function TEST_corrupt_and_repair_erasure_coded() {
     local not_primary_first=${osds[0]}
     local not_primary_second=${osds[1]}
 
+    # Reproduces http://tracker.ceph.com/issues/10017
+    corrupt_and_repair_one $dir $poolname $primary  || return 1
     # Reproduces http://tracker.ceph.com/issues/10409
     corrupt_and_repair_one $dir $poolname $not_primary_first || return 1
+    corrupt_and_repair_two $dir $poolname $not_primary_first $not_primary_second || return 1
+    corrupt_and_repair_two $dir $poolname $primary $not_primary_first || return 1
 
     teardown $dir || return 1
 }
 
+function corrupt_and_repair_two() {
+    local dir=$1
+    local poolname=$2
+    local first=$3
+    local second=$4
+
+    #
+    # 1) remove the corresponding file from the OSDs
+    #
+    objectstore_tool $dir $first SOMETHING remove || return 1
+    objectstore_tool $dir $second SOMETHING remove || return 1
+    #
+    # 2) repair the PG
+    #
+    local pg=$(get_pg $poolname SOMETHING)
+    repair $pg
+    #
+    # 3) The files must be back
+    #
+    objectstore_tool $dir $first SOMETHING list-attrs || return 1
+    objectstore_tool $dir $second SOMETHING list-attrs || return 1
+    rados --pool $poolname get SOMETHING $dir/COPY || return 1
+    diff $dir/ORIGINAL $dir/COPY || return 1
+}
+
 main osd-scrub-repair "$@"
 
 # Local Variables:
 # compile-command: "cd ../.. ; make -j4 && \
-#    test/osd/osd-scrub-repair.sh # TEST_corrupt_and_repair_primary_replicated"
+#    test/osd/osd-scrub-repair.sh # TEST_corrupt_and_repair_replicated"
 # End: