From: Sage Weil Date: Tue, 17 Dec 2013 00:52:35 +0000 (-0800) Subject: ceph_test_rados_api_tier: fix HitSetRead test race with split X-Git-Tag: v0.75~94 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5bccfef88f490f934febc809a7c0d32eda3a6bf;p=ceph.git ceph_test_rados_api_tier: fix HitSetRead test race with split Recalculate the hash on each iteration in case we are racing with split. Fixes: #7013 Signed-off-by: Sage Weil --- diff --git a/src/test/librados/tier.cc b/src/test/librados/tier.cc index a0567395dcfb..ceac496986a1 100644 --- a/src/test/librados/tier.cc +++ b/src/test/librados/tier.cc @@ -146,11 +146,6 @@ TEST(LibRadosMisc, HitSetRead) { // wait for maps to settle cluster.wait_for_latest_osdmap(); - string name = "foo"; - uint32_t hash = ioctx.get_object_hash_position(name); - hobject_t oid(sobject_t(name, CEPH_NOSNAP), "", hash, - cluster.pool_lookup(pool_name.c_str()), ""); - // keep reading until we see our object appear in the HitSet utime_t start = ceph_clock_now(NULL); utime_t hard_stop = start + utime_t(600, 0); @@ -159,6 +154,11 @@ TEST(LibRadosMisc, HitSetRead) { utime_t now = ceph_clock_now(NULL); ASSERT_TRUE(now < hard_stop); + string name = "foo"; + uint32_t hash = ioctx.get_object_hash_position(name); + hobject_t oid(sobject_t(name, CEPH_NOSNAP), "", hash, + cluster.pool_lookup(pool_name.c_str()), ""); + bufferlist bl; ASSERT_EQ(-ENOENT, ioctx.read("foo", bl, 1, 0));