From dfcda46fccd660d6d5a51b5a3eef8774875b8a59 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Fri, 3 Sep 2021 23:19:28 +0800 Subject: [PATCH] crimson/os/seastore: better debug outputs Signed-off-by: Xuehan Xu --- src/crimson/os/seastore/cache.cc | 6 +++++- .../os/seastore/lba_manager/btree/lba_btree.cc | 13 +++++++++++-- .../omap_manager/btree/omap_btree_node_impl.cc | 8 +++++--- src/crimson/os/seastore/transaction_manager.h | 4 +++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index f095982adeb8b..a7c5d4fcc6af2 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -662,6 +662,7 @@ void Cache::invalidate(Transaction& t, CachedExtent& conflicting_extent) if (!i->is_valid()) { continue; } + DEBUGT("was mutating extent: {}", t, *i); efforts.mutate.increment(i->get_length()); efforts.mutate_delta_bytes += i->get_delta().length(); } @@ -804,7 +805,10 @@ record_t Cache::prepare_record(Transaction &t) // Should be valid due to interruptible future for (auto &i: t.read_set) { - assert(i.ref->is_valid()); + if (!i.ref->is_valid()) { + DEBUGT("read_set invalid extent: {}, aborting", t, *i.ref); + ceph_abort("no invalid extent allowed in transactions' read_set"); + } get_by_ext(efforts.read_by_ext, i.ref->get_type()).increment(i.ref->get_length()); } diff --git a/src/crimson/os/seastore/lba_manager/btree/lba_btree.cc b/src/crimson/os/seastore/lba_manager/btree/lba_btree.cc index b12b346eab551..a6d871b59037d 100644 --- a/src/crimson/os/seastore/lba_manager/btree/lba_btree.cc +++ b/src/crimson/os/seastore/lba_manager/btree/lba_btree.cc @@ -549,7 +549,12 @@ LBABtree::handle_split_ret LBABtree::handle_split( if (split_from > 1) { auto &pos = iter.get_internal(split_from); - DEBUGT("splitting internal {} at depth {}", c.trans, *pos.node, split_from); + DEBUGT("splitting internal {} at depth {}, parent: {} at pos: {}", + c.trans, + *pos.node, + split_from, + *parent_pos.node, + parent_pos.pos); auto [left, right] = split_level(parent_pos, pos); if (pos.pos < left->get_size()) { @@ -562,7 +567,11 @@ LBABtree::handle_split_ret LBABtree::handle_split( } } else { auto &pos = iter.leaf; - DEBUGT("splitting leaf {}", c.trans, *pos.node); + DEBUGT("splitting leaf {}, parent: {} at pos: {}", + c.trans, + *pos.node, + *parent_pos.node, + parent_pos.pos); auto [left, right] = split_level(parent_pos, pos); /* right->get_node_meta().begin == pivot == right->begin()->get_key() diff --git a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc index 66aea6a44274b..1cd3d15381f1b 100644 --- a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc +++ b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc @@ -323,7 +323,7 @@ OMapInnerNode::merge_entry( auto is_left = (iter + 1) == iter_end(); auto donor_iter = is_left ? iter - 1 : iter + 1; return omap_load_extent(oc, donor_iter->get_val(), get_meta().depth - 1) - .si_then([=] (auto &&donor) mutable { + .si_then([=, px=this] (auto &&donor) mutable { auto [l, r] = is_left ? std::make_pair(donor, entry) : std::make_pair(entry, donor); auto [liter, riter] = is_left ? @@ -332,7 +332,8 @@ OMapInnerNode::merge_entry( logger().debug("{}::merge_entry make_full_merge l {} r {}", __func__, *l, *r); assert(entry->extent_is_below_min()); return l->make_full_merge(oc, r).si_then([liter=liter, riter=riter, - l=l, r=r, oc, this] (auto &&replacement){ + l=l, r=r, oc, this, px] (auto &&replacement){ + logger().debug("OMapInnerNode::merge_entry to update parent: {}", *px); journal_inner_update(liter, replacement->get_laddr(), maybe_get_delta_buffer()); journal_inner_remove(riter, maybe_get_delta_buffer()); //retire extent @@ -353,7 +354,8 @@ OMapInnerNode::merge_entry( } else { logger().debug("{}::merge_entry balanced l {} r {}", __func__, *l, *r); return l->make_balanced(oc, r).si_then([liter=liter, riter=riter, - l=l, r=r, oc, this] (auto tuple) { + l=l, r=r, oc, this, px] (auto tuple) { + logger().debug("OMapInnerNode::merge_entry to update parent: {}", *px); auto [replacement_l, replacement_r, replacement_pivot] = tuple; //update operation will not cuase node overflow, so we can do it first journal_inner_update(liter, replacement_l->get_laddr(), maybe_get_delta_buffer()); diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h index 2a455ab426b22..cbdb867c854ee 100644 --- a/src/crimson/os/seastore/transaction_manager.h +++ b/src/crimson/os/seastore/transaction_manager.h @@ -292,10 +292,12 @@ public: hint, len, ext->get_paddr() - ).si_then([ext=std::move(ext), len, this](auto &&ref) mutable { + ).si_then([ext=std::move(ext), len, hint, &t, this](auto &&ref) mutable { + LOG_PREFIX(TransactionManager::alloc_extent); ext->set_pin(std::move(ref)); stats.extents_allocated_total++; stats.extents_allocated_bytes += len; + DEBUGT("new extent: {}, hint: {}", t, *ext, hint); return alloc_extent_iertr::make_ready_future>( std::move(ext)); }); -- 2.39.5