Project

General

Profile

Cleanup #19601

mon: handle cases where store->get() may return error or empty bl

Added by Joao Eduardo Luis almost 7 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Monitor
Target version:
-
% Done:

0%

Spent time:
Tags:
low-hanging-fruit
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

These are present in current master (41f0dd1d27b654c2f67a7ea710741fffb9aa5a01)

void Monitor::handle_sync_get_chunk(MonOpRequestRef op)

[...]

    store->get(paxos->get_name(), sp.last_committed, bl);
    // TODO: what if store->get returns error or empty bl?
    tx->put(paxos->get_name(), sp.last_committed, bl);
bool Monitor::_scrub(ScrubResult *r,
                     pair<string,string> *start,
                     int *num_keys)
[...]

    bufferlist bl;
    //TODO: what when store->get returns error or empty bl?
    store->get(k.first, k.second, bl);
    uint32_t key_crc = bl.crc32c(0);
    dout(30) << __func__ << " " << k << " bl " << bl.length() << " bytes" 
                                     << " crc " << key_crc << dendl;
void PGMonitor::read_pgmap_meta()
{
[...]

  float full_ratio, nearfull_ratio;
  {
    bufferlist bl;
    mon->store->get(prefix, "full_ratio", bl);
    bufferlist::iterator p = bl.begin();
    ::decode(full_ratio, p);
  }
  {
    bufferlist bl;
    mon->store->get(prefix, "nearfull_ratio", bl);
    bufferlist::iterator p = bl.begin();
    ::decode(nearfull_ratio, p);
  }
  pg_map.set_full_ratios(full_ratio, nearfull_ratio);
  {
    bufferlist bl;
    mon->store->get(prefix, "stamp", bl);
    bufferlist::iterator p = bl.begin();
    utime_t stamp;
    ::decode(stamp, p);
    pg_map.set_stamp(stamp);
  }

History

#1 Updated by Jos Collin almost 7 years ago

  • Assignee set to Jos Collin

#2 Updated by Jos Collin almost 7 years ago

  • Status changed from New to In Progress

#3 Updated by Jos Collin almost 7 years ago

  • Status changed from In Progress to Fix Under Review

The following PR is created. Please review.
https://github.com/ceph/ceph/pull/14678

#4 Updated by Jos Collin almost 7 years ago

  • Status changed from Fix Under Review to In Progress

#5 Updated by Jos Collin over 6 years ago

  • Status changed from In Progress to Resolved

Also available in: Atom PDF