mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
crimson/os/alienstore: improve alienstore's write parallelism
replace the grand per store tp_mutex with a finer grained per-collection lock for better concurrency Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
This commit is contained in:
parent
731c20fe49
commit
14d046fd66
@ -19,8 +19,14 @@ public:
|
||||
|
||||
~AlienCollection() {}
|
||||
|
||||
template <typename Func, typename Result = std::invoke_result_t<Func>>
|
||||
seastar::futurize_t<Result> with_lock(Func&& func) {
|
||||
return seastar::with_lock(mutex, std::forward<Func>(func));
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectStore::CollectionHandle collection;
|
||||
seastar::shared_mutex mutex;
|
||||
friend AlienStore;
|
||||
};
|
||||
}
|
||||
|
@ -363,7 +363,8 @@ seastar::future<> AlienStore::do_transaction(CollectionRef ch,
|
||||
std::move(done),
|
||||
[this, ch, id] (auto &txn, auto &done) {
|
||||
return seastar::with_gate(transaction_gate, [this, ch, id, &txn, &done] {
|
||||
return tp_mutex.lock().then ([this, ch, id, &txn, &done] {
|
||||
AlienCollection* alien_coll = static_cast<AlienCollection*>(ch.get());
|
||||
return alien_coll->with_lock([this, ch, id, &txn, &done] {
|
||||
Context *crimson_wrapper =
|
||||
ceph::os::Transaction::collect_all_contexts(txn);
|
||||
return tp->submit([this, ch, id, crimson_wrapper, &txn, &done] {
|
||||
@ -373,7 +374,6 @@ seastar::future<> AlienStore::do_transaction(CollectionRef ch,
|
||||
});
|
||||
}).then([this, &done] (int r) {
|
||||
assert(r == 0);
|
||||
tp_mutex.unlock();
|
||||
return done.get_future();
|
||||
});
|
||||
});
|
||||
|
@ -120,6 +120,5 @@ private:
|
||||
std::unique_ptr<CephContext> cct;
|
||||
seastar::gate transaction_gate;
|
||||
std::unordered_map<coll_t, CollectionRef> coll_map;
|
||||
seastar::shared_mutex tp_mutex;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user