ExtMapInnerNode::split_children_ret
ExtMapInnerNode::make_split_children(ext_context_t ec)
{
+ logger().debug("{}: {}", "ExtMapInnerNode", __func__);
return extmap_alloc_2extents<ExtMapInnerNode>(ec, EXTMAP_BLOCK_SIZE)
.safe_then([this] (auto &&ext_pair) {
auto [left, right] = ext_pair;
ExtMapInnerNode::full_merge_ret
ExtMapInnerNode::make_full_merge(ext_context_t ec, ExtMapNodeRef right)
{
+ logger().debug("{}: {}", "ExtMapInnerNode", __func__);
return extmap_alloc_extent<ExtMapInnerNode>(ec, EXTMAP_BLOCK_SIZE)
.safe_then([this, right] (auto &&replacement) {
replacement->merge_from(*this, *right->cast<ExtMapInnerNode>());
ExtMapInnerNode::make_balanced_ret
ExtMapInnerNode::make_balanced(ext_context_t ec, ExtMapNodeRef _right, bool prefer_left)
{
+ logger().debug("{}: {}", "ExtMapInnerNode", __func__);
ceph_assert(_right->get_type() == type);
return extmap_alloc_2extents<ExtMapInnerNode>(ec, EXTMAP_BLOCK_SIZE)
.safe_then([this, _right, prefer_left] (auto &&replacement_pair){
ExtMapInnerNode::split_entry(ext_context_t ec, objaddr_t lo,
internal_iterator_t iter, ExtMapNodeRef entry)
{
+ logger().debug("{}: {}", "ExtMapInnerNode", __func__);
if (!is_pending()) {
auto mut = ec.tm.get_mutable_extent(ec.t, this)->cast<ExtMapInnerNode>();
auto mut_iter = mut->iter_idx(iter->get_offset());
ExtMapLeafNode::split_children_ret
ExtMapLeafNode::make_split_children(ext_context_t ec)
{
+ logger().debug("{}: {}", "ExtMapLeafNode", __func__);
return extmap_alloc_2extents<ExtMapLeafNode>(ec, EXTMAP_BLOCK_SIZE)
.safe_then([this] (auto &&ext_pair) {
auto [left, right] = ext_pair;
ExtMapLeafNode::full_merge_ret
ExtMapLeafNode::make_full_merge(ext_context_t ec, ExtMapNodeRef right)
{
+ logger().debug("{}: {}", "ExtMapLeafNode", __func__);
return extmap_alloc_extent<ExtMapLeafNode>(ec, EXTMAP_BLOCK_SIZE)
.safe_then([this, right] (auto &&replacement) {
replacement->merge_from(*this, *right->cast<ExtMapLeafNode>());
ExtMapLeafNode::make_balanced_ret
ExtMapLeafNode::make_balanced(ext_context_t ec, ExtMapNodeRef _right, bool prefer_left)
{
+ logger().debug("{}: {}", "ExtMapLeafNode", __func__);
ceph_assert(_right->get_type() == type);
return extmap_alloc_2extents<ExtMapLeafNode>(ec, EXTMAP_BLOCK_SIZE)
.safe_then([this, _right, prefer_left] (auto &&replacement_pair) {
check_mappings(extmap_root, *t);
}
+ void replay() {
+ logger().debug("{}: begin", __func__);
+ tm->close().unsafe_get();
+ destroy();
+ static_cast<segment_manager::EphemeralSegmentManager*>(&*segment_manager)->remount();
+ init();
+ tm->mount().unsafe_get();
+ extmap_manager = extentmap_manager::create_extentmap_manager(*tm);
+ logger().debug("{}: end", __func__);
+ }
+
+
};
TEST_F(extentmap_manager_test_t, basic)
});
}
-TEST_F(extentmap_manager_test_t, force_split)
+TEST_F(extentmap_manager_test_t, force_leafnode_split)
{
run_async([this] {
extmap_root_t extmap_root(0, L_ADDR_NULL);
}
-TEST_F(extentmap_manager_test_t, force_split_merge)
+TEST_F(extentmap_manager_test_t, force_leafnode_split_merge)
{
run_async([this] {
extmap_root_t extmap_root(0, L_ADDR_NULL);
for (unsigned j = 0; j < 5; ++j) {
[[maybe_unused]] auto addref = insert_extent(extmap_root, *t, lo, {lo, len});
lo += len;
- if ((i % 10 == 0) && (j == 3)) {
- check_mappings(extmap_root, *t);
- }
+ if ((i % 10 == 0) && (j == 3)) {
+ check_mappings(extmap_root, *t);
+ }
}
logger().debug("submitting transaction");
tm->submit_transaction(std::move(t)).unsafe_get();
if (i % 50 == 0) {
- check_mappings(extmap_root);
+ check_mappings(extmap_root);
}
}
auto t = tm->create_transaction();
int i = 0;
- for (const auto& [lo, ext]: test_ext_mappings) {
+ for (auto iter = test_ext_mappings.begin(); iter != test_ext_mappings.end();) {
+ auto [lo, ext] = *iter;
+ ++iter;
if (i % 3 != 0) {
- rm_extent(extmap_root, *t, lo, ext);
+ rm_extent(extmap_root, *t, lo, ext);
}
+ i++;
if (i % 10 == 0) {
logger().debug("submitting transaction i= {}", i);
- tm->submit_transaction(std::move(t)).unsafe_get();
- t = tm->create_transaction();
+ tm->submit_transaction(std::move(t)).unsafe_get();
+ t = tm->create_transaction();
}
if (i % 100 == 0) {
logger().debug("check_mappings i= {}", i);
- check_mappings(extmap_root, *t);
- check_mappings(extmap_root);
+ check_mappings(extmap_root, *t);
+ check_mappings(extmap_root);
}
- i++;
}
logger().debug("finally submitting transaction ");
tm->submit_transaction(std::move(t)).unsafe_get();
});
}
-TEST_F(extentmap_manager_test_t, force_split_balanced)
+TEST_F(extentmap_manager_test_t, force_leafnode_split_merge_replay)
{
run_async([this] {
extmap_root_t extmap_root(0, L_ADDR_NULL);
auto t = tm->create_transaction();
extmap_root = extmap_manager->initialize_extmap(*t).unsafe_get0();
tm->submit_transaction(std::move(t)).unsafe_get();
+ replay();
}
uint32_t len = 4096;
uint32_t lo = 0;
for (unsigned j = 0; j < 5; ++j) {
[[maybe_unused]] auto addref = insert_extent(extmap_root, *t, lo, {lo, len});
lo += len;
- if ((i % 10 == 0) && (j == 3)) {
- check_mappings(extmap_root, *t);
- }
}
logger().debug("submitting transaction");
tm->submit_transaction(std::move(t)).unsafe_get();
- if (i % 50 == 0) {
- check_mappings(extmap_root);
- }
}
+ replay();
auto t = tm->create_transaction();
int i = 0;
- for (const auto& [lo, ext]: test_ext_mappings) {
- if (i < 100) {
- rm_extent(extmap_root, *t, lo, ext);
- }
+ for (auto iter = test_ext_mappings.begin(); iter != test_ext_mappings.end();) {
+ auto [lo, ext] = *iter;
+ ++iter;
+ rm_extent(extmap_root, *t, lo, ext);
+ i++;
if (i % 10 == 0) {
- logger().debug("submitting transaction i= {}", i);
+ logger().debug("submitting transaction i= {}", i);
tm->submit_transaction(std::move(t)).unsafe_get();
t = tm->create_transaction();
}
- if (i % 50 == 0) {
- logger().debug("check_mappings i= {}", i);
- check_mappings(extmap_root, *t);
+ if (i% 100 == 0){
check_mappings(extmap_root);
}
- i++;
- if (i == 100)
- break;
}
logger().debug("finally submitting transaction ");
tm->submit_transaction(std::move(t)).unsafe_get();
+ replay();
check_mappings(extmap_root);
});
}