From: Igor Fedotov Date: Mon, 18 Jul 2022 16:00:40 +0000 (+0300) Subject: test/store_test: introduce a case to reproduce bug #56488 X-Git-Tag: v16.2.11~61^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1f461396a8fc444a06b6ab46396de963eb352663;p=ceph.git test/store_test: introduce a case to reproduce bug #56488 Signed-off-by: Igor Fedotov (cherry picked from commit 1000f8d8c85e486fd958abed4a03de05c054c484) Conflict: Modified l_bluestore_* perf names to pacific's names. Removed reference to smr. --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 0eb427b89b58..811a23b84c75 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -8213,6 +8213,66 @@ TEST_P(StoreTestSpecificAUSize, SmallWriteOnShardedExtents) { } } +TEST_P(StoreTestSpecificAUSize, ReproBug56488Test) { + + if (string(GetParam()) != "bluestore") + return; + + size_t alloc_size = 65536; + size_t write_size = 4096; + SetVal(g_conf(), "bluestore_debug_enforce_settings", "hdd"); + SetVal(g_conf(), "bluestore_block_db_create", "true"); + SetVal(g_conf(), "bluestore_block_db_size", stringify(1 << 30).c_str()); + + g_conf().apply_changes(nullptr); + StartDeferred(alloc_size); + + int r; + coll_t cid; + const PerfCounters* logger = store->get_perf_counters(); + + ObjectStore::CollectionHandle ch = store->create_new_collection(cid); + { + ObjectStore::Transaction t; + t.create_collection(cid, 0); + r = queue_transaction(store, ch, std::move(t)); + ASSERT_EQ(r, 0); + } + { + ghobject_t hoid(hobject_t("test", "", CEPH_NOSNAP, 0, -1, "")); + { + ObjectStore::Transaction t; + t.touch(cid, hoid); + r = queue_transaction(store, ch, std::move(t)); + ASSERT_EQ(r, 0); + } + + auto issued_dw = logger->get(l_bluestore_write_deferred); + auto issued_dw_bytes = logger->get(l_bluestore_write_deferred_bytes); + { + ObjectStore::Transaction t; + bufferlist bl; + bl.append(std::string(write_size, 'x')); + t.write(cid, hoid, 0, bl.length(), bl, + CEPH_OSD_OP_FLAG_FADVISE_NOCACHE); + r = queue_transaction(store, ch, std::move(t)); + ASSERT_EQ(r, 0); + } + ASSERT_EQ(logger->get(l_bluestore_write_deferred), issued_dw + 1); + ASSERT_EQ(logger->get(l_bluestore_write_deferred_bytes), + issued_dw_bytes + write_size); + } + { + ObjectStore::Transaction t; + ghobject_t hoid(hobject_t("test", "", CEPH_NOSNAP, 0, -1, "")); + t.remove(cid, hoid); + t.remove_collection(cid); + cerr << "Cleaning" << std::endl; + r = queue_transaction(store, ch, std::move(t)); + ASSERT_EQ(r, 0); + } +} + #endif //#if defined(WITH_BLUESTORE) TEST_P(StoreTest, KVDBHistogramTest) {