Skip to content

Commit 0f47374

Browse files
authored
Merge pull request ceph#64528 from chanyoung/cleanup-test-clear
test/crimson/seastore/test_omap_manager: add unit test for clear Reviewed-by: Samuel Just <[email protected]
2 parents 0a8990d + 1773057 commit 0f47374

File tree

1 file changed

+23
-81
lines changed

1 file changed

+23
-81
lines changed

src/test/crimson/seastore/test_omap_manager.cc

Lines changed: 23 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,29 @@ TEST_P(omap_manager_test_t, leafnode_split_merge_balancing)
419419
});
420420
}
421421

422-
TEST_P(omap_manager_test_t, force_split_listkeys_list_rmkey_range_clear)
422+
TEST_P(omap_manager_test_t, clear)
423+
{
424+
run_async([this] {
425+
omap_root_t omap_root = initialize();
426+
427+
logger().debug("== filling tree to depth 2");
428+
while (omap_root.get_depth() < 2) {
429+
auto t = create_mutate_transaction();
430+
for (int i = 0; i < 64; i++) {
431+
set_random_key(omap_root, *t);
432+
}
433+
submit_transaction(std::move(t));
434+
}
435+
check_mappings(omap_root);
436+
437+
logger().debug("== clearing entire tree");
438+
auto t = create_mutate_transaction();
439+
clear(omap_root, *t);
440+
submit_transaction(std::move(t));
441+
});
442+
}
443+
444+
TEST_P(omap_manager_test_t, force_split_listkeys_list_rmkey_range)
423445
{
424446
run_async([this] {
425447
omap_root_t omap_root = initialize();
@@ -498,12 +520,6 @@ TEST_P(omap_manager_test_t, force_split_listkeys_list_rmkey_range_clear)
498520
}
499521
submit_transaction(std::move(t));
500522
}
501-
502-
{
503-
auto t = create_mutate_transaction();
504-
clear(omap_root, *t);
505-
submit_transaction(std::move(t));
506-
}
507523
});
508524
}
509525

@@ -570,74 +586,6 @@ TEST_P(omap_manager_test_t, force_inner_node_split_list_rmkey_range)
570586
}
571587
submit_transaction(std::move(t));
572588
}
573-
574-
{
575-
auto t = create_mutate_transaction();
576-
clear(omap_root, *t);
577-
submit_transaction(std::move(t));
578-
}
579-
});
580-
}
581-
582-
TEST_P(omap_manager_test_t, internal_force_split)
583-
{
584-
run_async([this] {
585-
omap_root_t omap_root = initialize();
586-
587-
for (unsigned i = 0; i < 10; i++) {
588-
logger().debug("opened split transaction");
589-
auto t = create_mutate_transaction();
590-
591-
for (unsigned j = 0; j < 80; ++j) {
592-
set_random_key(omap_root, *t);
593-
if ((i % 2 == 0) && (j % 50 == 0)) {
594-
check_mappings(omap_root, *t);
595-
}
596-
}
597-
logger().debug("submitting transaction i = {}", i);
598-
submit_transaction(std::move(t));
599-
}
600-
check_mappings(omap_root);
601-
});
602-
}
603-
604-
TEST_P(omap_manager_test_t, internal_force_merge_fullandbalanced)
605-
{
606-
run_async([this] {
607-
omap_root_t omap_root = initialize();
608-
609-
for (unsigned i = 0; i < 8; i++) {
610-
logger().debug("opened split transaction");
611-
auto t = create_mutate_transaction();
612-
613-
for (unsigned j = 0; j < 80; ++j) {
614-
set_random_key(omap_root, *t);
615-
if ((i % 2 == 0) && (j % 50 == 0)) {
616-
check_mappings(omap_root, *t);
617-
}
618-
}
619-
logger().debug("submitting transaction");
620-
submit_transaction(std::move(t));
621-
}
622-
auto mkeys = get_mapped_keys();
623-
auto t = create_mutate_transaction();
624-
for (unsigned i = 0; i < mkeys.size(); i++) {
625-
rm_key(omap_root, *t, mkeys[i]);
626-
627-
if (i % 10 == 0) {
628-
logger().debug("submitting transaction i= {}", i);
629-
submit_transaction(std::move(t));
630-
t = create_mutate_transaction();
631-
}
632-
if (i % 50 == 0) {
633-
logger().debug("check_mappings i= {}", i);
634-
check_mappings(omap_root, *t);
635-
check_mappings(omap_root);
636-
}
637-
}
638-
logger().debug("finally submitting transaction ");
639-
submit_transaction(std::move(t));
640-
check_mappings(omap_root);
641589
});
642590
}
643591

@@ -688,7 +636,6 @@ TEST_P(omap_manager_test_t, replay)
688636
});
689637
}
690638

691-
692639
TEST_P(omap_manager_test_t, internal_force_split_to_root)
693640
{
694641
run_async([this] {
@@ -780,11 +727,6 @@ TEST_P(omap_manager_test_t, omap_iterate)
780727
auto t = create_read_transaction();
781728
iterate(omap_root, *t, start_from, callback);
782729
}
783-
{
784-
auto t = create_mutate_transaction();
785-
clear(omap_root, *t);
786-
submit_transaction(std::move(t));
787-
}
788730
});
789731
}
790732

0 commit comments

Comments
 (0)