From: Piotr Dałek Date: Thu, 21 Jan 2016 07:55:41 +0000 (+0100) Subject: OSD/OSDService: make osdmap load error more human-understandable X-Git-Tag: v11.0.0~528^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9b5c7087919b5bfaf99e1ce745fc748baf1706cf;p=ceph.git OSD/OSDService: make osdmap load error more human-understandable 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7b864a52f776..715449520325 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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(); }