From c58bd9c1bcd200cf9549309c79399223a9bf3322 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 5 Feb 2018 11:59:09 -0600 Subject: [PATCH] test/objectstore/TestObjectStoreState: make objects match collection - start pool at 1 - make hash fall within pg (just match it for now) Signed-off-by: Sage Weil --- src/test/objectstore/DeterministicOpSequence.cc | 2 +- src/test/objectstore/FileStoreDiff.cc | 4 +++- src/test/objectstore/TestObjectStoreState.cc | 4 +++- src/test/objectstore/TestObjectStoreState.h | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/test/objectstore/DeterministicOpSequence.cc b/src/test/objectstore/DeterministicOpSequence.cc index 8f4cb49481c1d..6e59b502ffba4 100644 --- a/src/test/objectstore/DeterministicOpSequence.cc +++ b/src/test/objectstore/DeterministicOpSequence.cc @@ -380,7 +380,7 @@ bool DeterministicOpSequence::do_coll_move(rngen_t& gen) bool DeterministicOpSequence::do_coll_create(rngen_t& gen) { int i = m_collections.size(); - spg_t pgid(pg_t(i, 0), shard_id_t::NO_SHARD); + spg_t pgid(pg_t(i, 1), shard_id_t::NO_SHARD); coll_t cid(pgid); auto ch = m_store->create_new_collection(cid); coll_entry_t *entry = coll_create(pgid, ch); diff --git a/src/test/objectstore/FileStoreDiff.cc b/src/test/objectstore/FileStoreDiff.cc index c8126cf81ebb1..e68485701102f 100644 --- a/src/test/objectstore/FileStoreDiff.cc +++ b/src/test/objectstore/FileStoreDiff.cc @@ -153,9 +153,11 @@ bool FileStoreDiff::diff_objects(FileStore *a_store, FileStore *b_store, coll_t } if (b_objects.size() != a_objects.size()) { - cout << "diff_objects num objs mismatch (A: " << a_objects.size() + cout << "diff_objects " << coll << " num objs mismatch (A: " << a_objects.size() << ", B: " << b_objects.size() << ")" << std::endl; ret = true; + cout << "a: " << a_objects << std::endl; + cout << "b: " << b_objects << std::endl; } auto a_ch = a_store->open_collection(coll); diff --git a/src/test/objectstore/TestObjectStoreState.cc b/src/test/objectstore/TestObjectStoreState.cc index 79c9c30f5c21d..f52bfb5b738ab 100644 --- a/src/test/objectstore/TestObjectStoreState.cc +++ b/src/test/objectstore/TestObjectStoreState.cc @@ -43,7 +43,7 @@ void TestObjectStoreState::init(int colls, int objs) int baseid = 0; for (int i = 0; i < colls; i++) { - spg_t pgid(pg_t(i, 0), shard_id_t::NO_SHARD); + spg_t pgid(pg_t(i, 1), shard_id_t::NO_SHARD); coll_t cid(pgid); auto ch = m_store->create_new_collection(cid); coll_entry_t *entry = coll_create(pgid, ch); @@ -181,6 +181,8 @@ hobject_t *TestObjectStoreState::coll_entry_t::touch_obj(int id) snprintf(buf, 100, "obj%d", id); hobject_t *obj = new hobject_t(sobject_t(object_t(buf), CEPH_NOSNAP)); + obj->set_hash(m_pgid.ps()); + obj->pool = m_pgid.pool(); m_objects.insert(make_pair(id, obj)); dout(5) << "touch_obj coll id " << m_cid << " name " << buf << dendl; diff --git a/src/test/objectstore/TestObjectStoreState.h b/src/test/objectstore/TestObjectStoreState.h index 30d65cb45dc85..0d07bc2249b0d 100644 --- a/src/test/objectstore/TestObjectStoreState.h +++ b/src/test/objectstore/TestObjectStoreState.h @@ -39,6 +39,8 @@ public: m_meta_obj(hobject_t(sobject_t(object_t(meta_obj_buf), CEPH_NOSNAP))), m_ch(ch), m_next_object_id(0) { + m_meta_obj.hobj.pool = m_pgid.pool(); + m_meta_obj.hobj.set_hash(m_pgid.ps()); } ~coll_entry_t(); -- 2.39.5