]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
objectstore: name Sequencers
authorSage Weil <sage.weil@dreamhost.com>
Sun, 4 Mar 2012 05:07:05 +0000 (21:07 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 30 Mar 2012 21:23:25 +0000 (14:23 -0700)
Assign a (unique) name to each Sequencer.  This will aid in debugging, and
can be useful when dumping traces of FileStore workloads.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/os/FileStore.cc
src/os/FileStore.h
src/os/ObjectStore.h
src/osd/PG.h
src/test/store_test.cc
src/test/xattr_bench.cc

index 6a93107efccdf5687a242a7d885e0b67427dea09..d6d83eba1d505348fb9b82d418f436ac712a63c0 100644 (file)
@@ -660,6 +660,7 @@ FileStore::FileStore(const std::string &base, const std::string &jdev) :
   sync_entry_timeo_lock("sync_entry_timeo_lock"),
   timer(g_ceph_context, sync_entry_timeo_lock),
   stop(false), sync_thread(this),
+  default_osr("default"),
   op_queue_len(0), op_queue_bytes(0), op_finisher(g_ceph_context), next_finish(0),
   op_tp(g_ceph_context, "FileStore::op_tp", g_conf->filestore_op_threads),
   op_wq(this, g_conf->filestore_op_thread_timeout,
index 28f0366cd987a341dd78307cc492bf153ee78911..5bcd37b0130739df5281efc68059e2ff7c249c44 100644 (file)
@@ -173,8 +173,9 @@ class FileStore : public JournalingObjectStore,
       }
     }
 
-    OpSequencer() : qlock("FileStore::OpSequencer::qlock", false, false),
-                   apply_lock("FileStore::OpSequencer::apply_lock", false, false) {}
+    OpSequencer()
+      : qlock("FileStore::OpSequencer::qlock", false, false),
+       apply_lock("FileStore::OpSequencer::apply_lock", false, false) {}
     ~OpSequencer() {
       assert(q.empty());
     }
index e6f46f3d4f4fca9e26931b4424be6d8716b109c1..43c6d08c64ae87e3b3e673eb66008ac1854e9ec7 100644 (file)
@@ -80,16 +80,32 @@ public:
 
   Logger *logger;
 
+  /**
+   * a sequencer orders transactions
+   *
+   * Any transactions queued under a given sequencer will be applied in
+   * sequence.  Transactions queued under different sequencers may run
+   * in parallel.
+   */
   struct Sequencer_impl {
     virtual void flush() = 0;
     virtual ~Sequencer_impl() {}
   };
   struct Sequencer {
+    string name;
     Sequencer_impl *p;
-    Sequencer() : p(NULL) {}
+
+    Sequencer(string n)
+      : name(n), p(NULL) {}
     ~Sequencer() {
       delete p;
     }
+
+    /// return a unique string identifier for this sequencer
+    const string& get_name() {
+      return name;
+    }
+    /// wait for any queued transactions on this sequencer to apply
     void flush() {
       if (p)
        p->flush();
index c1d6d3df5637d7f665bc933d96cad443e5e4b281..521d44dbc899b8eec7aca24429d0a5f91db0d134 100644 (file)
@@ -26,6 +26,7 @@
 #include "include/assert.h" 
 
 #include "include/types.h"
+#include "include/stringify.h"
 #include "osd_types.h"
 #include "include/buffer.h"
 #include "include/xlist.h"
@@ -1285,6 +1286,7 @@ public:
     backfill_target(-1),
     pg_stats_lock("PG::pg_stats_lock"),
     pg_stats_valid(false),
+    osr(stringify(p)),
     finish_sync_event(NULL),
     finalizing_scrub(false),
     scrub_reserved(false), scrub_reserve_failed(false),
index d884e4c944ce31fb13e33a414fd004f35ee49bca..3bf93f3157121bbe15eac59df30027eb057af83b 100644 (file)
@@ -436,7 +436,7 @@ public:
 };
 
 TEST_F(StoreTest, Synthetic) {
-  ObjectStore::Sequencer osr;
+  ObjectStore::Sequencer osr("test");
   MixedGenerator gen;
   gen_type rng(time(NULL));
   coll_t cid("synthetic_1");
index 0cad8ae9af8a727b6bbf3cce9ece76455d8920d9..3a4b4236dad7b3c8b74cb317e5edcb744bd77c43 100644 (file)
@@ -92,7 +92,7 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs,
   Cond cond;
   int in_flight = 0;
   ObjectStore::Transaction t;
-  map<string, pair<set<string>, ObjectStore::Sequencer> > collections;
+  map<string, pair<set<string>, ObjectStore::Sequencer*> > collections;
   for (int i = 0; i < 3*THREADS; ++i) {
     stringstream coll_str;
     coll_str << "coll_" << i << "_" << run;
@@ -105,7 +105,7 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs,
              hobject_t(sobject_t(obj_str.str(), CEPH_NOSNAP)));
       objects.insert(obj_str.str());
     }
-    collections[coll_str.str()] = make_pair(objects, ObjectStore::Sequencer());
+    collections[coll_str.str()] = make_pair(objects, new ObjectStore::Sequencer(coll_str.str()));
   }
   store->apply_transaction(t);
 
@@ -122,7 +122,7 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs,
        cond.Wait(lock);
     }
     ObjectStore::Transaction *t = new ObjectStore::Transaction;
-    map<string, pair<set<string>, ObjectStore::Sequencer> >::iterator iter =
+    map<string, pair<set<string>, ObjectStore::Sequencer*> >::iterator iter =
       rand_choose(collections);
     for (set<string>::iterator obj = iter->second.first.begin();
         obj != iter->second.first.end();
@@ -136,7 +136,7 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs,
                   bl);
       }
     }
-    store->queue_transaction(&(iter->second.second), t,
+    store->queue_transaction(iter->second.second, t,
                             new OnApplied(&lock, &cond, &in_flight,
                                           t));
   }