]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: PeeringState: respect stretch peering constraints for async recovery
authorGreg Farnum <gfarnum@redhat.com>
Thu, 11 Mar 2021 07:40:52 +0000 (07:40 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Fri, 12 Mar 2021 20:58:52 +0000 (20:58 +0000)
Happily this is pretty simple: we just need to check that the resulting
wanted set can peer, which we have a function for. Run it before actually
swapping the want and candidate_want sets.

If we're not in stretch mode, this is a cheap function call that
will always return true, so it's equivalent to what we already have for them.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/osd/PeeringState.cc

index 4d6892473aae70c4f75f7d54de89ae9860ae3b77..fe1fa1a473252b8b50ff796793bebebf23f3f870 100644 (file)
@@ -2273,13 +2273,18 @@ void PeeringState::choose_async_recovery_replicated(
     vector<int> candidate_want(*want);
     for (auto it = candidate_want.begin(); it != candidate_want.end(); ++it) {
       if (*it == cur_shard.osd) {
-        candidate_want.erase(it);
-       want->swap(candidate_want);
-       async_recovery->insert(cur_shard);
-        break;
+       candidate_want.erase(it);
+       if (pool.info.stretch_set_can_peer(candidate_want, *osdmap, NULL)) {
+         // if we're in stretch mode, we can only remove the osd if it doesn't
+         // break peering limits.
+         want->swap(candidate_want);
+         async_recovery->insert(cur_shard);
+       }
+       break;
       }
     }
   }
+
   psdout(20) << __func__ << " result want=" << *want
             << " async_recovery=" << *async_recovery << dendl;
 }