]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: log scrub ok
authorSage Weil <sage@newdream.net>
Fri, 5 Dec 2008 22:22:17 +0000 (14:22 -0800)
committerSage Weil <sage@newdream.net>
Fri, 5 Dec 2008 22:33:03 +0000 (14:33 -0800)
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index d0ecf6c84273d3e5cd94265de762603fc72240e8..851199d1aeb711038f0a9bbb19dbc9c90c18e2df 100644 (file)
@@ -1872,6 +1872,7 @@ void PG::scrub()
 {
   stringstream ss;
   ScrubMap scrubmap;
+  int errors = 0;
 
   osd->map_lock.get_read();
   lock();
@@ -2061,7 +2062,7 @@ void PG::scrub()
   */
 
   // ok, do the pg-type specific scrubbing
-  _scrub(scrubmap);
+  errors += _scrub(scrubmap);
 
   /*
   lock();
@@ -2071,6 +2072,10 @@ void PG::scrub()
   }
   */
 
+  ss << info.pgid << " scrub " << errors << " errors";
+  osd->get_logclient()->log(errors ? LOG_ERROR:LOG_INFO, ss);
+
+
   // finish up
   info.stats.last_scrub = info.last_update;
   info.stats.last_scrub_stamp = g_clock.now();
index 11a96ce8ee0872ae741b4207e53a843c3575998a..7022751e1cab842b725fa00abc2a79e2f27c81b4 100644 (file)
@@ -725,7 +725,7 @@ public:
 
   void scrub();
   void build_scrub_map(ScrubMap &map);
-  virtual void _scrub(ScrubMap &map) {}
+  virtual int _scrub(ScrubMap &map) { return 0; }
 
   void sub_op_scrub(class MOSDSubOp *op);
   void sub_op_scrub_reply(class MOSDSubOpReply *op);
index 45d62ac17517129a620d30252910c4117fcc0762..b3df47d4153cf8fdaf1554b8f21f69a0629b5a29 100644 (file)
@@ -2909,8 +2909,9 @@ void ReplicatedPG::clean_up_local(ObjectStore::Transaction& t)
 // SCRUB
 
 
-void ReplicatedPG::_scrub(ScrubMap& scrubmap)
+int ReplicatedPG::_scrub(ScrubMap& scrubmap)
 {
+  int errors = 0;
   dout(10) << "_scrub" << dendl;
 
   coll_t c = info.pgid.to_coll();
@@ -2934,6 +2935,7 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap)
     eversion_t v;
     if (p->attrs.count("version") == 0) {
       dout(0) << "scrub no 'version' attr on " << poid << dendl;
+      errors++;
       continue;
     }
     p->attrs["version"].copy_out(0, sizeof(v), (char *)&v);
@@ -2951,11 +2953,13 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap)
       if (head != pobject_t()) {
        derr(0) << " missing clone(s) for " << head << dendl;
        assert(head == pobject_t());  // we had better be done
+       errors++;
       }
 
       bufferlist bl;
       if (p->attrs.count("snapset") == 0) {
        dout(0) << "no 'snapset' attr on " << p->poid << dendl;
+       errors++;
        continue;
       }
       bl.push_back(p->attrs["snapset"]);
@@ -2993,6 +2997,7 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap)
       bufferlist bl;
       if (p->attrs.count("snaps") == 0) {
        dout(0) << "no 'snaps' attr on " << p->poid << dendl;
+       errors++;
        continue;
       }
       bl.push_back(p->attrs["snaps"]);
@@ -3003,6 +3008,7 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap)
       eversion_t from;
       if (p->attrs.count("from_version") == 0) {
        dout(0) << "no 'from_version' attr on " << p->poid << dendl;
+       errors++;
        continue;
       }
       p->attrs["from_version"].copy_out(0, sizeof(from), (char *)&from);
@@ -3040,11 +3046,9 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap)
        << stat.num_bytes << "/" << info.stats.num_bytes << " bytes, "
        << stat.num_kb << "/" << info.stats.num_kb << " kb.";
     osd->get_logclient()->log(LOG_ERROR, ss);
-  } else {
-    stringstream ss;
-    ss << info.pgid << " scrub ok";
-    //osd->get_logclient()->log(LOG_DEBUG, ss);
+    errors++;
   }
 
   dout(10) << "scrub finish" << dendl;
+  return errors;
 }
index f5e808a5f96aab7fcd3ea892b242c7a9096604d2..a1ff6bc9490b2701f28601c333d3f134e867eb2c 100644 (file)
@@ -222,7 +222,7 @@ protected:
 
 
   // -- scrub --
-  void _scrub(ScrubMap& map);
+  int _scrub(ScrubMap& map);