From 97ac53f064e639b667b60e024fdaf3bee1bbe76a Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Thu, 15 Oct 2020 13:06:27 +0800 Subject: [PATCH] crimson/onode-staged-tree: fix non-debug build warning Signed-off-by: Yingxin Cheng --- .../onode_manager/staged-fltree/node.cc | 6 +- .../onode_manager/staged-fltree/node.h | 6 +- .../staged-fltree/node_extent_manager/dummy.h | 10 +- .../node_extent_manager/seastore.h | 4 +- .../onode_manager/staged-fltree/node_impl.cc | 8 +- .../onode_manager/staged-fltree/node_impl.h | 16 +-- .../onode_manager/staged-fltree/node_layout.h | 10 +- .../staged-fltree/stages/node_stage.cc | 25 ++-- .../staged-fltree/stages/node_stage.h | 6 +- .../staged-fltree/stages/node_stage_layout.h | 11 +- .../staged-fltree/stages/stage.h | 33 +++-- .../staged-fltree/stages/stage_types.h | 8 +- .../onode_manager/staged-fltree/super.h | 2 +- .../seastore/onode_tree/test_staged_fltree.cc | 130 +++++++++--------- 14 files changed, 136 insertions(+), 139 deletions(-) diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc index a8ed7ab5b6673..db729bd920e6c 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc @@ -258,7 +258,7 @@ node_future> Node::load( auto impl = InternalNodeImpl::load(extent, *field_type, expect_is_level_tail); return Ref(new InternalNode(impl.get(), std::move(impl))); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } }); } @@ -298,8 +298,8 @@ node_future<> InternalNode::apply_child_split( auto free_size = impl->free_size(); if (free_size >= insert_size) { // insert - auto p_value = impl->insert(left_key, left_child_addr_packed, - insert_pos, insert_stage, insert_size); + [[maybe_unused]] auto p_value = impl->insert( + left_key, left_child_addr_packed, insert_pos, insert_stage, insert_size); assert(impl->free_size() == free_size - insert_size); assert(insert_pos <= pos); assert(p_value->value == left_child_addr); diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node.h index c36b0ed851190..67f101fa92353 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node.h @@ -126,7 +126,7 @@ class Node protected: virtual node_future<> test_clone_non_root(context_t, Ref) const { - assert(false && "impossible path"); + ceph_abort("impossible path"); } virtual node_future lower_bound_tracked( context_t, const key_hobj_t&, MatchHistory&) = 0; @@ -203,7 +203,7 @@ class InternalNode final : public Node { void do_untrack_child(const Node& child) { auto& child_pos = child.parent_info().position; assert(tracked_child_nodes.find(child_pos)->second == &child); - auto removed = tracked_child_nodes.erase(child_pos); + [[maybe_unused]] auto removed = tracked_child_nodes.erase(child_pos); assert(removed); } @@ -279,7 +279,7 @@ class LeafNode final : public Node { validate_cursor(cursor); auto& cursor_pos = cursor.get_position(); assert(tracked_cursors.find(cursor_pos)->second == &cursor); - auto removed = tracked_cursors.erase(cursor_pos); + [[maybe_unused]] auto removed = tracked_cursors.erase(cursor_pos); assert(removed); } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h index f54db62c018d2..f77335d31bcb3 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h @@ -39,15 +39,15 @@ class DummyNodeExtent final: public NodeExtent { ~DummyNodeExtent() override = default; protected: NodeExtentRef mutate(context_t) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } CachedExtentRef duplicate_for_write() override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } extent_types_t get_type() const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } ceph::bufferlist get_delta() override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } void apply_delta(const ceph::bufferlist&) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } }; template diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h index 38a0afd222afe..1ec2e75e8fbc1 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h @@ -44,11 +44,11 @@ class SeastoreNodeExtent final: public NodeExtent { } ceph::bufferlist get_delta() override { //TODO - assert(false && "not implemented"); + ceph_abort("not implemented"); } void apply_delta(const ceph::bufferlist&) override { //TODO - assert(false && "not implemented"); + ceph_abort("not implemented"); } private: static seastar::logger& logger() { diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.cc index f455f3d6a82cc..e64ef91d8b84e 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.cc @@ -23,7 +23,7 @@ InternalNodeImpl::allocate( } else if (type == field_type_t::N3) { return InternalNode3::allocate(c, is_level_tail, level); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -39,7 +39,7 @@ LeafNodeImpl::allocate( } else if (type == field_type_t::N3) { return LeafNode3::allocate(c, is_level_tail, 0); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -54,7 +54,7 @@ InternalNodeImplURef InternalNodeImpl::load( } else if (type == field_type_t::N3) { return InternalNode3::load(extent, expect_is_level_tail); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -69,7 +69,7 @@ LeafNodeImplURef LeafNodeImpl::load( } else if (type == field_type_t::N3) { return LeafNode3::load(extent, expect_is_level_tail); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.h index 0aeaa49352f86..500f184e4fd02 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.h @@ -92,24 +92,24 @@ class InternalNodeImpl : public NodeImpl { virtual const laddr_packed_t* get_p_value( const search_position_t&, key_view_t* = nullptr, internal_marker_t = {}) const { - assert(false && "impossible path"); + ceph_abort("impossible path"); } #pragma GCC diagnostic ignored "-Woverloaded-virtual" virtual lookup_result_t lower_bound( const key_hobj_t&, MatchHistory&, key_view_t* = nullptr, internal_marker_t = {}) const { - assert(false && "impossible path"); + ceph_abort("impossible path"); } #pragma GCC diagnostic ignored "-Woverloaded-virtual" virtual const laddr_packed_t* insert( const key_view_t&, const laddr_packed_t&, search_position_t&, match_stage_t&, node_offset_t&) { - assert(false && "impossible path"); + ceph_abort("impossible path"); } #pragma GCC diagnostic ignored "-Woverloaded-virtual" virtual std::tuple split_insert( NodeExtentMutable&, NodeImpl&, const key_view_t&, const laddr_packed_t&, search_position_t&, match_stage_t&, node_offset_t&) { - assert(false && "impossible path"); + ceph_abort("impossible path"); } virtual void replace_child_addr(const search_position_t&, laddr_t dst, laddr_t src) = 0; @@ -139,24 +139,24 @@ class LeafNodeImpl : public NodeImpl { virtual const onode_t* get_p_value( const search_position_t&, key_view_t* = nullptr, leaf_marker_t={}) const { - assert(false && "impossible path"); + ceph_abort("impossible path"); } #pragma GCC diagnostic ignored "-Woverloaded-virtual" virtual lookup_result_t lower_bound( const key_hobj_t&, MatchHistory&, key_view_t* = nullptr, leaf_marker_t = {}) const { - assert(false && "impossible path"); + ceph_abort("impossible path"); } #pragma GCC diagnostic ignored "-Woverloaded-virtual" virtual const onode_t* insert( const key_hobj_t&, const onode_t&, search_position_t&, match_stage_t&, node_offset_t&) { - assert(false && "impossible path"); + ceph_abort("impossible path"); } #pragma GCC diagnostic ignored "-Woverloaded-virtual" virtual std::tuple split_insert( NodeExtentMutable&, NodeImpl&, const key_hobj_t&, const onode_t&, search_position_t&, match_stage_t&, node_offset_t&) { - assert(false && "impossible path"); + ceph_abort("impossible path"); } virtual void get_largest_slot( diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h index 1d78c73a57e73..f28680a67ace7 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h @@ -438,7 +438,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { insert_pos, insert_stage); // right node: append [insert_pos(key, value)] bool is_front_insert = (insert_pos == position_t::begin()); - bool is_end = STAGE_T::template append_insert( + [[maybe_unused]] bool is_end = STAGE_T::template append_insert( key, value, append_at, right_appender, is_front_insert, insert_stage, p_value); assert(append_at.is_end() == is_end); @@ -521,7 +521,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { assert(p_value->value == src); extent.update_child_addr_replayable(dst, const_cast(p_value)); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -543,7 +543,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { } return {insert_stage, insert_size}; } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -556,7 +556,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { STAGE_T::template lookup_largest_slot( extent.read(), &cast_down_fill_0(pos), &index_key, pp_value); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -573,7 +573,7 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl { key, value, history, mstat, cast_down(insert_pos)); } } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc index 817df33cd0c16..4b7d3170f1177 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.cc @@ -46,14 +46,14 @@ node_offset_t NODE_T::size_to_nxt_at(size_t index) const { auto p_end = p_start() + p_fields->get_item_end_offset(index); return FieldType::estimate_insert_one() + ns_oid_view_t(p_end).size(); } else { - assert(false && "N3 node is not nested"); + ceph_abort("N3 node is not nested"); } } template memory_range_t NODE_T::get_nxt_container(size_t index) const { if constexpr (std::is_same_v) { - assert(false && "N3 internal node doesn't have the right part"); + ceph_abort("N3 internal node doesn't have the right part"); } else { node_offset_t item_start_offset = p_fields->get_item_start_offset(index); node_offset_t item_end_offset = p_fields->get_item_end_offset(index); @@ -107,9 +107,9 @@ memory_range_t NODE_T::insert_prefix_at( -(int)size_right); return {p_insert_front, p_insert}; } else if constexpr (FIELD_TYPE == field_type_t::N2) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } else { - assert(false && "impossible"); + ceph_abort("impossible"); } } #define IPA_TEMPLATE(FT, NT, KT) \ @@ -146,7 +146,7 @@ node_offset_t NODE_T::trim_until( return 0; } if constexpr (std::is_same_v) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } else { mut.copy_in_absolute( (void*)&node.p_fields->num_keys, num_keys_t(index)); @@ -160,10 +160,9 @@ node_offset_t NODE_T::trim_at( NodeExtentMutable& mut, const node_extent_t& node, size_t index, node_offset_t trimmed) { assert(!node.is_level_tail()); - auto keys = node.keys(); - assert(index < keys); + assert(index < node.keys()); if constexpr (std::is_same_v) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } else { node_offset_t offset = node.p_fields->get_item_start_offset(index); size_t new_offset = offset + trimmed; @@ -212,7 +211,7 @@ void APPEND_T::append(const node_extent_t& src, size_t from, size_t items) { assert(from + items <= src.keys()); num_keys += items; if constexpr (std::is_same_v) { - assert(false && "impossible path"); + ceph_abort("impossible path"); } else { // append left part forwards node_offset_t offset_left_start = src.fields().get_key_start_offset(from); @@ -261,9 +260,9 @@ template void APPEND_T::append( const full_key_t& key, const value_t& value, const value_t*& p_value) { if constexpr (FIELD_TYPE == field_type_t::N3) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } else { - assert(false && "should not happen"); + ceph_abort("should not happen"); } } @@ -277,7 +276,7 @@ APPEND_T::open_nxt(const key_get_type& partial_key) { } else if constexpr (FIELD_TYPE == field_type_t::N2) { FieldType::append_key(*p_mut, partial_key, p_append_right); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } return {p_mut, p_append_right}; } @@ -292,7 +291,7 @@ APPEND_T::open_nxt(const full_key_t& key) { } else if constexpr (FIELD_TYPE == field_type_t::N2) { FieldType::template append_key(*p_mut, key, p_append_right); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } return {p_mut, p_append_right}; } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.h index edb2b1872be42..b976b38f82848 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.h @@ -132,9 +132,9 @@ class node_extent_t { const full_key_t& key, const value_t& value, size_t index, node_offset_t size, const char* p_left_bound) { if constexpr (FIELD_TYPE == field_type_t::N3) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } else { - assert(false && "impossible"); + ceph_abort("impossible"); } } @@ -188,7 +188,7 @@ class node_extent_t::Appender { FieldType::append_offset(*p_mut, p_append - p_start, p_append_left); ++num_keys; } else { - assert(false); + ceph_abort("not implemented"); } } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h index 14f95601a2077..f25a92b796fe1 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage_layout.h @@ -261,11 +261,11 @@ struct node_fields_2_t { static void insert_at( NodeExtentMutable& mut, const full_key_t& key, const node_fields_2_t& node, size_t index, node_offset_t size_right) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } static void update_size_at( NodeExtentMutable& mut, const node_fields_2_t& node, size_t index, int change) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } static void append_key( NodeExtentMutable& mut, const key_t& key, char*& p_append) { @@ -314,8 +314,7 @@ struct _internal_fields_3_t { std::enable_if_t free_size_before(size_t index) const { assert(index <= num_keys); - auto allowed_num_keys = is_level_tail() ? MAX_NUM_KEYS - 1 : MAX_NUM_KEYS; - assert(num_keys <= allowed_num_keys); + assert(num_keys <= (is_level_tail() ? MAX_NUM_KEYS - 1 : MAX_NUM_KEYS)); auto free = (MAX_NUM_KEYS - index) * (sizeof(snap_gen_t) + sizeof(laddr_t)); if (is_level_tail() && index == num_keys) { free -= (sizeof(snap_gen_t) + sizeof(laddr_t)); @@ -367,11 +366,11 @@ struct _internal_fields_3_t { static void insert_at( NodeExtentMutable& mut, const full_key_t& key, const me_t& node, size_t index, node_offset_t size_right) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } static void update_size_at( NodeExtentMutable& mut, const me_t& node, size_t index, int change) { - assert(false && "not implemented"); + ceph_abort("not implemented"); } node_header_t header; diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h index cb19b70258487..e39dbb9c46a7d 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h @@ -107,7 +107,7 @@ inline void assert_mstat( } break; default: - assert(false); + ceph_abort("impossible path"); } // key == index ... switch (mstat) { @@ -1020,8 +1020,7 @@ struct staged { auto match = compare_to(key, iter.get_key()); if (match == MatchKindCMP::EQ) { if constexpr (IS_BOTTOM) { - // ceph_abort? - assert(false && "insert conflict at current index!"); + ceph_abort("insert conflict at current index!"); } else { // insert into the current index auto nxt_container = iter.get_nxt_container(); @@ -1051,7 +1050,7 @@ struct staged { assert(match == MatchKindCMP::EQ); if constexpr (IS_BOTTOM) { // ceph_abort? - assert(false && "insert conflict at the previous index!"); + ceph_abort("insert conflict at the previous index!"); } else { // insert into the previous index auto nxt_container = iter.get_nxt_container(); @@ -1072,7 +1071,7 @@ struct staged { return true; } else { if constexpr (IS_BOTTOM) { - assert(false && "impossible"); + ceph_abort("impossible path"); } else { assert(stage < STAGE); bool compensate = NXT_STAGE_T:: @@ -1134,7 +1133,7 @@ struct staged { assert(insert_stage <= STAGE && "incompatible insert"); } else { assert(insert_stage <= STAGE && "impossible insert stage"); - bool ret = compensate_insert_position_at(insert_stage, position); + [[maybe_unused]] bool ret = compensate_insert_position_at(insert_stage, position); assert(!ret); } } @@ -1157,7 +1156,7 @@ struct staged { StagedAppender appender; appender.init(&mut, p_insert); appender.append(key, value, p_value); - const char* p_insert_front = appender.wrap(); + [[maybe_unused]] const char* p_insert_front = appender.wrap(); assert(p_insert_front == range.p_start); return p_value; } @@ -1226,7 +1225,7 @@ struct staged { iter.update_size(mut, _insert_size); return p_value; } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } } @@ -1247,7 +1246,7 @@ struct staged { stage = STAGE; _insert_size = insert_size(key, value); } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } if constexpr (IS_BOTTOM) { return container_t::template insert_at( @@ -1428,14 +1427,14 @@ struct staged { } return this->_nxt; } else { - assert(false); + ceph_abort("impossible path"); } } typename NXT_STAGE_T::StagedIterator& get_nxt() { if constexpr (!IS_BOTTOM) { return this->_nxt; } else { - assert(false); + ceph_abort("impossible path"); } } StagedIterator& operator++() { @@ -1695,7 +1694,7 @@ struct staged { return false; } } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); return false;; } } @@ -1787,7 +1786,7 @@ struct staged { this->_nxt.init(p_mut, p_append); return this->_nxt; } else { - assert(false); + ceph_abort("impossible path"); } } typename NXT_STAGE_T::template StagedAppender& @@ -1799,7 +1798,7 @@ struct staged { this->_nxt.init(p_mut, p_append); return this->_nxt; } else { - assert(false); + ceph_abort("impossible path"); } } typename NXT_STAGE_T::template StagedAppender& get_nxt() { @@ -1807,7 +1806,7 @@ struct staged { assert(require_wrap_nxt); return this->_nxt; } else { - assert(false); + ceph_abort("impossible path"); } } void wrap_nxt() { @@ -1818,7 +1817,7 @@ struct staged { appender->wrap_nxt(p_append); ++_index; } else { - assert(false); + ceph_abort("impossible path"); } } private: @@ -1934,7 +1933,7 @@ struct staged { } return false; } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage_types.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage_types.h index f0a522344f5a3..e7c9826deaf57 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage_types.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage_types.h @@ -88,7 +88,7 @@ struct MatchHistory { } else if (*match == MatchKindCMP::PO) { return os << "PO"; } else { - assert(false && "impossble path"); + ceph_abort("impossble path"); } } @@ -283,7 +283,7 @@ const staged_position_t& cast_down(const search_position_t& pos) { #endif return pos.nxt.nxt; } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -305,7 +305,7 @@ staged_position_t& cast_down_fill_0(search_position_t& pos) { pos.nxt.index = 0; return pos.nxt.nxt; } else { - assert(false && "impossible path"); + ceph_abort("impossible path"); } } @@ -321,7 +321,7 @@ search_position_t normalize(staged_position_t&& pos) { } else if (STAGE == STAGE_RIGHT) { return {0u, {0u, std::move(pos)}}; } else { - assert(false); + ceph_abort("impossible path"); } } diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/super.h b/src/crimson/os/seastore/onode_manager/staged-fltree/super.h index 04540d3db0ebe..3fc805373c7c3 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/super.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/super.h @@ -82,7 +82,7 @@ class RootNodeTrackerIsolated final : public RootNodeTracker { tracked_supers[&t] = &super; } void do_untrack_super(Transaction& t, Super& super) override { - auto removed = tracked_supers.erase(&t); + [[maybe_unused]] auto removed = tracked_supers.erase(&t); assert(removed); } ::Ref get_root(Transaction& t) const override; diff --git a/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc b/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc index 29341720689c2..e782192ab40bd 100644 --- a/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc +++ b/src/test/crimson/seastore/onode_tree/test_staged_fltree.cc @@ -55,7 +55,7 @@ namespace { auto sg = snap_gen_t::from_key(key_hobj); p_fill -= sizeof(snap_gen_t); - assert(p_fill == (char*)p_mem); + ceph_assert(p_fill == (char*)p_mem); std::memcpy(p_fill, &sg, sizeof(snap_gen_t)); key_view.set(*reinterpret_cast(p_fill)); @@ -196,9 +196,9 @@ TEST_F(b_dummy_tree_test_t, 3_random_insert_leaf_node) auto key_s = make_ghobj(0, 0, 0, "ns", "oid", 0, 0); auto key_e = make_ghobj( std::numeric_limits::max(), 0, 0, "ns", "oid", 0, 0); - assert(tree.find(t, key_s).unsafe_get0().is_end()); - assert(tree.begin(t).unsafe_get0().is_end()); - assert(tree.last(t).unsafe_get0().is_end()); + ASSERT_TRUE(tree.find(t, key_s).unsafe_get0().is_end()); + ASSERT_TRUE(tree.begin(t).unsafe_get0().is_end()); + ASSERT_TRUE(tree.last(t).unsafe_get0().is_end()); std::vector build_key_set( std::pair range_0, std::string padding = "", bool is_internal = false) { - assert(range_1.second <= 10); + ceph_assert(range_1.second <= 10); std::set ret; ghobject_t key; for (unsigned i = range_2.first; i < range_2.second; ++i) { @@ -391,8 +391,8 @@ class TestTree { auto& value = onodes.create(onode_size); insert_tree(key, value).get0(); } - assert(tree.height(t).unsafe_get0() == 1); - assert(!tree.test_is_clean()); + ASSERT_EQ(tree.height(t).unsafe_get0(), 1); + ASSERT_FALSE(tree.test_is_clean()); //std::ostringstream oss; //tree.dump(t, oss); //logger().info("\n{}\n", oss.str()); @@ -405,7 +405,7 @@ class TestTree { tree.mkfs(t).unsafe_get0(); //logger().info("\n---------------------------------------------" // "\nbefore leaf node split:\n"); - assert(keys.size() == values.size()); + ASSERT_EQ(keys.size(), values.size()); auto key_iter = keys.begin(); auto value_iter = values.begin(); while (key_iter != keys.end()) { @@ -413,8 +413,8 @@ class TestTree { ++key_iter; ++value_iter; } - assert(tree.height(t).unsafe_get0() == 1); - assert(!tree.test_is_clean()); + ASSERT_EQ(tree.height(t).unsafe_get0(), 1); + ASSERT_FALSE(tree.test_is_clean()); //std::ostringstream oss; //tree.dump(t, oss); //logger().info("\n{}\n", oss.str()); @@ -431,13 +431,13 @@ class TestTree { logger().info("insert {}:", key_hobj_t(key)); auto [cursor, success] = tree_clone.insert(t_clone, key, value).unsafe_get0(); - assert(success == true); + ASSERT_TRUE(success); Onodes::validate_cursor(cursor, key, value); std::ostringstream oss; tree_clone.dump(t_clone, oss); - logger().info("dump new root:\n{}\n", oss.str()); - assert(tree_clone.height(t_clone).unsafe_get0() == 2); + logger().info("dump new root:\n{}", oss.str()); + EXPECT_EQ(tree_clone.height(t_clone).unsafe_get0(), 2); for (auto& [k, v, c] : insert_history) { auto result = tree_clone.lower_bound(t_clone, k).unsafe_get0(); @@ -445,7 +445,7 @@ class TestTree { } auto result = tree_clone.lower_bound(t_clone, key).unsafe_get0(); Onodes::validate_cursor(result, key, value); - assert(last_split.match(expected)); + EXPECT_TRUE(last_split.match(expected)); }); } @@ -457,7 +457,7 @@ class TestTree { seastar::future<> insert_tree(const ghobject_t& key, const onode_t& value) { return seastar::async([this, &key, &value] { auto [cursor, success] = tree.insert(t, key, value).unsafe_get0(); - assert(success == true); + ASSERT_TRUE(success); Onodes::validate_cursor(cursor, key, value); insert_history.emplace_back(key, &value, cursor); }); @@ -608,13 +608,13 @@ TEST_F(c_dummy_test_t, 4_split_leaf_node) "\nsplit at [0, 0, 0]; insert to left front at stage 2, 1, 0\n"); test.split(make_ghobj(1, 1, 1, "ns3", "oid3", 3, 3), onode, {2u, 2u, true, InsertType::BEGIN}).get0(); - assert(last_split.match_split_pos({0, {0, {0}}})); + EXPECT_TRUE(last_split.match_split_pos({0, {0, {0}}})); test.split(make_ghobj(2, 2, 2, "ns1", "oid1", 3, 3), onode, {2u, 1u, true, InsertType::BEGIN}).get0(); - assert(last_split.match_split_pos({0, {0, {0}}})); + EXPECT_TRUE(last_split.match_split_pos({0, {0, {0}}})); test.split(make_ghobj(2, 2, 2, "ns2", "oid2", 1, 1), onode, {2u, 0u, true, InsertType::BEGIN}).get0(); - assert(last_split.match_split_pos({0, {0, {0}}})); + EXPECT_TRUE(last_split.match_split_pos({0, {0, {0}}})); } { @@ -631,13 +631,13 @@ TEST_F(c_dummy_test_t, 4_split_leaf_node) "\nsplit at [END, END, END]; insert to right at stage 0, 1, 2\n"); test.split(make_ghobj(3, 3, 3, "ns3", "oid3", 4, 4), onode, {0u, 0u, false, InsertType::BEGIN}).get0(); - assert(last_split.match_split_pos({1, {0, {1}}})); + EXPECT_TRUE(last_split.match_split_pos({1, {0, {1}}})); test.split(make_ghobj(3, 3, 3, "ns4", "oid4", 3, 3), onode, {1u, 1u, false, InsertType::BEGIN}).get0(); - assert(last_split.match_split_pos({1, {1, {0}}})); + EXPECT_TRUE(last_split.match_split_pos({1, {1, {0}}})); test.split(make_ghobj(4, 4, 4, "ns3", "oid3", 3, 3), onode, {2u, 2u, false, InsertType::BEGIN}).get0(); - assert(last_split.match_split_pos({2, {0, {0}}})); + EXPECT_TRUE(last_split.match_split_pos({2, {0, {0}}})); } }); } @@ -674,27 +674,27 @@ class DummyChildPool { level_t level() const override { return 0u; } key_view_t get_largest_key_view() const override { return key_view; } void prepare_mutate(context_t) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } bool is_empty() const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } node_offset_t free_size() const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } key_view_t get_key_view(const search_position_t&) const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } void next_position(search_position_t&) const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } node_stats_t get_stats() const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } std::ostream& dump(std::ostream&) const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } std::ostream& dump_brief(std::ostream&) const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } void validate_layout() const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } void test_copy_to(NodeExtentMutable&) const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } void test_set_tail(NodeExtentMutable&) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } private: std::set keys; @@ -711,8 +711,8 @@ class DummyChildPool { node_future<> populate_split( context_t c, std::set>& splitable_nodes) { - assert(can_split()); - assert(splitable_nodes.find(this) != splitable_nodes.end()); + ceph_assert(can_split()); + ceph_assert(splitable_nodes.find(this) != splitable_nodes.end()); size_t index; const auto& keys = impl->get_keys(); @@ -742,9 +742,9 @@ class DummyChildPool { context_t c, const ghobject_t& insert_key, std::set>& splitable_nodes) { const auto& keys = impl->get_keys(); - assert(keys.size() == 1); + ceph_assert(keys.size() == 1); auto& key = *keys.begin(); - assert(insert_key < key); + ceph_assert(insert_key < key); std::set new_keys; new_keys.insert(insert_key); @@ -754,12 +754,12 @@ class DummyChildPool { splitable_nodes.clear(); splitable_nodes.insert(this); auto fut = populate_split(c, splitable_nodes); - assert(!splitable_nodes.size()); + ceph_assert(splitable_nodes.size() == 0); return fut; } bool match_pos(const search_position_t& pos) const { - assert(!is_root()); + ceph_assert(!is_root()); return pos == parent_info().position; } @@ -792,25 +792,25 @@ class DummyChildPool { protected: node_future<> test_clone_non_root( context_t, Ref new_parent) const override { - assert(!is_root()); + ceph_assert(!is_root()); auto p_pool_clone = pool.pool_clone_in_progress; - assert(p_pool_clone); + ceph_assert(p_pool_clone != nullptr); auto clone = create( impl->get_keys(), impl->is_level_tail(), impl->laddr(), *p_pool_clone); clone->as_child(parent_info().position, new_parent); return node_ertr::now(); } node_future> lookup_smallest(context_t) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } node_future> lookup_largest(context_t) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } node_future<> test_clone_root(context_t, RootNodeTracker&) const override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } node_future lower_bound_tracked( context_t, const key_hobj_t&, MatchHistory&) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } node_future<> do_get_tree_stats(context_t, tree_stats_t&) override { - assert(false && "impossible path"); } + ceph_abort("impossible path"); } private: DummyChild(DummyChildImpl* impl, DummyChildImpl::URef&& ref, DummyChildPool& pool) @@ -863,7 +863,7 @@ class DummyChildPool { //logger().info("\n{}\n", oss.str()); return p_btree->height(t()); }).safe_then([](auto height) { - assert(height == 2); + ceph_assert(height == 2); }); } @@ -884,29 +884,29 @@ class DummyChildPool { pool_clone.get_context(), key, pool_clone.splitable_nodes).unsafe_get0(); std::ostringstream oss; pool_clone.p_btree->dump(pool_clone.t(), oss); - logger().info("dump new root:\n{}\n", oss.str()); - assert(pool_clone.p_btree->height(pool_clone.t()).unsafe_get0() == 3); - assert(last_split.match(expected)); + logger().info("dump new root:\n{}", oss.str()); + EXPECT_EQ(pool_clone.p_btree->height(pool_clone.t()).unsafe_get0(), 3); + EXPECT_TRUE(last_split.match(expected)); }); } private: void reset() { - assert(!pool_clone_in_progress); + ceph_assert(pool_clone_in_progress == nullptr); if (tracked_children.size()) { - assert(!p_btree->test_is_clean()); + ceph_assert(!p_btree->test_is_clean()); tracked_children.clear(); - assert(p_btree->test_is_clean()); + ceph_assert(p_btree->test_is_clean()); p_nm = nullptr; p_btree.reset(); } else { - assert(!p_btree); + ceph_assert(!p_btree.has_value()); } splitable_nodes.clear(); } void track_node(Ref node) { - assert(tracked_children.find(node) == tracked_children.end()); + ceph_assert(tracked_children.find(node) == tracked_children.end()); tracked_children.insert(node); } @@ -915,12 +915,12 @@ class DummyChildPool { tracked_children.begin(), tracked_children.end(), [&pos](auto& child) { return child->match_pos(pos); }); - assert(iter != tracked_children.end()); + ceph_assert(iter != tracked_children.end()); return *iter; } context_t get_context() { - assert(p_nm != nullptr); + ceph_assert(p_nm != nullptr); return {*p_nm, t()}; } -- 2.39.5