]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore: op_start when op is _queued_, so that q is drained on commit
authorSage Weil <sage@newdream.net>
Fri, 18 Jun 2010 22:59:36 +0000 (15:59 -0700)
committerSage Weil <sage@newdream.net>
Fri, 18 Jun 2010 22:59:36 +0000 (15:59 -0700)
We need the store in a consistent state on commit, which means flushing
transactions such that we have all ops <= a given seq applied.  That is
handled by the commit_start()/commit_started() pair, but will only include
ops in the FileStore queue if we op_start when it is initially queued.
Which is exactly what we want, because the queue can reorder things, so
stopping just currently-being-applied updates will only keep transactions
atomic but not ordered.

Yup!

src/os/FileStore.cc

index 91e1c8276084b242ee922cc33fd8c61828e6fec3..46cc13b8e59a301b06e0287cee1fd1c6b547d691 100644 (file)
@@ -743,7 +743,8 @@ int FileStore::umount()
 
 /// -----------------------------
 
-void FileStore::queue_op(Sequencer *posr, uint64_t op_seq, list<Transaction*>& tls, Context *onreadable, Context *onreadable_sync)
+void FileStore::queue_op(Sequencer *posr, uint64_t op_seq, list<Transaction*>& tls,
+                        Context *onreadable, Context *onreadable_sync)
 {
   uint64_t bytes = 0, ops = 0;
   for (list<Transaction*>::iterator p = tls.begin();
@@ -757,6 +758,11 @@ void FileStore::queue_op(Sequencer *posr, uint64_t op_seq, list<Transaction*>& t
   if (next_finish == 0)
     next_finish = op_seq;
 
+  // mark apply start _now_, because we need to drain the entire apply
+  // queue during commit in order to put the store in a consistent
+  // state.
+  op_apply_start(op_seq);
+
   Op *o = new Op;
   o->op = op_seq;
   o->tls.swap(tls);
@@ -800,7 +806,6 @@ void FileStore::_do_op(OpSequencer *osr)
   Op *o = osr->q.front();
 
   dout(10) << "_do_op " << o << " " << o->op << " osr " << osr << "/" << osr->parent << " start" << dendl;
-  op_apply_start(o->op);
   int r = do_transactions(o->tls, o->op);
   op_apply_finish(o->op);
   dout(10) << "_do_op " << o << " " << o->op << " r = " << r