]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/crimson/seastore/test_btree_lba_manager: test mutate_mapping on more split/merge...
authorSamuel Just <sjust@redhat.com>
Thu, 22 Oct 2020 23:07:06 +0000 (16:07 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 22 Oct 2020 23:07:06 +0000 (16:07 -0700)
incref_mapping has a slightly different relationship with merge than
decref_mapping, update split/merge test to ensure that we call into
mutate_mapping at each step as the nodes fill, split, empty, and merge.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/test/crimson/seastore/test_btree_lba_manager.cc

index d0063a64ef817ab354f19d1f99494dd6b784c8e7..06736f5cc6bcb542c479999718ea4e8d10339e9c 100644 (file)
@@ -229,6 +229,12 @@ struct btree_lba_manager_test :
     }
   }
 
+  auto incref_mapping(
+    test_transaction_t &t,
+    laddr_t addr) {
+    return incref_mapping(t, t.mappings.find(addr));
+  }
+
   void incref_mapping(
     test_transaction_t &t,
     test_lba_mapping_t::iterator target) {
@@ -337,6 +343,8 @@ TEST_F(btree_lba_manager_test, force_split_merge)
          check_mappings(t);
          check_mappings();
        }
+       incref_mapping(t, ret->get_laddr());
+       decref_mapping(t, ret->get_laddr());
       }
       logger().debug("submitting transaction");
       submit_test_transaction(std::move(t));
@@ -344,23 +352,39 @@ TEST_F(btree_lba_manager_test, force_split_merge)
        check_mappings();
       }
     }
-    auto addresses = get_mapped_addresses();
-    auto t = create_transaction();
-    for (unsigned i = 0; i != addresses.size(); ++i) {
-      if (i % 2 == 0) {
-       decref_mapping(t, addresses[i]);
-      }
-      logger().debug("submitting transaction");
-      if (i % 7 == 0) {
-       submit_test_transaction(std::move(t));
-       t = create_transaction();
+    {
+      auto addresses = get_mapped_addresses();
+      auto t = create_transaction();
+      for (unsigned i = 0; i != addresses.size(); ++i) {
+       if (i % 2 == 0) {
+         incref_mapping(t, addresses[i]);
+         decref_mapping(t, addresses[i]);
+         decref_mapping(t, addresses[i]);
+       }
+       logger().debug("submitting transaction");
+       if (i % 7 == 0) {
+         submit_test_transaction(std::move(t));
+         t = create_transaction();
+       }
+       if (i % 13 == 0) {
+         check_mappings();
+         check_mappings(t);
+       }
       }
-      if (i % 13 == 0) {
-       check_mappings();
-       check_mappings(t);
+      submit_test_transaction(std::move(t));
+    }
+    {
+      auto addresses = get_mapped_addresses();
+      auto t = create_transaction();
+      for (unsigned i = 0; i != addresses.size(); ++i) {
+       incref_mapping(t, addresses[i]);
+       decref_mapping(t, addresses[i]);
+       decref_mapping(t, addresses[i]);
       }
+      check_mappings(t);
+      submit_test_transaction(std::move(t));
+      check_mappings();
     }
-    submit_test_transaction(std::move(t));
   });
 }