From: Sage Weil Date: Tue, 28 Apr 2015 16:30:32 +0000 (-0700) Subject: ceph_test_objectstore: test many small writes X-Git-Tag: v9.1.0~324^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=79da9d664f18bb0120e8392d894c8c9fd4363778;p=ceph.git ceph_test_objectstore: test many small writes This exercises the overlay code better. Signed-off-by: Sage Weil --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index cc45ee8e4e44..e6b4d8f55c72 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -402,6 +402,45 @@ TEST_P(StoreTest, SimpleObjectTest) { } } +TEST_P(StoreTest, ManySmallWrite) { + int r; + coll_t cid; + ghobject_t a(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); + ghobject_t b(hobject_t(sobject_t("Object 2", CEPH_NOSNAP))); + { + ObjectStore::Transaction t; + t.create_collection(cid, 0); + cerr << "Creating collection " << cid << std::endl; + r = store->apply_transaction(t); + ASSERT_EQ(r, 0); + } + bufferlist bl; + bufferptr bp(4096); + bp.zero(); + bl.append(bp); + for (int i=0; i<100; ++i) { + ObjectStore::Transaction t; + t.write(cid, a, i*4096, 4096, bl, 0); + r = store->apply_transaction(t); + ASSERT_EQ(r, 0); + } + for (int i=0; i<100; ++i) { + ObjectStore::Transaction t; + t.write(cid, b, (rand() % 1024)*4096, 4096, bl, 0); + r = store->apply_transaction(t); + ASSERT_EQ(r, 0); + } + { + ObjectStore::Transaction t; + t.remove(cid, a); + t.remove(cid, b); + t.remove_collection(cid); + cerr << "Cleaning" << std::endl; + r = store->apply_transaction(t); + ASSERT_EQ(r, 0); + } +} + TEST_P(StoreTest, SimpleAttrTest) { int r; coll_t cid;