From: David Zafman Date: Sat, 24 Oct 2015 23:23:13 +0000 (-0700) Subject: osd, test: Keep missing count and log number of missing clones X-Git-Tag: v10.0.0~30^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e0bb0ae9498fd9a0c49f1b81bf0c86f7a7cac42;p=ceph.git osd, test: Keep missing count and log number of missing clones Signed-off-by: David Zafman --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index e69c05a773ec..beea01683f9e 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -12116,7 +12116,8 @@ static bool doing_clones(const boost::optional &snapset, return snapset && curclone != snapset.get().clones.rend(); } -void ReplicatedPG::log_missing(const boost::optional &head, +void ReplicatedPG::log_missing(unsigned missing, + const boost::optional &head, LogChannelRef clog, const spg_t &pgid, const char *func, @@ -12126,30 +12127,30 @@ void ReplicatedPG::log_missing(const boost::optional &head, assert(head); if (allow_incomplete_clones) { dout(20) << func << " " << mode << " " << pgid << " " << head.get() - << " skipped some clones in cache tier" << dendl; + << " skipped " << missing << " clone(s) in cache tier" << dendl; } else { clog->info() << mode << " " << pgid << " " << head.get() - << " missing clones"; + << " " << missing << " missing clone(s)"; } } -void ReplicatedPG::process_clones_to(const boost::optional &head, +unsigned ReplicatedPG::process_clones_to(const boost::optional &head, const boost::optional &snapset, LogChannelRef clog, const spg_t &pgid, const char *mode, - bool &missing, bool allow_incomplete_clones, snapid_t target, vector::reverse_iterator *curclone) { assert(head); assert(snapset); + unsigned missing = 0; // NOTE: clones are in descending order, thus **curclone > target test here hobject_t next_clone(head.get()); while(doing_clones(snapset, *curclone) && **curclone > target) { - missing = true; + ++missing; // it is okay to be missing one or more clones in a cache tier. // skip higher-numbered clones in the list. if (!allow_incomplete_clones) { @@ -12161,6 +12162,7 @@ void ReplicatedPG::process_clones_to(const boost::optional &head, // Clones are descending ++(*curclone); } + return missing; } /* @@ -12294,8 +12296,8 @@ void ReplicatedPG::_scrub( // Log any clones we were expecting to be there up to target // This will set missing, but will be a no-op if snap.soid == *curclone. - process_clones_to(head, snapset, osd->clog, info.pgid, mode, - missing, pool.info.allow_incomplete_clones(), target, &curclone); + missing += process_clones_to(head, snapset, osd->clog, info.pgid, mode, + pool.info.allow_incomplete_clones(), target, &curclone); } bool expected; // Check doing_clones() again in case we ran process_clones_to() @@ -12321,7 +12323,7 @@ void ReplicatedPG::_scrub( if (soid.has_snapset()) { if (missing) { - log_missing(head, osd->clog, info.pgid, __func__, mode, + log_missing(missing, head, osd->clog, info.pgid, __func__, mode, pool.info.allow_incomplete_clones()); } @@ -12438,14 +12440,14 @@ void ReplicatedPG::_scrub( dout(10) << __func__ << " " << mode << " " << info.pgid << " No more objects while processing " << head.get() << dendl; - process_clones_to(head, snapset, osd->clog, info.pgid, mode, - missing, pool.info.allow_incomplete_clones(), all_clones, &curclone); + missing += process_clones_to(head, snapset, osd->clog, info.pgid, mode, + pool.info.allow_incomplete_clones(), all_clones, &curclone); } // There could be missing found by the test above or even // before dropping out of the loop for the last head. if (missing) { - log_missing(head, osd->clog, info.pgid, __func__, + log_missing(missing, head, osd->clog, info.pgid, __func__, mode, pool.info.allow_incomplete_clones()); } diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 14a7a30bfd10..d84769ae061e 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -1493,18 +1493,18 @@ private: hobject_t generate_temp_object(); ///< generate a new temp object name /// generate a new temp object name (for recovery) hobject_t get_temp_recovery_object(eversion_t version, snapid_t snap); - void log_missing(const boost::optional &head, + void log_missing(unsigned missing, + const boost::optional &head, LogChannelRef clog, const spg_t &pgid, const char *func, const char *mode, bool allow_incomplete_clones); - void process_clones_to(const boost::optional &head, + unsigned process_clones_to(const boost::optional &head, const boost::optional &snapset, LogChannelRef clog, const spg_t &pgid, const char *mode, - bool &missing, bool allow_incomplete_clones, snapid_t target, vector::reverse_iterator *curclone); diff --git a/src/test/osd/osd-scrub-snaps.sh b/src/test/osd/osd-scrub-snaps.sh index ce535613376d..7708f56ea449 100755 --- a/src/test/osd/osd-scrub-snaps.sh +++ b/src/test/osd/osd-scrub-snaps.sh @@ -156,7 +156,7 @@ err_strings[2]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/666934a3/ob err_strings[3]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/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 1.0 1/666934a3/obj5/head expected clone 1/666934a3/obj5/2" err_strings[5]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/666934a3/obj5/head expected clone 1/666934a3/obj5/1" -err_strings[6]="log_channel[(]cluster[)] log [[]INF[]] : scrub 1.0 1/666934a3/obj5/head missing clones" +err_strings[6]="log_channel[(]cluster[)] log [[]INF[]] : scrub 1.0 1/666934a3/obj5/head 1 missing clone[(]s[)]" err_strings[7]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/d3a9faf5/obj12/head snapset.head_exists=false, but head exists" err_strings[8]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/8df7eaa5/obj8/head snaps.seq not set" err_strings[9]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/5c889059/obj7/head snapset.head_exists=false, but head exists" @@ -167,7 +167,7 @@ err_strings[13]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/3f1ee208/o err_strings[14]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/3f1ee208/obj2/7 is an unexpected clone" err_strings[15]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/3f1ee208/obj2/4 is an unexpected clone" err_strings[16]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/a8759770/obj4/snapdir expected clone 1/a8759770/obj4/7" -err_strings[17]="log_channel[(]cluster[)] log [[]INF[]] : scrub 1.0 1/a8759770/obj4/snapdir missing clones" +err_strings[17]="log_channel[(]cluster[)] log [[]INF[]] : scrub 1.0 1/a8759770/obj4/snapdir 1 missing clone[(]s[)]" err_strings[18]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/6cf8deff/obj1/1 is an unexpected clone" err_strings[19]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/e478ac7f/obj9/1 is missing in clone_size" err_strings[20]="log_channel[(]cluster[)] log [[]ERR[]] : scrub 1.0 1/29547577/obj11/1 is an unexpected clone"