Project

General

Profile

Cleanup #19601

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

Added by Joao Luis over 1 year ago. Updated 9 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Monitor
Target version:
-
Start date:
04/12/2017
Due date:
% Done:

0%

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

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 over 1 year ago

  • Assignee set to Jos Collin

#2 Updated by Jos Collin about 1 year ago

  • Status changed from New to In Progress

#3 Updated by Jos Collin about 1 year ago

  • Status changed from In Progress to Need Review

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

#4 Updated by Jos Collin about 1 year ago

  • Status changed from Need Review to In Progress

#5 Updated by Jos Collin 9 months ago

  • Status changed from In Progress to Resolved

Also available in: Atom PDF