]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: log broken pg state to monitor on startup, activate
authorSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 15:33:07 +0000 (08:33 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 15:33:07 +0000 (08:33 -0700)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/PG.cc
src/osd/PG.h

index 8d856b8730ab2de068130384b6e3a8033299fd28..4ad75efcccd2167ede8a06feb7a2ed6d46fe4dac 100644 (file)
@@ -1574,6 +1574,8 @@ void PG::activate(ObjectStore::Transaction& t, list<Context*>& tfin,
     }
   }
 
+  log_weirdness();
+
   // if primary..
   if (is_primary()) {
     // start up replicas
@@ -2442,6 +2444,49 @@ void PG::read_state(ObjectStore *store)
     write_info(t);
     store->apply_transaction(t);
   }
+
+  // log any weirdness
+  log_weirdness();
+}
+
+void PG::log_weirdness()
+{
+  if (log.tail != info.log_tail)
+    osd->clog.error() << info.pgid
+                     << " info mismatch, log.tail " << log.tail
+                     << " != info.log_tail " << info.log_tail
+                     << " on osd" << osd->whoami << "\n";
+  if (log.head != info.last_update)
+    osd->clog.error() << info.pgid
+                     << " info mismatch, log.head " << log.head
+                     << " != info.last_update " << info.last_update
+                     << " on osd" << osd->whoami << "\n";
+
+  if (log.log.empty()) {
+    // shoudl it be?
+    if (log.head != log.tail)
+      osd->clog.error() << info.pgid
+                       << " log bound mismatch, empty but (" << log.tail 
+                       << "," << log.head << "]"
+                       << " on osd" << osd->whoami << "\n";
+  } else {
+    if (((log.log.begin()->version.version <= log.tail.version) &&  // sloppy check
+         !log.backlog) ||
+        (log.log.rbegin()->version != log.head))
+      osd->clog.error() << info.pgid
+                       << " log bound mismatch, info (" << log.tail 
+                       << "," << log.head << "] actual ["
+                       << log.log.begin()->version << ","
+                       << log.log.rbegin()->version << "]"
+                       << " on osd" << osd->whoami << "\n";
+  }
+  
+  if (info.last_complete < log.tail && !log.backlog)
+    osd->clog.error() << info.pgid
+                     << " last_complete " << info.last_complete
+                     << " < log.tail " << log.tail
+                     << " and !backlog"
+                     << " on osd" << osd->whoami << "\n";
 }
 
 coll_t PG::make_snap_collection(ObjectStore::Transaction& t, snapid_t s)
index 1045519c1a3bb91e307fa3cbe12ab713f8a95dcc..157ebf78a97f57dcb112e5a99b2e0e3fe7c79e48 100644 (file)
@@ -1555,6 +1555,8 @@ public:
   coll_t make_snap_collection(ObjectStore::Transaction& t, snapid_t sn);
   void adjust_local_snaps(ObjectStore::Transaction &t, interval_set<snapid_t> &to_check);
 
+  void log_weirdness();
+
   void queue_snap_trim();
   bool queue_scrub();