]> 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>
Thu, 25 Feb 2016 20:50:26 +0000 (12:50 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 2e0bb0ae9498fd9a0c49f1b81bf0c86f7a7cac42)

Conflicts:
src/osd/ReplicatedPG.h (trivial)

src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h
src/test/osd/osd-scrub-snaps.sh

index 6b8fcfc9a7a36ea4d3499651fb01d87c23f96a44..e89db3239fa8e94be8fa0f3f74b2887b31580962 100644 (file)
@@ -11247,7 +11247,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,
@@ -11257,30 +11258,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) {
@@ -11292,6 +11293,7 @@ void ReplicatedPG::process_clones_to(const boost::optional<hobject_t> &head,
     // Clones are descending
     ++(*curclone);
   }
+  return missing;
 }
 
 /*
@@ -11423,8 +11425,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()
@@ -11450,7 +11452,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());
       }
 
@@ -11567,14 +11569,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 d4a7ea690e407b5b6dadfef2bac2b6170fdf4681..d2dc3049950751f234bfc7631a251026b9d2bca0 100644 (file)
@@ -1421,18 +1421,18 @@ private:
   uint64_t temp_seq; ///< last id for naming temp objects
   coll_t get_temp_coll(ObjectStore::Transaction *t);
   hobject_t generate_temp_object();  ///< generate a new temp object name
-  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"