From: Sage Weil Date: Tue, 10 Oct 2017 16:24:06 +0000 (-0500) Subject: ceph_test_objectstore: flush() before collection_list() X-Git-Tag: v13.0.2~743^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8dae6d198e442f660d97b9bfcf05fcb1af95b2d5;p=ceph.git ceph_test_objectstore: flush() before collection_list() The one exception to the "immediately readable" it collection_list, which is not readable until the kv transaction is applied. Our choices are 1. Wait until kv to apply to trigger onreadable (for any create/remove ops). This wipes away much of the benefit of fully sync onreadable. 2. Add tracking for created/removed objects in BlueStore so that we can incorporate those into collection_list. This is complex. 3. flush() from collection_list. Unfortunately we don't have osr linked to Collection, so this doesn't quite work with the current ObjectStore interface. 4. Require the caller flush() before list and put a big * next to the "immediately onreadable" claim. It turns out that because of FileStore, the OSD already does flush() before collection_list anyway, so this does not require any actual change... except to store_test tests. (This didn't affect filestore because store_test is using apply_transaction, which waits for readable, and on filestore that also implies visible by collection_list.) Signed-off-by: Sage Weil --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index f34eb8b44ec..fb07b695274 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -2465,6 +2465,7 @@ TEST_P(StoreTest, SimpleListTest) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } + osr.flush(); { set saw; vector objects; @@ -2529,6 +2530,7 @@ TEST_P(StoreTest, ListEndTest) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } + osr.flush(); { ghobject_t end(hobject_t(sobject_t("object_100", CEPH_NOSNAP)), ghobject_t::NO_GEN, shard_id_t(1)); @@ -2611,6 +2613,7 @@ TEST_P(StoreTest, MultipoolListTest) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } + osr.flush(); { vector objects; ghobject_t next, current; @@ -3276,6 +3279,8 @@ TEST_P(StoreTest, ManyObjectTest) { ASSERT_TRUE(!store->stat(cid, *i, &buf)); } + osr.flush(); + set listed, listed2; vector objects; r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); @@ -3533,6 +3538,7 @@ public: } void shutdown() { while (1) { + osr->flush(); vector objects; int r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), 10, &objects, 0); @@ -4140,6 +4146,7 @@ public: EnterExit ee("scan"); while (in_flight) cond.Wait(lock); + osr->flush(); vector objects; set objects_set, objects_set2; ghobject_t next, current; @@ -4563,6 +4570,7 @@ TEST_P(StoreTest, HashCollisionTest) { } } vector objects; + osr.flush(); r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); ASSERT_EQ(r, 0); set listed(objects.begin(), objects.end()); @@ -4660,6 +4668,7 @@ TEST_P(StoreTest, ScrubTest) { ASSERT_EQ(r, 0); } + osr.flush(); vector objects; r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); @@ -5134,6 +5143,7 @@ void colsplittest( ASSERT_EQ(r, 0); } + osr.flush(); ObjectStore::Transaction t; vector objects; r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), @@ -5154,6 +5164,7 @@ void colsplittest( } } + osr.flush(); objects.clear(); r = store->collection_list(tid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); @@ -5431,6 +5442,8 @@ TEST_P(StoreTest, BigRGWObjectName) { ASSERT_EQ(r, 0); } + osr.flush(); + { vector objects; r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(),