mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
mgr: Look at PG state when PG epoch >= OSDMap epoch
add an if statement to only allow PGs to only look at it's PG state when it's epoch is greater than or equal to the OSDMap's epoch. Signed-off-by: Kamoltat (Junior) Sirivadhna <ksirivad@redhat.com>
This commit is contained in:
parent
c2cae94c68
commit
21e1caba6d
@ -142,7 +142,7 @@ class PgRecoveryEvent(Event):
|
||||
def evacuating_osds(self):
|
||||
return self. _evacuate_osds
|
||||
|
||||
def pg_update(self, pg_dump, log):
|
||||
def pg_update(self, pg_dump, log,latest_osd_map_epoch):
|
||||
# FIXME: O(pg_num) in python
|
||||
# FIXME: far more fields getting pythonized than we really care about
|
||||
pg_to_state = dict([(p['pgid'], p) for p in pg_dump['pg_stats']])
|
||||
@ -180,6 +180,9 @@ class PgRecoveryEvent(Event):
|
||||
# The PG is gone! Probably a pool was deleted. Drop it.
|
||||
complete.add(pg)
|
||||
continue
|
||||
#Only checks the state of each PGs when it's epoch >= the OSDMap's epoch
|
||||
if int(info['reported_epoch']) < int(latest_osd_map_epoch):
|
||||
continue
|
||||
|
||||
state = info['state']
|
||||
|
||||
@ -360,7 +363,7 @@ class Module(MgrModule):
|
||||
which_pgs=affected_pgs,
|
||||
evacuate_osds=[osd_id]
|
||||
)
|
||||
ev.pg_update(self.get("pg_dump"), self.log)
|
||||
ev.pg_update(self.get("pg_dump"), self.log,self._latest_osdmap.get_epoch())
|
||||
self._events[ev.id] = ev
|
||||
|
||||
def _osd_in(self, osd_id):
|
||||
@ -408,7 +411,7 @@ class Module(MgrModule):
|
||||
data = self.get("pg_dump")
|
||||
for ev_id, ev in self._events.items():
|
||||
if isinstance(ev, PgRecoveryEvent):
|
||||
ev.pg_update(data, self.log)
|
||||
ev.pg_update(data, self.log,self._latest_osdmap.get_epoch())
|
||||
self.maybe_complete(ev)
|
||||
|
||||
def maybe_complete(self, event):
|
||||
|
Loading…
Reference in New Issue
Block a user