]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_filestore_idempotent: make newly created objects globally unique
authorSamuel Just <sam.just@inktank.com>
Tue, 4 Jun 2013 16:49:06 +0000 (09:49 -0700)
committerSamuel Just <sam.just@inktank.com>
Tue, 4 Jun 2013 17:37:34 +0000 (10:37 -0700)
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>
src/test/filestore/TestFileStoreState.cc
src/test/filestore/TestFileStoreState.h

index c786f87f268268c216e8b82cf8e13c5a51d8ac70..9f0d6916c0acd4f8a01adc40645adacd27864aa7 100644 (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));
index d3bba692437100cc7c36a459eb6e139ce76d028f..b58d2db5e23928c1e68f892939981e7e9c27d743 100644 (file)
 
 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);