diff options
author | Samuel Just <sam.just@inktank.com> | 2013-06-04 09:49:06 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-06-04 10:37:34 -0700 |
commit | cdf5785c5e8b744f35ea34b2deb2a71edf8b9580 (patch) | |
tree | f9a78589bb7f815d0296ee638cba03b3e2e48d55 | |
parent | 8bbd0370c4ffc254bc82fbcf57aee2a9824b409e (diff) | |
download | ceph-cdf5785c5e8b744f35ea34b2deb2a71edf8b9580.tar.gz |
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>
-rw-r--r-- | src/test/filestore/TestFileStoreState.cc | 4 | ||||
-rw-r--r-- | src/test/filestore/TestFileStoreState.h | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/test/filestore/TestFileStoreState.cc b/src/test/filestore/TestFileStoreState.cc index c786f87f268..9f0d6916c0a 100644 --- a/src/test/filestore/TestFileStoreState.cc +++ b/src/test/filestore/TestFileStoreState.cc @@ -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)); diff --git a/src/test/filestore/TestFileStoreState.h b/src/test/filestore/TestFileStoreState.h index d3bba692437..b58d2db5e23 100644 --- a/src/test/filestore/TestFileStoreState.h +++ b/src/test/filestore/TestFileStoreState.h @@ -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); |