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,
}
}
- 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());
}
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();
#include "include/assert.h"
#include "include/types.h"
+#include "include/stringify.h"
#include "osd_types.h"
#include "include/buffer.h"
#include "include/xlist.h"
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),
};
TEST_F(StoreTest, Synthetic) {
- ObjectStore::Sequencer osr;
+ ObjectStore::Sequencer osr("test");
MixedGenerator gen;
gen_type rng(time(NULL));
coll_t cid("synthetic_1");
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;
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);
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();
bl);
}
}
- store->queue_transaction(&(iter->second.second), t,
+ store->queue_transaction(iter->second.second, t,
new OnApplied(&lock, &cond, &in_flight,
t));
}