Skip to content

Commit

Permalink
Merge pull request ceph#6673 from dzafman/wip-rand-scrub-fix
Browse files Browse the repository at this point in the history
Reviewed-by: Loic Dachary <[email protected]>
  • Loading branch information
dzafman committed Nov 23, 2015
2 parents 90a37c7 + f74e310 commit ba5f45a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
5 changes: 4 additions & 1 deletion src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3246,7 +3246,10 @@ bool PG::sched_scrub()
bool time_for_deep = (ceph_clock_now(cct) >=
info.history.last_deep_scrub_stamp + cct->_conf->osd_deep_scrub_interval);

bool deep_coin_flip = (rand() % 100) < cct->_conf->osd_deep_scrub_randomize_ratio * 100;
bool deep_coin_flip = false;
// Only add random deep scrubs when NOT user initiated scrub
if (!scrubber.must_scrub)
deep_coin_flip = (rand() % 100) < cct->_conf->osd_deep_scrub_randomize_ratio * 100;
dout(20) << __func__ << ": time_for_deep=" << time_for_deep << " deep_coin_flip=" << deep_coin_flip << dendl;

time_for_deep = (time_for_deep || deep_coin_flip);
Expand Down
48 changes: 24 additions & 24 deletions src/test/osd/osd-scrub-snaps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,33 +175,33 @@ function TEST_scrub_snaps() {
kill_daemons $dir || return 1

declare -a err_strings
err_strings[0]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/2acecc8b/obj10/1 is missing in clone_overlap"
err_strings[1]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/666934a3/obj5/7 no '_' attr"
err_strings[2]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/666934a3/obj5/7 is an unexpected clone"
err_strings[3]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/666934a3/obj5/4 on disk size [(]4608[)] does not match object info size [(]512[)] adjusted for ondisk to [(]512[)]"
err_strings[4]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/666934a3/obj5/head expected clone [0-9]*/666934a3/obj5/2"
err_strings[5]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/666934a3/obj5/head expected clone [0-9]*/666934a3/obj5/1"
err_strings[6]="log_channel[(]cluster[)] log [[]INF[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/666934a3/obj5/head 2 missing clone[(]s[)]"
err_strings[7]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/d3a9faf5/obj12/head snapset.head_exists=false, but head exists"
err_strings[8]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/8df7eaa5/obj8/head snaps.seq not set"
err_strings[9]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/5c889059/obj7/head snapset.head_exists=false, but head exists"
err_strings[10]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/5c889059/obj7/1 is an unexpected clone"
err_strings[11]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/61f68bb1/obj3/head on disk size [(]3840[)] does not match object info size [(]768[)] adjusted for ondisk to [(]768[)]"
err_strings[12]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/83425cc4/obj6/1 is an unexpected clone"
err_strings[13]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/3f1ee208/obj2/snapdir no 'snapset' attr"
err_strings[14]="log_channel[(]cluster[)] log [[]INF[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/3f1ee208/obj2/7 clone ignored due to missing snapset"
err_strings[15]="log_channel[(]cluster[)] log [[]INF[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/3f1ee208/obj2/4 clone ignored due to missing snapset"
err_strings[16]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/a8759770/obj4/snapdir expected clone [0-9]*/a8759770/obj4/7"
err_strings[17]="log_channel[(]cluster[)] log [[]INF[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/a8759770/obj4/snapdir 1 missing clone[(]s[)]"
err_strings[18]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/6cf8deff/obj1/1 is an unexpected clone"
err_strings[19]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/e478ac7f/obj9/1 is missing in clone_size"
err_strings[20]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/29547577/obj11/1 is an unexpected clone"
err_strings[21]="log_channel[(]cluster[)] log [[]ERR[]] : (deep-scrub|scrub) [0-9]*[.]0 [0-9]*/94122507/obj14/1 size 1032 != clone_size 1033"
err_strings[22]="log_channel[(]cluster[)] log [[]ERR[]] : [0-9]*[.]0 (deep-scrub|scrub) 19 errors"
err_strings[0]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/2acecc8b/obj10/1 is missing in clone_overlap"
err_strings[1]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/666934a3/obj5/7 no '_' attr"
err_strings[2]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/666934a3/obj5/7 is an unexpected clone"
err_strings[3]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/666934a3/obj5/4 on disk size [(]4608[)] does not match object info size [(]512[)] adjusted for ondisk to [(]512[)]"
err_strings[4]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/666934a3/obj5/head expected clone [0-9]*/666934a3/obj5/2"
err_strings[5]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/666934a3/obj5/head expected clone [0-9]*/666934a3/obj5/1"
err_strings[6]="log_channel[(]cluster[)] log [[]INF[]] : scrub [0-9]*[.]0 [0-9]*/666934a3/obj5/head 2 missing clone[(]s[)]"
err_strings[7]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/d3a9faf5/obj12/head snapset.head_exists=false, but head exists"
err_strings[8]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/8df7eaa5/obj8/head snaps.seq not set"
err_strings[9]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/5c889059/obj7/head snapset.head_exists=false, but head exists"
err_strings[10]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/5c889059/obj7/1 is an unexpected clone"
err_strings[11]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/61f68bb1/obj3/head on disk size [(]3840[)] does not match object info size [(]768[)] adjusted for ondisk to [(]768[)]"
err_strings[12]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/83425cc4/obj6/1 is an unexpected clone"
err_strings[13]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/3f1ee208/obj2/snapdir no 'snapset' attr"
err_strings[14]="log_channel[(]cluster[)] log [[]INF[]] : scrub [0-9]*[.]0 [0-9]*/3f1ee208/obj2/7 clone ignored due to missing snapset"
err_strings[15]="log_channel[(]cluster[)] log [[]INF[]] : scrub [0-9]*[.]0 [0-9]*/3f1ee208/obj2/4 clone ignored due to missing snapset"
err_strings[16]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/a8759770/obj4/snapdir expected clone [0-9]*/a8759770/obj4/7"
err_strings[17]="log_channel[(]cluster[)] log [[]INF[]] : scrub [0-9]*[.]0 [0-9]*/a8759770/obj4/snapdir 1 missing clone[(]s[)]"
err_strings[18]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/6cf8deff/obj1/1 is an unexpected clone"
err_strings[19]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/e478ac7f/obj9/1 is missing in clone_size"
err_strings[20]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/29547577/obj11/1 is an unexpected clone"
err_strings[21]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 [0-9]*/94122507/obj14/1 size 1032 != clone_size 1033"
err_strings[22]="log_channel[(]cluster[)] log [[]ERR[]] : [0-9]*[.]0 scrub 19 errors"

for i in `seq 0 ${#err_strings[@]}`
do
if ! grep -E "${err_strings[$i]}" $dir/osd.0.log > /dev/null;
if ! grep "${err_strings[$i]}" $dir/osd.0.log > /dev/null;
then
echo "Missing log message '${err_strings[$i]}'"
ERRORS=$(expr $ERRORS + 1)
Expand Down

0 comments on commit ba5f45a

Please sign in to comment.