]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, test: osd-scrub-snap.sh add corruption of snapset
authorDavid Zafman <dzafman@redhat.com>
Wed, 24 Aug 2016 17:21:38 +0000 (10:21 -0700)
committerDavid Zafman <dzafman@redhat.com>
Mon, 10 Oct 2016 18:22:54 +0000 (11:22 -0700)
Don't also set ss_attr_missing when corruption found

Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/ReplicatedPG.cc
src/test/osd/osd-scrub-snaps.sh

index 6068e8e7a4e66b38cffbe36dd99ce8895dc0abc5..fdf206047db7851012f5d644d51cd7d2360d5e66 100644 (file)
@@ -12956,7 +12956,6 @@ void ReplicatedPG::scrub_snapshot_metadata(
                << " can't decode '" << SS_ATTR << "' attr " << e.what();
          ++scrubber.shallow_errors;
          head_error.set_ss_attr_corrupted();
-         head_error.set_ss_attr_missing(); // Not available too
         }
       }
 
index aeabedba7da13f593ea873f21308cbb255d78ef7..fd8b27d52902f448e2185c418830fc91f082249b 100755 (executable)
@@ -49,7 +49,7 @@ function TEST_scrub_snaps() {
     poolid=$(ceph osd dump | grep "^pool.*[']test[']" | awk '{ print $2 }')
 
     dd if=/dev/urandom of=$TESTDATA bs=1032 count=1
-    for i in `seq 1 14`
+    for i in `seq 1 15`
     do
         rados -p $poolname put obj${i} $TESTDATA
     done
@@ -147,6 +147,11 @@ function TEST_scrub_snaps() {
     JSON="$(ceph-objectstore-tool --data-path $dir/0 --journal-path $dir/0/journal --head --op list obj14)"
     ceph-objectstore-tool --data-path $dir/0 --journal-path $dir/0/journal "$JSON" clear-snapset size
 
+    echo "garbage" > $dir/bad
+    JSON="$(ceph-objectstore-tool --data-path $dir/0 --journal-path $dir/0/journal --head --op list obj15)"
+    ceph-objectstore-tool --data-path $dir/0 --journal-path $dir/0/journal "$JSON" set-attr snapset $dir/bad
+    rm -f $dir/bad
+
     run_osd $dir 0 || return 1
     wait_for_clean || return 1
 
@@ -164,7 +169,7 @@ function TEST_scrub_snaps() {
     test $(jq -r '.[0]' $dir/json) = $pgid || return 1
 
     rados list-inconsistent-snapset $pgid > $dir/json || return 1
-    test $(jq '.inconsistents | length' $dir/json) = "20" || return 1
+    test $(jq '.inconsistents | length' $dir/json) = "21" || return 1
 
     local jqfilter='.inconsistents'
     local sortkeys='import json; import sys ; JSON=sys.stdin.read() ; ud = json.loads(JSON) ; print json.dumps(ud, sort_keys=True, indent=2)'
@@ -293,6 +298,15 @@ function TEST_scrub_snaps() {
       "nspace": "",
       "name": "obj12"
     },
+    {
+      "errors": [
+        "ss_attr_corrupted"
+      ],
+      "snap": "head",
+      "locator": "",
+      "nspace": "",
+      "name": "obj15"
+    },
     {
       "errors": [
         "size_mismatch"
@@ -428,7 +442,8 @@ EOF
     err_strings[19]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj9:1 is missing in clone_size"
     err_strings[20]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj11:1 is an unexpected clone"
     err_strings[21]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj14:1 size 1032 != clone_size 1033"
-    err_strings[22]="log_channel[(]cluster[)] log [[]ERR[]] : [0-9]*[.]0 scrub 21 errors"
+    err_strings[22]="log_channel[(]cluster[)] log [[]ERR[]] : [0-9]*[.]0 scrub 22 errors"
+    err_strings[23]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj15:head can't decode 'snapset' attr buffer"
 
     for i in `seq 0 ${#err_strings[@]}`
     do