There are intervals during bootstrap(*) during which we are part of the
monmap, but our name (mon->name) does not match the monmap's. This means
that calling monmap->get_inst(mon->name) is not a safe way to get our own
entity_inst_t.
Instead, use messenger->get_myinst(). This includes our addr (obviously)
and an up-to-date entity_name_t, too: in bootstrap we adjust the messenger
name at the same time as mon->rank, based on the contents of the monmap.
monmap->get_inst(mon->rank) would work too.
* During mkfs, the monmap may have noname-foo instead of the name if it was
generated from the mon_host lines or dns or whatever by
MonMap::build_initial(). This was the case for #4811.
Fixes: #4811
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
return -errno;
}
- entity_inst_t our_inst = mon->monmap->get_inst(mon->name);
+ entity_inst_t our_inst = mon->messenger->get_myinst();
DataStats& ours = stats[our_inst];
ours.kb_total = stbuf.f_blocks * stbuf.f_bsize / 1024;
return;
assert(!stats.empty());
- entity_inst_t our_inst = mon->monmap->get_inst(mon->rank);
+ entity_inst_t our_inst = mon->messenger->get_myinst();
assert(stats.count(our_inst) > 0);
DataStats &ours = stats[our_inst];
const set<int>& quorum = mon->get_quorum();
if (in_quorum())
share_stats();
- DataStats &ours = stats[mon->monmap->get_inst(mon->name)];
+ DataStats &ours = stats[mon->messenger->get_myinst()];
if (ours.latest_avail_percent <= g_conf->mon_data_avail_crit) {
derr << "reached critical levels of available space on data store"
<< " round " << timecheck_round << dendl;
// we are at the eye of the storm; the point of reference
- timecheck_skews[monmap->get_inst(name)] = 0.0;
- timecheck_latencies[monmap->get_inst(name)] = 0.0;
+ timecheck_skews[messenger->get_myinst()] = 0.0;
+ timecheck_latencies[messenger->get_myinst()] = 0.0;
for (set<int>::iterator it = quorum.begin(); it != quorum.end(); ++it) {
if (monmap->get_name(*it) == name)