From: Loic Dachary Date: Sun, 19 Oct 2014 16:41:41 +0000 (-0700) Subject: osd: log when scrub,deep scrub, repair starts X-Git-Tag: v0.90~57^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f76a676b4917a9ff163b618c5fc47e202844b960;p=ceph.git osd: log when scrub,deep scrub, repair starts So it can be matched, in the logs, with the log messages announcing it is complete. http://tracker.ceph.com/issues/9817 Fixes: #9817 Signed-off-by: Loic Dachary --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 7ef000ee1b1a..d043fb1d207f 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3838,6 +3838,14 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) scrubber.start = hobject_t(); scrubber.state = PG::Scrubber::NEW_CHUNK; + { + bool repair = state_test(PG_STATE_REPAIR); + bool deep_scrub = state_test(PG_STATE_DEEP_SCRUB); + const char *mode = (repair ? "repair": (deep_scrub ? "deep-scrub" : "scrub")); + stringstream oss; + oss << info.pgid.pgid << " " << mode << " starts" << std::endl; + osd->clog->info(oss); + } break; case PG::Scrubber::NEW_CHUNK: diff --git a/src/test/osd/osd-scrub-repair.sh b/src/test/osd/osd-scrub-repair.sh index 0c805b0b69e3..324d6874f865 100755 --- a/src/test/osd/osd-scrub-repair.sh +++ b/src/test/osd/osd-scrub-repair.sh @@ -40,6 +40,34 @@ function run() { teardown $dir || return 1 } +function wait_for_repair() { + local dir=$1 + local primary=$2 + local pg=$3 + local -i tries=0 + while [ $tries -lt 100 ] ; do + CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.$primary.asok log flush || return 1 + if grep --quiet "$pg repair ok" $dir/osd-$primary.log ; then + return 0 + fi + let tries++ + sleep 1 + done + grep --quiet "$pg repair ok" $dir/osd-$primary.log || return 1 +} + +function TEST_log_repair() { + local dir=$1 + local poolname=rbd + local pg=$(get_pg $poolname SOMETHING) + local -a osds=($(get_osds $poolname SOMETHING)) + local primary=${osds[$first]} + + ./ceph pg repair $pg + wait_for_repair $dir $primary $pg + grep --quiet "$pg repair starts" $dir/osd-$primary.log || return 1 +} + # # 1) add an object # 2) remove the corresponding file from the primary OSD