Skip to content

Commit 8e32359

Browse files
aclamkifed01
authored andcommitted
test/store_test: add a simplified test for readv.
Signed-off-by: Adam Kupczyk <[email protected]>
1 parent 8238b60 commit 8e32359

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/test/objectstore/store_test.cc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7830,6 +7830,59 @@ TEST_P(StoreTestSpecificAUSize, ManyManyExtents) {
78307830
}
78317831
}
78327832

7833+
TEST_P(StoreTestSpecificAUSize, ManyManyExtents2) {
7834+
7835+
if (string(GetParam()) != "bluestore")
7836+
return;
7837+
7838+
size_t block_size = 4096;
7839+
StartDeferred(block_size);
7840+
7841+
int r;
7842+
coll_t cid;
7843+
ghobject_t hoid(hobject_t("test", "", CEPH_NOSNAP, 0, -1, ""));
7844+
7845+
auto ch = store->create_new_collection(cid);
7846+
{
7847+
ObjectStore::Transaction t;
7848+
t.create_collection(cid, 0);
7849+
r = queue_transaction(store, ch, std::move(t));
7850+
ASSERT_EQ(r, 0);
7851+
}
7852+
{
7853+
ObjectStore::Transaction t;
7854+
bufferlist bl;
7855+
bl.append(std::string(1024 * 1024, 'a'));
7856+
t.write(cid, hoid, 0, bl.length(), bl, 0);
7857+
r = queue_transaction(store, ch, std::move(t));
7858+
ASSERT_EQ(r, 0);
7859+
}
7860+
ch.reset();
7861+
store->umount();
7862+
store->mount();
7863+
ch = store->open_collection(cid);
7864+
{
7865+
cerr << "reading in multiple chunks..." << std::endl;
7866+
bufferlist bl;
7867+
interval_set<uint64_t> im;
7868+
for (int i=0; i < 100000;i++) {
7869+
im.insert(i * 2, 1);
7870+
}
7871+
r = store->readv(ch, hoid, im, bl, 0);
7872+
ASSERT_EQ(r, 100000);
7873+
ASSERT_EQ(r, bl.length());
7874+
}
7875+
store->refresh_perf_counters();
7876+
{
7877+
ObjectStore::Transaction t;
7878+
t.remove(cid, hoid);
7879+
t.remove_collection(cid);
7880+
cerr << "Cleaning" << std::endl;
7881+
r = queue_transaction(store, ch, std::move(t));
7882+
ASSERT_EQ(r, 0);
7883+
}
7884+
}
7885+
78337886
TEST_P(StoreTestSpecificAUSize, ZeroBlockDetectionSmallAppend) {
78347887
CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
78357888
if (string(GetParam()) != "bluestore" || !cct->_conf->bluestore_zero_block_detection) {

0 commit comments

Comments
 (0)