From: Sage Weil Date: Sat, 29 Mar 2014 23:58:38 +0000 (-0700) Subject: ceph_test_rados_api_tier: improve cache tier + scrub test X-Git-Tag: v0.79~54 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c3292e48483d861148322590ea1f05afd28cc2d3;p=ceph.git ceph_test_rados_api_tier: improve cache tier + scrub test Create lots of objects and make *some* of them be missing clones but not all. Signed-off-by: Sage Weil --- diff --git a/src/test/librados/tier.cc b/src/test/librados/tier.cc index 4bab8958a1fca..c05bbf4f55e62 100644 --- a/src/test/librados/tier.cc +++ b/src/test/librados/tier.cc @@ -357,24 +357,6 @@ TEST_F(LibRadosTwoPoolsPP, PromoteSnap) { ioctx.snap_set_read(my_snaps[0]); - // stop and scrub this pg (to make sure scrub can handle missing - // clones in the cache tier) - { - IoCtx cache_ioctx; - ASSERT_EQ(0, cluster.ioctx_create(cache_pool_name.c_str(), cache_ioctx)); - ostringstream ss; - ss << "{\"prefix\": \"pg scrub\", \"pgid\": \"" - << cache_ioctx.get_id() << "." - << ioctx.get_object_pg_hash_position("foo") - << "\"}"; - ASSERT_EQ(0, cluster.mon_command(ss.str(), inbl, NULL, NULL)); - - // give it a few seconds to go. this is sloppy but is usually enough time - cout << "waiting for scrub..." << std::endl; - sleep(15); - cout << "done waiting" << std::endl; - } - // read foo snap { bufferlist bl; @@ -432,6 +414,98 @@ TEST_F(LibRadosTwoPoolsPP, PromoteSnap) { cluster.wait_for_latest_osdmap(); } +TEST_F(LibRadosTwoPoolsPP, PromoteSnapScrub) { + int num = 100; + + // create objects + for (int i=0; i my_snaps(1); + ASSERT_EQ(0, ioctx.selfmanaged_snap_create(&my_snaps[0])); + ASSERT_EQ(0, ioctx.selfmanaged_snap_set_write_ctx(my_snaps[0], + my_snaps)); + for (int i=0; i num - 3) { + bufferlist bl; + ASSERT_EQ(1, ioctx.read(string("foo") + stringify(i), bl, 1, 0)); + ASSERT_EQ('c', bl[0]); + } + } + + ioctx.snap_set_read(my_snaps[0]); + + // stop and scrub this pool (to make sure scrub can handle missing + // clones in the cache tier). + { + IoCtx cache_ioctx; + ASSERT_EQ(0, cluster.ioctx_create(cache_pool_name.c_str(), cache_ioctx)); + for (int i=0; i<10; ++i) { + ostringstream ss; + ss << "{\"prefix\": \"pg scrub\", \"pgid\": \"" + << cache_ioctx.get_id() << "." << i + << "\"}"; + cluster.mon_command(ss.str(), inbl, NULL, NULL); + } + + // give it a few seconds to go. this is sloppy but is usually enough time + cout << "waiting for scrubs..." << std::endl; + sleep(30); + cout << "done waiting" << std::endl; + } + + ioctx.snap_set_read(librados::SNAP_HEAD); + + // tear down tiers + ASSERT_EQ(0, cluster.mon_command( + "{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name + + "\"}", + inbl, NULL, NULL)); + ASSERT_EQ(0, cluster.mon_command( + "{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name + + "\", \"tierpool\": \"" + cache_pool_name + "\"}", + inbl, NULL, NULL)); + + // wait for maps to settle before next test + cluster.wait_for_latest_osdmap(); +} + + TEST_F(LibRadosTwoPoolsPP, PromoteSnapTrimRace) { // create object {