]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD/OSDService: make osdmap load error more human-understandable 7306/head
authorPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Thu, 21 Jan 2016 07:55:41 +0000 (08:55 +0100)
committerPiotr Dałek <ceph@predictor.org.pl>
Thu, 5 May 2016 15:08:30 +0000 (17:08 +0200)
In case when OSD crashed leaving empty OSD maps in its store, subsequent
OSD boots will fail with exception end_of_buffer thrown in map->decode.
This occurs because _get_map_bl returns TRUE and empty bufferlist.
In that case, inform user of actual issue instead of crashing in odd place
and requiring them to strace ceph-osd to find out what actually happened.

Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
src/osd/OSD.cc

index 7b864a52f776fe68c35107bb530a6cbecf4bb135..71544952032598682807350621b84480d1f9c48a 100644 (file)
@@ -1333,7 +1333,8 @@ OSDMapRef OSDService::try_get_map(epoch_t epoch)
   if (epoch > 0) {
     dout(20) << "get_map " << epoch << " - loading and decoding " << map << dendl;
     bufferlist bl;
-    if (!_get_map_bl(epoch, bl)) {
+    if (!_get_map_bl(epoch, bl) || bl.length() == 0) {
+      derr << "failed to load OSD map for epoch " << epoch << ", got " << bl.length() << " bytes" << dendl;
       delete map;
       return OSDMapRef();
     }