From 462bad3221d0e2e2f00a0e98856ebf09f9dc1c95 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 3 Dec 2014 07:35:01 -0800 Subject: [PATCH] ceph_test_rados: generate mix of small and large xattrs This ensures that we exercise the large xattr handling paths in the OSD. (Specifically, we want to trigger DBObjectMap usage on EC objects so that we can test the fix for #10171). Signed-off-by: Sage Weil --- src/test/osd/Object.h | 12 +++++++++--- src/test/osd/RadosModel.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/test/osd/Object.h b/src/test/osd/Object.h index 59b492f81e26..bffb397cfb66 100644 --- a/src/test/osd/Object.h +++ b/src/test/osd/Object.h @@ -218,22 +218,28 @@ public: class AttrGenerator : public RandGenerator { uint64_t max_len; + uint64_t big_max_len; public: - AttrGenerator(uint64_t max_len) : max_len(max_len) {} + AttrGenerator(uint64_t max_len, uint64_t big_max_len) + : max_len(max_len), big_max_len(big_max_len) {} void get_ranges_map( const ContDesc &cont, map &out) { out.insert(pair(0, get_length(cont))); } uint64_t get_length(const ContDesc &in) { RandWrap rand(in.seqnum); - return (rand() % max_len); + // make some attrs big + if (in.seqnum & 3) + return (rand() % max_len); + else + return (rand() % big_max_len); } bufferlist gen_bl(const ContDesc &in) { bufferlist bl; for (iterator i = get_iterator(in); !i.end(); ++i) { bl.append(*i); } - assert(bl.length() < max_len); + assert(bl.length() < big_max_len); return bl; } }; diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index 5a026b29d104..a80c10570640 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -205,7 +205,7 @@ public: rados_id(id), initialized(false), max_size(max_size), min_stride_size(min_stride_size), max_stride_size(max_stride_size), - attr_gen(2000), + attr_gen(2000, 20000), no_omap(no_omap), pool_snaps(pool_snaps), snapname_num(0) -- 2.47.3