]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
KeyValueStore: Remove assert for collection_getattr method
authorHaomai Wang <haomaiwang@gmail.com>
Wed, 19 Nov 2014 03:52:33 +0000 (11:52 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Wed, 19 Nov 2014 03:52:33 +0000 (11:52 +0800)
Merge 22b6c1a5317504e87042ffeff2b2d0d0b71cac5e introduce
5dc990c1ca821620993417ef4acc51a2b0a34606 commit which will lookup "remove"
attr. It shouldn't exist for most of cases but KeyValueStore will crash
if attr isn't exist. It seemed that this assert isn't correct.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/os/KeyValueStore.cc

index d1b76c5859fa1fb1021a85750885a341f7bfc7be..2ed74b7b64f01b75d922550712968c6f67a24bd3 100644 (file)
@@ -2268,8 +2268,8 @@ int KeyValueStore::collection_getattr(coll_t c, const char *name,
     r = -EINVAL;
   }
 
-  assert(out.size());
-  bl.swap(out.begin()->second);
+  if (out.size())
+    bl.swap(out.begin()->second);
 
   dout(10) << __func__ << " " << c.to_str() << " '" << name << "' len "
            << bl.length() << " = " << r << dendl;