]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/crimson/seastore: test if lazy read work correctly 53951/head
authorXinyu Huang <xinyu.huang@intel.com>
Fri, 26 May 2023 11:05:08 +0000 (11:05 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 11 Oct 2023 11:40:57 +0000 (11:40 +0000)
Signed-off-by: Xinyu Huang <xinyu.huang@intel.com>
(cherry picked from commit 9d973efe32c089351ec756232d3699b4c9fe1f64)

src/test/crimson/seastore/test_transaction_manager.cc

index 82ec48829b1a9ce96391fa8f3d05170698956030..d9e0ecad167b12950c8b0439585356d104242251 100644 (file)
@@ -1895,6 +1895,48 @@ TEST_P(tm_single_device_test_t, find_hole_assert_trigger)
   });
 }
 
+TEST_P(tm_single_device_test_t, remap_lazy_read) 
+{
+  constexpr laddr_t offset = 0;
+  constexpr size_t length = 256 << 10;
+   run_async([this, offset] {
+    {
+      auto t = create_transaction();
+      auto extent = alloc_extent(
+       t,
+       offset,
+       length,
+       'a');
+      ASSERT_EQ(offset, extent->get_laddr());
+      check_mappings(t);
+      submit_transaction(std::move(t));
+      check();
+    }
+    replay();
+    {
+      auto t = create_transaction();
+      auto pin = get_pin(t, offset);
+      auto rpin = remap_pin(t, std::move(pin), 0, 128 << 10);
+      check_mappings(t);
+      submit_transaction(std::move(t));
+      check();
+    }
+    replay();
+    {
+      auto t = create_transaction();
+      auto pin = get_pin(t, offset);
+      bufferlist bl;
+      bl.append(ceph::bufferptr(ceph::buffer::create(64 << 10, 0)));
+      auto [lpin, ext, rpin] = overwrite_pin(
+        t, std::move(pin), 4 << 10 , 64 << 10, bl);
+      check_mappings(t);
+      submit_transaction(std::move(t));
+      check();
+    }
+    replay();
+   });
+}
+
 TEST_P(tm_single_device_test_t, random_writes_concurrent)
 {
   test_random_writes_concurrent();
@@ -1919,18 +1961,22 @@ TEST_P(tm_single_device_test_t, test_remap_pin)
 {
   test_remap_pin();
 }
+
 TEST_P(tm_single_device_test_t, test_overwrite_pin)
 {
   test_overwrite_pin();
 }
+
 TEST_P(tm_single_device_test_t, test_remap_pin_concurrent)
 {
   test_remap_pin_concurrent();
 }
+
 TEST_P(tm_single_device_test_t, test_overwrite_pin_concurrent)
 {
   test_overwrite_pin_concurrent();
 }
+
 INSTANTIATE_TEST_SUITE_P(
   transaction_manager_test,
   tm_single_device_test_t,