From: Sage Weil Date: Thu, 17 Dec 2015 19:15:48 +0000 (-0500) Subject: ceph_test_objectstore: use a few hash values for objects; clone between them X-Git-Tag: v10.0.3~154^2~80 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eeb2251ebe38e4fba203c9f3bfcc3d7680e7a0b9;p=ceph.git ceph_test_objectstore: use a few hash values for objects; clone between them We only guarantee support for clone between objects with the same hash. Signed-off-by: Sage Weil --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 6c5aeb175b9..75c71eba55f 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -1468,20 +1468,12 @@ public: char buf[100]; snprintf(buf, sizeof(buf), "OBJ_%u", seq); string name(buf); - - /* - boost::uniform_int<> true_false(0, 1); - if (true_false(*gen)) { - // long - for (int i = 0; i < 100; ++i) name.append("aaaaa"); - } else if (true_false(*gen)) { - name = "DIR_" + name; - }*/ - - // hash - //boost::binomial_distribution bin(0xFFFFFF, 0.5); ++seq; - return ghobject_t(hobject_t(name, string(), rand() & 2 ? CEPH_NOSNAP : rand(), rand() & 0xFF, poolid, "")); + return ghobject_t( + hobject_t( + name, string(), rand() & 2 ? CEPH_NOSNAP : rand(), + seq % 16, // use smaller set of hash values so clone can work + poolid, "")); } }; @@ -1709,6 +1701,8 @@ public: } while (--max && !contents[old_obj].data.length()); available_objects.erase(old_obj); ghobject_t new_obj = object_gen->create_object(rng); + // make the hash match + new_obj.hobj.set_hash(old_obj.hobj.get_hash()); available_objects.erase(new_obj); ObjectStore::Transaction *t = new ObjectStore::Transaction;