]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: generate backlog if needed to get last_complete >= log.tail || backlog
authorSage Weil <sage@newdream.net>
Fri, 24 Dec 2010 16:36:05 +0000 (08:36 -0800)
committerSage Weil <sage@newdream.net>
Tue, 4 Jan 2011 05:24:49 +0000 (21:24 -0800)
If primary or a replica has a mistrimmed pg log, we need to generate the
backlog during peering.  This sucks, because the PG won't go active for
a long time, but it's what happens when there's a bug in the code that
mis-trims the PG log!

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/PG.cc

index 183974230d1cbe76fb3ac8fd1b9584494ac03649..ef639c45a60a0dac0eae0ebbf0d8be126bd2c841 100644 (file)
@@ -1566,6 +1566,26 @@ void PG::do_peer(ObjectStore::Transaction& t, list<Context*>& tfin,
     return;
   }
 
+  // do i need a backlog due to mis-trimmed log?
+  if (info.last_complete < log.tail && !log.backlog) {
+    dout(10) << "must generate backlog because my last_complete " << info.last_complete
+            << " < log.tail " << log.tail << " and no backlog" << dendl;
+    osd->queue_generate_backlog(this);
+    return;
+  }
+  for (unsigned i=0; i<acting.size(); i++) {
+    int o = acting[i];
+    Info& pi = peer_info[o];
+    if (pi.last_complete < pi.log_tail && !pi.log_backlog &&
+       pi.last_complete < log.tail && !log.backlog) {
+      dout(10) << "must generate backlog for replica peer osd" << o
+              << " who has a last_complete " << pi.last_complete
+              << " < their log.tail " << pi.log_tail << " and no backlog" << dendl;
+      osd->queue_generate_backlog(this);
+      return;
+    }
+  }
+
   // do i need a backlog for an up peer excluded from acting?
   bool need_backlog = false;
   for (unsigned i=0; i<up.size(); i++) {
@@ -1582,10 +1602,6 @@ void PG::do_peer(ObjectStore::Transaction& t, list<Context*>& tfin,
   if (need_backlog)
     osd->queue_generate_backlog(this);
 
-  // do we need to wait for our backlog?
-  if (info.last_complete < log.tail && !log.backlog)
-    return;
-
 
   /** COLLECT MISSING+LOG FROM PEERS **********/
   /*