test_filestore_idempotent: make newly created objects globally unique

The filestore requires hobjects to be globally unique.

Fixes: #5240
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Samuel Just 2013-06-04 09:49:06 -07:00
parent 8bbd0370c4
commit cdf5785c5e
2 changed files with 10 additions and 6 deletions

View File

@ -81,7 +81,7 @@ TestFileStoreState::coll_entry_t *TestFileStoreState::coll_create(int id)
memset(meta_buf, 0, 100);
snprintf(buf, 100, "0.%d_head", id);
snprintf(meta_buf, 100, "pglog_0.%d_head", id);
return (new coll_entry_t(id, buf, meta_buf));
return (new coll_entry_t(this, id, buf, meta_buf));
}
TestFileStoreState::coll_entry_t*
@ -168,7 +168,7 @@ hobject_t *TestFileStoreState::coll_entry_t::touch_obj(int id)
char buf[100];
memset(buf, 0, 100);
snprintf(buf, 100, "obj%d", id);
snprintf(buf, 100, "obj%d-%d", parent->m_next_object_id++, id);
hobject_t *obj = new hobject_t(sobject_t(object_t(buf), CEPH_NOSNAP));
m_objects.insert(make_pair(id, obj));

View File

@ -22,18 +22,21 @@
class TestFileStoreState {
public:
int m_next_object_id;
struct coll_entry_t {
TestFileStoreState *parent;
int m_next_object_id;
int m_id;
coll_t m_coll;
hobject_t m_meta_obj;
ObjectStore::Sequencer m_osr;
map<int, hobject_t*> m_objects;
int m_next_object_id;
coll_entry_t(int i, char *coll_buf, char *meta_obj_buf)
: m_id(i), m_coll(coll_buf),
coll_entry_t(TestFileStoreState *parent,
int i, char *coll_buf, char *meta_obj_buf)
: parent(parent), m_next_object_id(0), m_id(i), m_coll(coll_buf),
m_meta_obj(sobject_t(object_t(meta_obj_buf), CEPH_NOSNAP)),
m_osr(coll_buf), m_next_object_id(0) {
m_osr(coll_buf) {
}
~coll_entry_t();
@ -92,6 +95,7 @@ public:
public:
TestFileStoreState(FileStore *store) :
m_next_object_id(0),
m_next_coll_nr(0), m_num_objs_per_coll(10),
m_max_in_flight(0), m_finished_lock("Finished Lock") {
m_in_flight.set(0);