From: Jos Collin Date: Thu, 20 Apr 2017 11:50:24 +0000 (+0530) Subject: mon: handle cases where store->get() may return error X-Git-Tag: v12.1.1~233^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=378881764a48784fe3ab704be61575c7f2aeed28;p=ceph-ci.git mon: handle cases where store->get() may return error Handled cases where store->get() may return error. Fixed the review comments too in this commit. Fixes: http://tracker.ceph.com/issues/19601 Signed-off-by: Jos Collin --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index af44df8e392..d3a0be615e4 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1433,8 +1433,10 @@ void Monitor::handle_sync_get_chunk(MonOpRequestRef op) while (sp.last_committed < paxos->get_version() && left > 0) { bufferlist bl; sp.last_committed++; - store->get(paxos->get_name(), sp.last_committed, bl); - // TODO: what if store->get returns error or empty bl? + + int err = store->get(paxos->get_name(), sp.last_committed, bl); + assert(err == 0); + tx->put(paxos->get_name(), sp.last_committed, bl); left -= bl.length(); dout(20) << __func__ << " including paxos state " << sp.last_committed @@ -4844,14 +4846,16 @@ bool Monitor::_scrub(ScrubResult *r, } bufferlist bl; - //TODO: what when store->get returns error or empty bl? - store->get(k.first, k.second, bl); + int err = store->get(k.first, k.second, bl); + assert(err == 0); + uint32_t key_crc = bl.crc32c(0); dout(30) << __func__ << " " << k << " bl " << bl.length() << " bytes" << " crc " << key_crc << dendl; r->prefix_keys[k.first]++; - if (r->prefix_crc.count(k.first) == 0) + if (r->prefix_crc.count(k.first) == 0) { r->prefix_crc[k.first] = 0; + } r->prefix_crc[k.first] = bl.crc32c(r->prefix_crc[k.first]); if (cct->_conf->mon_scrub_inject_crc_mismatch > 0.0 &&