Project

General

Profile

Bug #50926 ยป test.diff

test case for ceph_test_objectstore to repro the issue - Igor Fedotov, 05/21/2021 12:01 PM

View differences:

src/test/objectstore/store_test.cc
bstore->mount();
}
TEST_P(StoreTestSpecificAUSize, BluestoreZombiesOverwriteLegacyOmapRepairTest) {
if (string(GetParam()) != "bluestore")
return;
SetVal(g_conf(), "bluestore_fsck_on_mount", "false");
SetVal(g_conf(), "bluestore_fsck_on_umount", "false");
SetVal(g_conf(), "bluestore_fsck_error_on_no_per_pool_omap", "true");
SetVal(g_conf(), "bluestore_fsck_error_on_no_per_pg_omap", "true");
StartDeferred(0x10000);
BlueStore* bstore = dynamic_cast<BlueStore*> (store.get());
int r;
cerr << "initializing" << std::endl;
{
ObjectStore::CollectionHandle ch;
ghobject_t hoid;
unique_ptr<coll_t> cid;
auto pool = 123;
cid.reset(new coll_t(spg_t(pg_t(0, 123), shard_id_t::NO_SHARD)));
ch = store->create_new_collection(*cid);
hoid = make_object("objectname", pool);
{
ObjectStore::Transaction t;
t.create_collection(*cid, 0);
r = queue_transaction(store, ch, std::move(t));
ASSERT_EQ(r, 0);
}
cerr << "onode preparing" << std::endl;
{
bufferlist bl;
string s(0x1000, 'a');
bl.append(s);
map<string, bufferlist> omap;
omap["omap_key"].append("omap value");
ObjectStore::Transaction t;
t.write(*cid, hoid, bl.length(), bl.length(), bl);
t.omap_setkeys(*cid, hoid, omap);
r = queue_transaction(store, ch, std::move(t));
ASSERT_EQ(r, 0);
}
cerr << "Errors injection" << std::endl;
sleep(5);
bstore->inject_zombie_spanning_blob(*cid, hoid, 12345);
bstore->inject_legacy_omap(*cid, hoid);
cerr << "fscking/fixing" << std::endl;
bstore->umount();
ASSERT_EQ(bstore->fsck(false), 2);
ASSERT_LE(bstore->quick_fix(), 0);
ASSERT_EQ(bstore->fsck(false), 0);
}
cerr << "Completing" << std::endl;
bstore->mount();
}
TEST_P(StoreTest, BluestoreRepairGlobalStats) {
if (string(GetParam()) != "bluestore")
return;
    (1-1/1)