]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: be less aggressive/paranoid about reopening mon connections
authorSage Weil <sage@redhat.com>
Thu, 10 Jan 2019 23:17:24 +0000 (17:17 -0600)
committerSage Weil <sage@redhat.com>
Thu, 10 Jan 2019 23:18:38 +0000 (17:18 -0600)
Previously we were reopening any time the name of our mon changed.  That
was pretty much every time, since we started out with names from the
seed monmap like 'noname-[abc]' that never match the real mons.

Instead, only reopen if the addr we are connecting to is no longer in the
monmap.  We don't actually care about the mon's name.

Fixes: http://tracker.ceph.com/issues/37868
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonClient.cc

index a273d6abe103f0d08fb1eec7472ee71b024d1092..6917ab2a1bdecac62db4feaba228b36d7ca5f025 100644 (file)
@@ -376,15 +376,17 @@ void MonClient::handle_monmap(MMonMap *m)
     ldout(cct,10) << " can't identify which mon we were connected to" << dendl;
     _reopen_session();
   } else {
-    if (monmap.get_rank(old_name) < 0) {
-      ldout(cct, 10) << "mon." << old_name << " went away" << dendl;
+    int new_rank = monmap.get_rank(m->get_source_addr());
+    if (new_rank < 0) {
+      ldout(cct, 10) << "mon." << new_rank << " at " << m->get_source_addrs()
+                    << " went away" << dendl;
       // can't find the mon we were talking to (above)
       _reopen_session();
-    } else if (monmap.get_addrs(old_name) != con_addrs) {
+    } else if (monmap.get_addrs(new_rank) != con_addrs) {
       // FIXME: we might make this a more sophisticated check later if we do
       // multiprotocol IPV4/IPV6 and have a strict preference
-      ldout(cct,10) << " mon." << old_name << " has addrs "
-                   << monmap.get_addrs(old_name) << " but i'm connected to "
+      ldout(cct,10) << " mon." << new_rank << " has addrs "
+                   << monmap.get_addrs(new_rank) << " but i'm connected to "
                    << con_addrs << dendl;
       _reopen_session();
     }