]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/store_test: add a simplified test for readv.
authorAdam Kupczyk <akupczyk@ibm.com>
Wed, 17 Apr 2024 11:17:17 +0000 (11:17 +0000)
committerIgor Fedotov <igor.fedotov@croit.io>
Fri, 19 Jul 2024 11:54:30 +0000 (14:54 +0300)
Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
(cherry picked from commit 8e3235975aff74bf5b3e0844661cd619fe6fc830)

src/test/objectstore/store_test.cc

index 338df03f23ace63379902df267e5b4b37df03172..e15d57afbd9eb47daccb7526bb2797bbd31c3336 100644 (file)
@@ -7464,6 +7464,59 @@ TEST_P(StoreTestSpecificAUSize, ManyManyExtents) {
   }
 }
 
+TEST_P(StoreTestSpecificAUSize, ManyManyExtents2) {
+
+  if (string(GetParam()) != "bluestore")
+    return;
+
+  size_t block_size = 4096;
+  StartDeferred(block_size);
+
+  int r;
+  coll_t cid;
+  ghobject_t hoid(hobject_t("test", "", CEPH_NOSNAP, 0, -1, ""));
+
+  auto ch = store->create_new_collection(cid);
+  {
+    ObjectStore::Transaction t;
+    t.create_collection(cid, 0);
+    r = queue_transaction(store, ch, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    bufferlist bl;
+    bl.append(std::string(1024 * 1024, 'a'));
+    t.write(cid, hoid, 0, bl.length(), bl, 0);
+    r = queue_transaction(store, ch, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+  ch.reset();
+  store->umount();
+  store->mount();
+  ch = store->open_collection(cid);
+  {
+    cerr << "reading in multiple chunks..." << std::endl;
+    bufferlist bl;
+    interval_set<uint64_t> im;
+    for (int i=0; i < 100000;i++) {
+      im.insert(i * 2, 1);
+    }
+    r = store->readv(ch, hoid, im, bl, 0);
+    ASSERT_EQ(r, 100000);
+    ASSERT_EQ(r, bl.length());
+  }
+  store->refresh_perf_counters();
+  {
+    ObjectStore::Transaction t;
+    t.remove(cid, hoid);
+    t.remove_collection(cid);
+    cerr << "Cleaning" << std::endl;
+    r = queue_transaction(store, ch, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+}
+
 TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionSmallAppend) {
   CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
   if (string(GetParam()) != "bluestore" || !cct->_conf->bluestore_zero_block_detection) {