]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, test: Keep missing count and log number of missing clones
authorDavid Zafman <dzafman@redhat.com>
Sat, 24 Oct 2015 23:23:13 +0000 (16:23 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 30 Oct 2015 20:01:51 +0000 (13:01 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h
src/test/osd/osd-scrub-snaps.sh

index e69c05a773ecd42c24d016ef5ea3ab973b06fa80..beea01683f9e132e294104a43bbe6b6f2d054b18 100644 (file)
@@ -12116,7 +12116,8 @@ static bool doing_clones(const boost::optional<SnapSet> &snapset,
     return snapset && curclone != snapset.get().clones.rend();
 }
 
-void ReplicatedPG::log_missing(const boost::optional<hobject_t> &head,
+void ReplicatedPG::log_missing(unsigned missing,
+                       const boost::optional<hobject_t> &head,
                        LogChannelRef clog,
                        const spg_t &pgid,
                        const char *func,
@@ -12126,30 +12127,30 @@ void ReplicatedPG::log_missing(const boost::optional<hobject_t> &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<hobject_t> &head,
+unsigned ReplicatedPG::process_clones_to(const boost::optional<hobject_t> &head,
   const boost::optional<SnapSet> &snapset,
   LogChannelRef clog,
   const spg_t &pgid,
   const char *mode,
-  bool &missing,
   bool allow_incomplete_clones,
   snapid_t target,
   vector<snapid_t>::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<hobject_t> &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());
   }
 
index 14a7a30bfd10d11022947e73912b764ef9b2c8c8..d84769ae061ee7046a358bdd745795cd3113b3a5 100644 (file)
@@ -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<hobject_t> &head,
+  void log_missing(unsigned missing,
+                       const boost::optional<hobject_t> &head,
                        LogChannelRef clog,
                        const spg_t &pgid,
                        const char *func,
                        const char *mode,
                        bool allow_incomplete_clones);
-  void process_clones_to(const boost::optional<hobject_t> &head,
+  unsigned process_clones_to(const boost::optional<hobject_t> &head,
     const boost::optional<SnapSet> &snapset,
     LogChannelRef clog,
     const spg_t &pgid,
     const char *mode,
-    bool &missing,
     bool allow_incomplete_clones,
     snapid_t target,
     vector<snapid_t>::reverse_iterator *curclone);
index ce535613376d273feac4f1be93fdc354e4720ab8..7708f56ea449537076661ae163bc620fab7034e0 100755 (executable)
@@ -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"