// we can easily optimize this dynalloc out as all concretes are
// supposed to have exactly the same size.
std::unique_ptr<OperationProxy> op;
- seastar::shared_mutex *collection_ordering_lock = nullptr;
-
- seastar::lowres_clock::time_point lock_acquire_time{};
- seastar::lowres_clock::duration lock_hold_time{0};
// in the future we might add further constructors / template to type
// erasure while extracting the location of tracking events.
OrderingHandle(std::unique_ptr<OperationProxy> op) : op(std::move(op)) {}
OrderingHandle(OrderingHandle &&other)
- : op(std::move(other.op)),
- collection_ordering_lock(other.collection_ordering_lock),
- lock_acquire_time(other.lock_acquire_time),
- lock_hold_time(other.lock_hold_time) {
- other.collection_ordering_lock = nullptr;
- }
-
- seastar::future<> take_collection_lock(seastar::shared_mutex &mutex) {
- ceph_assert(!collection_ordering_lock);
- collection_ordering_lock = &mutex;
- return collection_ordering_lock->lock();
- }
-
- void set_lock_acquire_time(seastar::lowres_clock::time_point tp) {
- lock_acquire_time = tp;
- }
-
- seastar::lowres_clock::duration get_lock_hold_time() const {
- return lock_hold_time;
- }
-
- void maybe_release_collection_lock() {
- if (collection_ordering_lock) {
- if (lock_acquire_time != seastar::lowres_clock::time_point{}) {
- lock_hold_time = seastar::lowres_clock::now() - lock_acquire_time;
- }
- collection_ordering_lock->unlock();
- collection_ordering_lock = nullptr;
- }
- }
+ : op(std::move(other.op)) {}
template <typename T>
seastar::future<> enter(T &t) {
seastar::future<> complete() {
return op->complete();
}
-
- ~OrderingHandle() {
- maybe_release_collection_lock();
- }
};
inline OrderingHandle get_dummy_ordering_handle() {
);
std::pair<txn_stage_t, sm::label_instance> labels_by_stage[] = {
- {txn_stage_t::COLLOCK_WAIT, sm::label_instance("stage", "collock_wait")},
- {txn_stage_t::COLLOCK_HOLD, sm::label_instance("stage", "collock_hold")},
{txn_stage_t::THROTTLER_WAIT, sm::label_instance("stage", "throttler_wait")},
{txn_stage_t::BUILD, sm::label_instance("stage", "build")},
{txn_stage_t::BUILD_GET_ONODE, sm::label_instance("stage", "build_get_onode")},
calc_conflicts(io_total.read_num, io_total.repeat_read_num),
calc_conflicts(io_total.get_bg_num(), io_total.get_repeat_bg_num()));
INFO("trans outstanding: {},{},{},{} "
- "per-shard: {:.2f}({:.2f},{:.2f},{:.2f},{:.2f},{:.2f}),{:.2f},{:.2f},{:.2f}",
+ "per-shard: {:.2f}({:.2f},{:.2f},{:.2f},{:.2f}),{:.2f},{:.2f},{:.2f}",
io_total.pending_io_num,
io_total.pending_read_num,
io_total.pending_bg_num,
io_total.pending_flush_num,
(double)io_total.pending_io_num/seastar::smp::count,
(double)io_total.starting_io_num/seastar::smp::count,
- (double)io_total.waiting_collock_io_num/seastar::smp::count,
(double)io_total.waiting_throttler_io_num/seastar::smp::count,
(double)io_total.processing_inlock_io_num/seastar::smp::count,
(double)io_total.processing_postlock_io_num/seastar::smp::count,
for (const auto &s : shard_io_stats) {
oss_pending << s.pending_io_num
<< "(" << s.starting_io_num
- << "," << s.waiting_collock_io_num
<< "," << s.waiting_throttler_io_num
<< "," << s.processing_inlock_io_num
<< "," << s.processing_postlock_io_num
const std::array<
std::pair<txn_stage_t, seastar::lowres_clock::duration>, STAGE_MAX>
stage_samples = {{
- {txn_stage_t::COLLOCK_WAIT, seastar::lowres_clock::duration::zero()},
- {txn_stage_t::COLLOCK_HOLD, seastar::lowres_clock::duration::zero()},
{txn_stage_t::THROTTLER_WAIT, throttler_wait},
{txn_stage_t::BUILD, ctx.build_time},
{txn_stage_t::BUILD_GET_ONODE, ctx.get_onode_time},
};
INFO("iops={:.2f},{:.2f},{:.2f}({:.2f},{:.2f},{:.2f},{:.2f}),{:.2f} "
"conflicts={:.2f},{:.2f},{:.2f}({:.2f},{:.2f},{:.2f},{:.2f}) "
- "outstanding={}({},{},{},{},{}),{},{},{}",
+ "outstanding={}({},{},{},{}),{},{},{}",
// iops
ret.io_num/seconds,
ret.read_num/seconds,
// outstanding
ret.pending_io_num,
ret.starting_io_num,
- ret.waiting_collock_io_num,
ret.waiting_throttler_io_num,
ret.processing_inlock_io_num,
ret.processing_postlock_io_num,
};
enum class txn_stage_t : uint8_t {
- COLLOCK_WAIT = 0, // waiting on the collection ordering_lock
- COLLOCK_HOLD, // collection ordering_lock held (acquire -> release at prepare_record)
- THROTTLER_WAIT, // waiting for a throttler slot
+ THROTTLER_WAIT = 0, // waiting for a throttler slot
BUILD, // building the transaction (_do_transaction_step loop)
BUILD_GET_ONODE, // onode_manager get/get_or_create calls within BUILD
SUBMIT_TOTAL, // the whole submit_transaction (pipeline + journal write)
SeastoreCollection(T&&... args) :
FuturizedCollection(std::forward<T>(args)...) {}
- seastar::shared_mutex ordering_lock;
-
struct batch_entry_t {
ceph::os::Transaction txn;
seastar::promise<> pr;