From: Xinyu Huang Date: Fri, 9 Sep 2022 15:46:15 +0000 (+0000) Subject: crimson/os/seastore/omap: add tests to range list X-Git-Tag: v18.1.0~647^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=47b32017b914b7b3be30b63f9660ebedbcc27664;p=ceph.git crimson/os/seastore/omap: add tests to range list Signed-off-by: Xinyu Huang --- diff --git a/src/test/crimson/seastore/test_omap_manager.cc b/src/test/crimson/seastore/test_omap_manager.cc index c6e4601a2c8f..a571500e4c92 100644 --- a/src/test/crimson/seastore/test_omap_manager.cc +++ b/src/test/crimson/seastore/test_omap_manager.cc @@ -391,14 +391,21 @@ TEST_F(omap_manager_test_t, force_split_listkeys_list_clear) run_async([this] { omap_root_t omap_root = initialize(); - string temp; + string first, last; for (unsigned i = 0; i < 40; i++) { auto t = create_mutate_transaction(); logger().debug("opened transaction"); for (unsigned j = 0; j < 10; ++j) { auto key = set_random_key(omap_root, *t); - if (i == 10) - temp = key; + if (i == 10) { + first = key; + } + if (i == 30) { + last = key; + if (first > last) { + std::swap(first, last); + } + } if ((i % 20 == 0) && (j == 5)) { check_mappings(omap_root, *t); } @@ -408,19 +415,41 @@ TEST_F(omap_manager_test_t, force_split_listkeys_list_clear) check_mappings(omap_root); } + std::optional first_temp; + std::optional last_temp; + { + auto t = create_read_transaction(); + first_temp = std::nullopt; + last_temp = std::nullopt; + list(omap_root, *t, first_temp, last_temp); + } + + { + auto t = create_read_transaction(); + first_temp = first; + last_temp = std::nullopt; + list(omap_root, *t, first_temp, last_temp, 100); + } + { auto t = create_read_transaction(); - list(omap_root, *t, std::nullopt, std::nullopt); + first_temp = first; + last_temp = std::nullopt; + list(omap_root, *t, first_temp, last_temp, 100, true); } { auto t = create_read_transaction(); - list(omap_root, *t, temp, std::nullopt, 100); + first_temp = std::nullopt; + last_temp = last; + list(omap_root, *t, first_temp, last_temp, 10240); } { auto t = create_read_transaction(); - list(omap_root, *t, temp, std::nullopt, 100, true); + first_temp = first; + last_temp = last; + list(omap_root, *t, first_temp, last_temp, 10240, true); } { @@ -436,29 +465,54 @@ TEST_F(omap_manager_test_t, force_inner_node_split_list) run_async([this] { omap_root_t omap_root = initialize(); - string temp = ""; + string first = ""; + string last; while (cache->get_omap_tree_depth() < 3) { for (unsigned i = 0; i < 40; i++) { auto t = create_mutate_transaction(); logger().debug("opened transaction"); for (unsigned j = 0; j < 10; ++j) { auto key = set_random_key(omap_root, *t); - if (key.compare(temp) < 0 || !temp.length()) - temp = key; + if (key.compare(first) < 0 || !first.length()) { + first = key; + } + if (i == 10) { + last = key; + } } logger().debug("force split submit transaction i = {}", i); submit_transaction(std::move(t)); } } + std::optional first_temp; + std::optional last_temp; + { + auto t = create_read_transaction(); + first_temp = first; + last_temp = std::nullopt; + list(omap_root, *t, first_temp, last_temp, 10240); + } + + { + auto t = create_read_transaction(); + first_temp = first; + last_temp = std::nullopt; + list(omap_root, *t, first_temp, last_temp, 10240, true); + } + { auto t = create_read_transaction(); - list(omap_root, *t, temp, std::nullopt, 10240); + first_temp = std::nullopt; + last_temp = last; + list(omap_root, *t, first_temp, last_temp, 10240); } { auto t = create_read_transaction(); - list(omap_root, *t, temp, std::nullopt, 10240, true); + first_temp = first; + last_temp = last; + list(omap_root, *t, first_temp, last_temp, 10240, true); } {