]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kstore: simplify open_collection logic a bit
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 29 Jan 2016 09:57:15 +0000 (17:57 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 29 Jan 2016 09:57:15 +0000 (17:57 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/kstore/KStore.cc

index 1e7b01b875ab384de335e10b1c49cdfc2a0ef253..28631cd8fc00f11f51e18f865edb9f7291871aaf 100644 (file)
@@ -891,10 +891,15 @@ int KStore::_open_collections(int *errors)
     coll_t cid;
     if (cid.parse(it->key())) {
       CollectionRef c(new Collection(this, cid));
-      bufferlist bl;
-      db->get(PREFIX_COLL, it->key(), &bl);
+      bufferlist bl = it->value();
       bufferlist::iterator p = bl.begin();
-      ::decode(c->cnode, p);
+      try {
+        ::decode(c->cnode, p);
+      } catch (buffer::error& e) {
+        derr << __func__ << " failed to decode cnode, key:"
+             << pretty_binary_string(it->key()) << dendl;
+        return -EIO;
+      } 
       dout(20) << __func__ << " opened " << cid << dendl;
       coll_map[cid] = c;
     } else {