]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MemStore: Need set/get_allow_sharded_objects() to work for ceph_objectstore_tool 2639/head
authorDavid Zafman <dzafman@redhat.com>
Fri, 3 Oct 2014 22:09:30 +0000 (15:09 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 3 Oct 2014 22:15:11 +0000 (15:15 -0700)
Keep a bool sharded in memory and use for set/get_allow_sharded_objects()
Create a file "sharded" in the data dir when sharded is true during _save()
Check for file "sharded" during _load()

Fixes: #9661
Signed-off-by: David Zafman <dzafman@redhat.com>
src/os/MemStore.cc
src/os/MemStore.h

index 6743916b2000b8b98d376b3988152145accd9eef..f3c4c3021059d23e0ce063341560db26c634a2bb 100644 (file)
@@ -88,6 +88,14 @@ int MemStore::_save()
   if (r < 0)
     return r;
 
+  if (sharded) {
+   string fn = path + "/sharded";
+    bufferlist bl;
+    int r = bl.write_file(fn.c_str());
+    if (r < 0)
+      return r;
+  }
+
   return 0;
 }
 
@@ -168,6 +176,11 @@ int MemStore::_load()
     coll_map[*q] = c;
   }
 
+  fn = path + "/sharded";
+  struct stat st;
+  if (::stat(fn.c_str(), &st) == 0)
+    set_allow_sharded_objects();
+
   dump_all();
 
   return 0;  
index fa16b07ef0bcef37bb1a8aca6b5146a204585dd8..8a05020c29f936bf0b94dfdc9d95a4783df3f7c6 100644 (file)
@@ -232,7 +232,8 @@ public:
     : ObjectStore(path),
       coll_lock("MemStore::coll_lock"),
       apply_lock("MemStore::apply_lock"),
-      finisher(cct) { }
+      finisher(cct),
+      sharded(false) { }
   ~MemStore() { }
 
   int update_version_stamp() {
@@ -264,10 +265,12 @@ public:
     return 0;
   }
 
+  bool sharded;
   void set_allow_sharded_objects() {
+    sharded = true;
   }
   bool get_allow_sharded_objects() {
-    return true;
+    return sharded;
   }
 
   int statfs(struct statfs *buf);