Merge pull request #2850 from ceph/wip-9987

mon: fix min_last_epoch_started tracking

Reviewed-by: Joao Eduardo Luis <joao@redhat.com>
This commit is contained in:
Samuel Just 2014-11-10 14:49:51 -08:00
commit 18a850933f
2 changed files with 36 additions and 2 deletions

View File

@ -379,17 +379,31 @@ void PGMap::update_pg(pg_t pgid, bufferlist& bl)
{
bufferlist::iterator p = bl.begin();
ceph::unordered_map<pg_t,pg_stat_t>::iterator s = pg_stat.find(pgid);
if (s != pg_stat.end())
epoch_t old_lec = 0;
if (s != pg_stat.end()) {
old_lec = s->second.get_effective_last_epoch_clean();
stat_pg_sub(pgid, s->second);
}
pg_stat_t& r = pg_stat[pgid];
::decode(r, p);
stat_pg_add(pgid, r);
epoch_t lec = r.get_effective_last_epoch_clean();
if (min_last_epoch_clean &&
(lec < min_last_epoch_clean || // we did
(lec > min_last_epoch_clean && // we might
old_lec == min_last_epoch_clean)
))
min_last_epoch_clean = 0;
}
void PGMap::remove_pg(pg_t pgid)
{
ceph::unordered_map<pg_t,pg_stat_t>::iterator s = pg_stat.find(pgid);
if (s != pg_stat.end()) {
if (min_last_epoch_clean &&
s->second.get_effective_last_epoch_clean() == min_last_epoch_clean)
min_last_epoch_clean = 0;
stat_pg_sub(pgid, s->second);
pg_stat.erase(s);
}
@ -399,14 +413,33 @@ void PGMap::update_osd(int osd, bufferlist& bl)
{
bufferlist::iterator p = bl.begin();
ceph::unordered_map<int32_t,osd_stat_t>::iterator o = osd_stat.find(osd);
if (o != osd_stat.end())
epoch_t old_lec = 0;
if (o != osd_stat.end()) {
ceph::unordered_map<int32_t,epoch_t>::iterator i = osd_epochs.find(osd);
if (i != osd_epochs.end())
old_lec = i->second;
stat_osd_sub(o->second);
}
osd_stat_t& r = osd_stat[osd];
::decode(r, p);
stat_osd_add(r);
// adjust [near]full status
register_nearfull_status(osd, r);
// epoch?
if (!p.end()) {
epoch_t e;
::decode(e, p);
if (e < min_last_epoch_clean ||
(e > min_last_epoch_clean &&
old_lec == min_last_epoch_clean))
min_last_epoch_clean = 0;
} else {
// WARNING: we are not refreshing min_last_epoch_clean! must be old store
// or old mon running.
}
}
void PGMap::remove_osd(int osd)

View File

@ -548,6 +548,7 @@ void PGMonitor::encode_pending(MonitorDBStore::TransactionRef t)
::encode(p->first, dirty);
bufferlist bl;
::encode(p->second, bl, features);
::encode(pending_inc.get_osd_epochs().find(p->first)->second, bl);
t->put(prefix, stringify(p->first), bl);
}
for (set<int32_t>::const_iterator p =