Skip to content

Commit

Permalink
test/objectstore/TestObjectStoreState: make objects match collection
Browse files Browse the repository at this point in the history
- start pool at 1
- make hash fall within pg (just match it for now)

Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Feb 6, 2018
1 parent ab67958 commit c58bd9c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/test/objectstore/DeterministicOpSequence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/test/objectstore/FileStoreDiff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/test/objectstore/TestObjectStoreState.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/test/objectstore/TestObjectStoreState.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class TestObjectStoreState {
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();

Expand Down

0 comments on commit c58bd9c

Please sign in to comment.