Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
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 {