mgr/ClusterState: discard pg updates for pgs >= pg_num

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2018-07-29 22:23:06 -05:00
parent ba7f9af21c
commit 9e906733fe
2 changed files with 14 additions and 4 deletions

View File

@ -78,7 +78,8 @@ void ClusterState::ingest_pgstats(MPGStats *stats)
// In case we're hearing about a PG that according to last
// OSDMap update should not exist
if (existing_pools.count(pgid.pool()) == 0) {
auto r = existing_pools.find(pgid.pool());
if (r == existing_pools.end()) {
dout(15) << " got " << pgid
<< " reported at " << pg_stats.reported_epoch << ":"
<< pg_stats.reported_seq
@ -87,6 +88,15 @@ void ClusterState::ingest_pgstats(MPGStats *stats)
<< dendl;
continue;
}
if (pgid.ps() >= r->second) {
dout(15) << " got " << pgid
<< " reported at " << pg_stats.reported_epoch << ":"
<< pg_stats.reported_seq
<< " state " << pg_state_string(pg_stats.state)
<< " but > pg_num " << r->second
<< dendl;
continue;
}
// In case we already heard about more recent stats from this PG
// from another OSD
const auto q = pg_map.pg_stat.find(pgid);
@ -94,7 +104,7 @@ void ClusterState::ingest_pgstats(MPGStats *stats)
q->second.get_version_pair() > pg_stats.get_version_pair()) {
dout(15) << " had " << pgid << " from "
<< q->second.reported_epoch << ":"
<< q->second.reported_seq << dendl;
<< q->second.reported_seq << dendl;
continue;
}
@ -137,7 +147,7 @@ void ClusterState::notify_osdmap(const OSDMap &osd_map)
// in synchrony with this OSDMap.
existing_pools.clear();
for (auto& p : osd_map.get_pools()) {
existing_pools.insert(p.first);
existing_pools[p.first] = p.second.get_pg_num();
}
// brute force this for now (don't bother being clever by only

View File

@ -43,7 +43,7 @@ protected:
MgrMap mgr_map;
set<int64_t> existing_pools; ///< pools that exist, as of PGMap epoch
map<int64_t,unsigned> existing_pools; ///< pools that exist, and pg_num, as of PGMap epoch
PGMap pg_map;
PGMap::Incremental pending_inc;