]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: counnt errors fixed during repair, and indicate scrub vs repair
authorSage Weil <sage@newdream.net>
Tue, 9 Jun 2009 20:24:52 +0000 (13:24 -0700)
committerSage Weil <sage@newdream.net>
Tue, 9 Jun 2009 21:43:33 +0000 (14:43 -0700)
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 6d539a5f27f806163f94d4c3e18c6b065ffac351..e0b57d044df547d953183ef04a886b4507b692e4 100644 (file)
@@ -2089,9 +2089,9 @@ void PG::scrub()
 {
   stringstream ss;
   ScrubMap scrubmap;
-  int errors = 0;
-
+  int errors = 0, fixed = 0;
   bool repair = state_test(PG_STATE_REPAIR);
+  const char *mode = repair ? "repair":"scrub";
 
   osd->map_lock.get_read();
   lock();
@@ -2209,7 +2209,7 @@ void PG::scrub()
       if (anymissing) {
        for (unsigned i=0; i<acting.size(); i++) {
          if (p[i] == m[i]->objects.end() || po->poid != p[i]->poid) {
-           ss << info.pgid << " scrub osd" << acting[i] << " missing " << po->poid;
+           ss << info.pgid << " " << mode << " osd" << acting[i] << " missing " << po->poid;
            osd->get_logclient()->log(LOG_ERROR, ss);
            num_missing++;
            
@@ -2228,7 +2228,7 @@ void PG::scrub()
        if (po->size != p[i]->size) {
          dout(0) << "scrub osd" << acting[i] << " " << po->poid
                  << " size " << p[i]->size << " != " << po->size << dendl;
-         ss << info.pgid << " scrub osd" << acting[i] << " " << po->poid
+         ss << info.pgid << " " << mode << " osd" << acting[i] << " " << po->poid
             << " size " << p[i]->size << " != " << po->size;
          osd->get_logclient()->log(LOG_ERROR, ss);
          peerok = ok = false;
@@ -2237,7 +2237,7 @@ void PG::scrub()
        if (po->attrs.size() != p[i]->attrs.size()) {
          dout(0) << "scrub osd" << acting[i] << " " << po->poid
                  << " attr count " << p[i]->attrs.size() << " != " << po->attrs.size() << dendl;
-         ss << info.pgid << " scrub osd" << acting[i] << " " << po->poid
+         ss << info.pgid << " " << mode << " osd" << acting[i] << " " << po->poid
             << " attr count " << p[i]->attrs.size() << " != " << po->attrs.size();
          osd->get_logclient()->log(LOG_ERROR, ss);
          peerok = ok = false;
@@ -2248,7 +2248,7 @@ void PG::scrub()
            if (q->second.cmp(p[i]->attrs[q->first])) {
              dout(0) << "scrub osd" << acting[i] << " " << po->poid
                      << " attr " << q->first << " value mismatch" << dendl;
-             ss << info.pgid << " scrub osd" << acting[i] << " " << po->poid
+             ss << info.pgid << " " << mode << " osd" << acting[i] << " " << po->poid
                 << " attr " << q->first << " value mismatch";
              osd->get_logclient()->log(LOG_ERROR, ss);
              peerok = ok = false;
@@ -2257,7 +2257,7 @@ void PG::scrub()
          } else {
            dout(0) << "scrub osd" << acting[i] << " " << po->poid
                    << " attr " << q->first << " missing" << dendl;
-           ss << info.pgid << " scrub osd" << acting[i] << " " << po->poid
+           ss << info.pgid << " " << mode << " osd" << acting[i] << " " << po->poid
               << " attr " << q->first << " missing";
            osd->get_logclient()->log(LOG_ERROR, ss);
            peerok = ok = false;
@@ -2279,7 +2279,7 @@ void PG::scrub()
     
     if (num_missing || num_bad) {
       dout(0) << "scrub " << num_missing << " missing, " << num_bad << " bad objects" << dendl;
-      ss << info.pgid << " scrub " << num_missing << " missing, " << num_bad << " bad objects";
+      ss << info.pgid << " " << mode << " " << num_missing << " missing, " << num_bad << " bad objects";
       osd->get_logclient()->log(LOG_ERROR, ss);
       state_set(PG_STATE_INCONSISTENT);
       if (repair)
@@ -2303,7 +2303,7 @@ void PG::scrub()
   */
 
   // ok, do the pg-type specific scrubbing
-  errors += _scrub(scrubmap);
+  _scrub(scrubmap, errors, fixed);
 
   /*
   lock();
@@ -2313,10 +2313,12 @@ void PG::scrub()
   }
   */
 
-  ss << info.pgid << " scrub " << errors << " errors";
+  ss << info.pgid << " " << mode << " " << errors << " errors";
+  if (repair)
+    ss << ", " << fixed << " fixed";
   osd->get_logclient()->log(errors ? LOG_ERROR:LOG_INFO, ss);
 
-  if (!errors && repair)
+  if (!(errors - fixed) && repair)
     state_clear(PG_STATE_INCONSISTENT);
   state_clear(PG_STATE_REPAIR);
 
index f7e61f3ad80f8920a6cda233d863ef759ae713b5..4780f537f12e6ee829432e1d2b87d0097c330e52 100644 (file)
@@ -776,7 +776,7 @@ public:
   void repair_object(ScrubMap::object *po, int bad_peer, int ok_peer);
   void scrub();
   void build_scrub_map(ScrubMap &map);
-  virtual int _scrub(ScrubMap &map) { return 0; }
+  virtual int _scrub(ScrubMap &map, int& errors, int& fixed) { return 0; }
 
   void sub_op_scrub(class MOSDSubOp *op);
   void sub_op_scrub_reply(class MOSDSubOpReply *op);
index c72bd44298b325c68f1c6abd7c394f6595d42e88..900c336d967971a91a61145da3eca291b32262f6 100644 (file)
@@ -3108,13 +3108,13 @@ void ReplicatedPG::clean_up_local(ObjectStore::Transaction& t)
 // SCRUB
 
 
-int ReplicatedPG::_scrub(ScrubMap& scrubmap)
+int ReplicatedPG::_scrub(ScrubMap& scrubmap, int& errors, int& fixed)
 {
-  int errors = 0;
   dout(10) << "_scrub" << dendl;
 
   coll_t c = info.pgid.to_coll();
   bool repair = state_test(PG_STATE_REPAIR);
+  const char *mode = repair ? "repair":"scrub";
 
   // traverse in reverse order.
   sobject_t head;
@@ -3133,7 +3133,7 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap)
 
     // basic checks.
     if (p->attrs.count(OI_ATTR) == 0) {
-      dout(0) << "scrub no '" << OI_ATTR << "' attr on " << soid << dendl;
+      dout(0) << mode << " no '" << OI_ATTR << "' attr on " << soid << dendl;
       errors++;
       continue;
     }
@@ -3141,7 +3141,7 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap)
     bv.push_back(p->attrs[OI_ATTR]);
     object_info_t oi(bv);
 
-    dout(20) << "scrub  " << soid << " " << oi << dendl;
+    dout(20) << mode << "  " << soid << " " << oi << dendl;
 
     stat.num_bytes += p->size;
     stat.num_kb += SHIFT_ROUND_UP(p->size, 10);
@@ -3204,7 +3204,7 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap)
     }
   }  
   
-  dout(10) << "scrub got "
+  dout(10) << mode << " got "
           << stat.num_objects << "/" << info.stats.num_objects << " objects, "
           << stat.num_object_clones << "/" << info.stats.num_object_clones << " clones, "
           << stat.num_bytes << "/" << info.stats.num_bytes << " bytes, "
@@ -3216,7 +3216,7 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap)
       stat.num_object_clones != info.stats.num_object_clones ||
       stat.num_bytes != info.stats.num_bytes ||
       stat.num_kb != info.stats.num_kb) {
-    ss << info.pgid << " scrub stat mismatch, got "
+    ss << info.pgid << " " << mode << " stat mismatch, got "
        << stat.num_objects << "/" << info.stats.num_objects << " objects, "
        << stat.num_object_clones << "/" << info.stats.num_object_clones << " clones, "
        << stat.num_bytes << "/" << info.stats.num_bytes << " bytes, "
@@ -3225,11 +3225,12 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap)
     errors++;
 
     if (repair) {
+      fixed++;
       info.stats = stat;
       update_stats();
     }
   }
 
-  dout(10) << "scrub finish" << dendl;
+  dout(10) << "_scrub (" << mode << ") finish" << dendl;
   return errors;
 }
index 162c4b119cd256251a347cc4d70a5546969efbb3..1e52735b3814dbcb1975f356f841cbb5e5548122 100644 (file)
@@ -429,7 +429,7 @@ protected:
 
 
   // -- scrub --
-  int _scrub(ScrubMap& map);
+  int _scrub(ScrubMap& map, int& errors, int& fixed);
 
   void apply_and_flush_repops(bool requeue);