MCPcopy Create free account
hub / github.com/ceph/ceph / encode_pending

Method encode_pending

src/mon/MDSMonitor.cc:237–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237void MDSMonitor::encode_pending(MonitorDBStore::TransactionRef t)
238{
239 auto &pending = get_pending_fsmap_writeable();
240 auto epoch = pending.get_epoch();
241
242 assign_quiesce_db_leader(pending);
243
244 dout(10) << "encode_pending e" << epoch << dendl;
245
246 // print map iff 'debug mon = 30' or higher
247 print_map<30>(pending);
248 if (!g_conf()->mon_mds_skip_sanity) {
249 pending.sanity(true);
250 }
251 pending.set_btime();
252
253 // apply to paxos
254 ceph_assert(get_last_committed() + 1 == pending.get_epoch());
255 bufferlist pending_bl;
256 pending.encode(pending_bl, mon.get_quorum_con_features());
257
258 /* put everything in the transaction */
259 put_version(t, pending.get_epoch(), pending_bl);
260 put_last_committed(t, pending.get_epoch());
261
262 // Encode MDSHealth data
263 for (map<uint64_t, MDSHealth>::iterator i = pending_daemon_health.begin();
264 i != pending_daemon_health.end(); ++i) {
265 bufferlist bl;
266 i->second.encode(bl);
267 t->put(MDS_HEALTH_PREFIX, stringify(i->first), bl);
268 }
269
270 for (set<uint64_t>::iterator i = pending_daemon_health_rm.begin();
271 i != pending_daemon_health_rm.end(); ++i) {
272 t->erase(MDS_HEALTH_PREFIX, stringify(*i));
273 }
274 pending_daemon_health_rm.clear();
275 remove_from_metadata(pending, t);
276
277 // health
278 health_check_map_t new_checks;
279 const auto &info_map = pending.get_mds_info();
280 for (const auto &i : info_map) {
281 const auto &gid = i.first;
282 const auto &info = i.second;
283 if (pending_daemon_health_rm.count(gid)) {
284 continue;
285 }
286 MDSHealth health;
287 auto p = pending_daemon_health.find(gid);
288 if (p != pending_daemon_health.end()) {
289 health = p->second;
290 } else {
291 bufferlist bl;
292 mon.store->get(MDS_HEALTH_PREFIX, stringify(gid), bl);
293 if (!bl.length()) {
294 derr << "Missing health data for MDS " << gid << dendl;

Callers

nothing calls this directly

Calls 15

stringifyFunction · 0.85
mds_metric_nameFunction · 0.85
mds_metric_summaryFunction · 0.85
sanityMethod · 0.80
set_btimeMethod · 0.80
get_epochMethod · 0.45
encodeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
putMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected