]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: track last_complete_ondisk over pushes, too.
authorSage Weil <sage@newdream.net>
Thu, 18 Jun 2009 18:19:47 +0000 (11:19 -0700)
committerSage Weil <sage@newdream.net>
Thu, 18 Jun 2009 18:19:47 +0000 (11:19 -0700)
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 6017008e8e915c0a010a7bca92a4db8690147e8e..9cfb7ed6905a084e43d84224f9bcb877ca7532c6 100644 (file)
@@ -995,6 +995,9 @@ inline ostream& operator<<(ostream& out, const PG& pg)
     }
   }
 
+  if (pg.last_complete_ondisk != pg.info.last_complete)
+    out << " lcod " << pg.last_complete_ondisk;
+
   if (pg.get_role() == 0) {
     out << " mlcod " << pg.min_last_complete_ondisk;
     if (!pg.have_master_log)
index cd1892884229305b7cc4f119166ac9e01d8f4fe1..a71bf2b9fbf6d84a5a67b50a59dc666b18a0b613 100644 (file)
@@ -2547,6 +2547,31 @@ void ReplicatedPG::sub_op_pull(MOSDSubOp *op)
 }
 
 
+struct C_OSD_Commit : public Context {
+  ReplicatedPG *pg;
+  epoch_t same_since;
+  eversion_t last_complete;
+  C_OSD_Commit(ReplicatedPG *p, epoch_t ss, eversion_t lc) : pg(p), same_since(ss), last_complete(lc) {
+    pg->get();
+  }
+  void finish(int r) {
+    pg->lock();
+    pg->_committed(same_since, last_complete);
+    pg->unlock();
+    pg->put();
+  }
+};
+
+void ReplicatedPG::_committed(epoch_t same_since, eversion_t last_complete)
+{
+  if (same_since == info.history.same_since) {
+    dout(10) << "_committed last_complete " << last_complete << " now ondisk" << dendl;
+    last_complete_ondisk = last_complete;
+  } else {
+    dout(10) << "_committed pg has changed, not touching last_complete_ondisk" << dendl;
+  }
+}
+
 /** op_push
  * NOTE: called from opqueue.
  */
@@ -2699,7 +2724,8 @@ void ReplicatedPG::sub_op_push(MOSDSubOp *op)
 
   // apply to disk!
   write_info(t);
-  unsigned r = osd->store->apply_transaction(t);
+  unsigned r = osd->store->apply_transaction(t, new C_OSD_Commit(this, info.history.same_since,
+                                                                info.last_complete));
   assert(r == 0);
 
   osd->logger->inc(l_osd_r_pull);
index 5b3eaba82293b328ebceb65efc05e1d3d78868c1..8c0df019e8f89e88c39e8b51113d5589287109a9 100644 (file)
@@ -428,6 +428,10 @@ protected:
   void sub_op_push_reply(MOSDSubOpReply *reply);
   void sub_op_pull(MOSDSubOp *op);
 
+  void _committed(epoch_t same_since, eversion_t lc);
+  friend class C_OSD_Commit;
+  
+
 
   // -- scrub --
   int _scrub(ScrubMap& map, int& errors, int& fixed);