mon/MgrStatMonitor: persist progress events

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-02-05 10:16:35 -06:00
parent 08d1a6fc3c
commit db7f17db2c
2 changed files with 25 additions and 2 deletions

View File

@ -50,8 +50,13 @@ void MgrStatMonitor::update_from_paxos(bool *need_bootstrap)
auto p = bl.cbegin();
decode(digest, p);
decode(service_map, p);
if (!p.end()) {
decode(progress_events, p);
}
dout(10) << __func__ << " v" << version
<< " service_map e" << service_map.epoch << dendl;
<< " service_map e" << service_map.epoch
<< " " << progress_events.size() << "progress events"
<< dendl;
}
catch (buffer::error& e) {
derr << "failed to decode mgrstat state; luminous dev version?" << dendl;
@ -119,6 +124,7 @@ void MgrStatMonitor::encode_pending(MonitorDBStore::TransactionRef t)
encode(pending_digest, bl, mon->get_quorum_con_features());
ceph_assert(pending_service_map_bl.length());
bl.append(pending_service_map_bl);
encode(pending_progress_events, bl);
put_version(t, version, bl);
put_last_committed(t, version);
@ -189,8 +195,10 @@ bool MgrStatMonitor::prepare_report(MonOpRequestRef op)
if (m->service_map_bl.length()) {
pending_service_map_bl.swap(m->service_map_bl);
}
pending_progress_events.swap(m->progress_events);
dout(10) << __func__ << " " << pending_digest << ", "
<< pending_health_checks.checks.size() << " health checks" << dendl;
<< pending_health_checks.checks.size() << " health checks, "
<< progress_events.size() << "progress events" << dendl;
dout(20) << "pending_digest:\n";
JSONFormatter jf(true);
jf.open_object_section("pending_digest");
@ -205,6 +213,15 @@ bool MgrStatMonitor::prepare_report(MonOpRequestRef op)
jf.close_section();
jf.flush(*_dout);
*_dout << dendl;
dout(20) << "progress events:\n";
JSONFormatter jf(true);
jf.open_object_section("progress_events");
for (auto& i : pending_progress_events) {
jf.dump_object(i.first.c_str(), i.second);
}
jf.close_section();
jf.flush(*_dout);
*_dout << dendl;
return true;
}

View File

@ -13,10 +13,12 @@ class MgrStatMonitor : public PaxosService {
version_t version = 0;
PGMapDigest digest;
ServiceMap service_map;
std::map<std::string,ProgressEvent> progress_events;
// pending commit
PGMapDigest pending_digest;
health_check_map_t pending_health_checks;
std::map<std::string,ProgressEvent> pending_progress_events;
bufferlist pending_service_map_bl;
public:
@ -64,6 +66,10 @@ public:
return service_map;
}
const std::map<std::string,ProgressEvent>& get_progress_events() {
return progress_events;
}
// pg stat access
const pool_stat_t* get_pool_stat(int64_t poolid) const {
auto i = digest.pg_pool_sum.find(poolid);