]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_test_rados_api_tier: fix HitSetRead test race with split
authorSage Weil <sage@inktank.com>
Tue, 17 Dec 2013 00:52:35 +0000 (16:52 -0800)
committerSage Weil <sage@inktank.com>
Tue, 17 Dec 2013 00:52:35 +0000 (16:52 -0800)
Recalculate the hash on each iteration in case we are racing with split.

Fixes: #7013
Signed-off-by: Sage Weil <sage@inktank.com>
src/test/librados/tier.cc

index a0567395dcfb13e600490e2ef7bbb1a4efc778ca..ceac496986a1468846df1df2023d079396f95883 100644 (file)
@@ -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));