From 255432e7777302887da241c707690194a89abe09 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 19 Oct 2016 14:13:20 -0400 Subject: [PATCH] unittest_bluestore_types: add random put_ref test case This appeared to fail under load, but works fine here. :/ Signed-off-by: Sage Weil --- src/test/objectstore/test_bluestore_types.cc | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/objectstore/test_bluestore_types.cc b/src/test/objectstore/test_bluestore_types.cc index de1abebb879..66dd499fbf7 100644 --- a/src/test/objectstore/test_bluestore_types.cc +++ b/src/test/objectstore/test_bluestore_types.cc @@ -692,6 +692,27 @@ TEST(Blob, put_ref) ASSERT_TRUE(b.extents[0].is_valid()); ASSERT_EQ(mas*4, b.extents[0].length); } + { + BlueStore::Blob B; + B.shared_blob = new BlueStore::SharedBlob(-1, string(), nullptr); + B.shared_blob->get(); // hack to avoid dtor from running + bluestore_blob_t& b = B.dirty_blob(); + B.ref_map.get(0x0, 0x3800); + B.ref_map.get(0x17c00, 0x6400); + b.extents.push_back(bluestore_pextent_t(0x40101000, 0x4000)); + b.extents.push_back(bluestore_pextent_t(bluestore_pextent_t::INVALID_OFFSET, + 0x13000)); + b.extents.push_back(bluestore_pextent_t(0x40118000, 0x7000)); + b.set_flag(bluestore_blob_t::FLAG_SHARED); + b.init_csum(bluestore_blob_t::CSUM_CRC32C, 12, 0x1e000); + b.sbid = 0xcf92e; + + cout << "before: " << B << std::endl; + vector r; + B.put_ref(0x1800, 0x2000, 0x1000, &r); + cout << "after: " << B << std::endl; + cout << "r " << r << std::endl; + } } TEST(bluestore_blob_t, can_split)