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: v17.2.6~280^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=67f14064a5b98542316ce2efff910513665785a4;p=ceph.git test/store_test: introduce a case to reproduce bug #56488 Signed-off-by: Igor Fedotov (cherry picked from commit 1000f8d8c85e486fd958abed4a03de05c054c484) --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index dd95a0bc10875..670dddd610f25 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -8664,6 +8664,70 @@ TEST_P(StoreTestSpecificAUSize, SmallWriteOnShardedExtents) { } } +TEST_P(StoreTestSpecificAUSize, ReproBug56488Test) { + + if (string(GetParam()) != "bluestore") + return; + if (smr) { + cout << "SKIP: no deferred" << std::endl; + 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_issued_deferred_writes); + auto issued_dw_bytes = logger->get(l_bluestore_issued_deferred_write_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_issued_deferred_writes), issued_dw + 1); + ASSERT_EQ(logger->get(l_bluestore_issued_deferred_write_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) {