]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: clean up cluster logging on mon events 19031/head
authorJohn Spray <john.spray@redhat.com>
Wed, 8 Nov 2017 16:54:44 +0000 (11:54 -0500)
committerPrashant D <pdhange@redhat.com>
Mon, 20 Nov 2017 05:12:00 +0000 (00:12 -0500)
These changes come from observing the output
when killing a mon and watching the survivors
form a new quorum.

Fixes: http://tracker.ceph.com/issues/22082
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 294fe62feeb155e1ec06d508d92435de98cce90a)

src/mon/Monitor.cc
src/mon/Monitor.h

index af3683f67e1e7a540a9c3abc76a1014c6baaf993..91f3adc8cabd73d61eb934f3b955b68f9f10297a 100644 (file)
@@ -1860,7 +1860,7 @@ void Monitor::start_election()
   logger->inc(l_mon_num_elections);
   logger->inc(l_mon_election_call);
 
-  clog->info() << "mon." << name << " calling new monitor election";
+  clog->info() << "mon." << name << " calling monitor election";
   elector.call_election();
 }
 
@@ -1928,8 +1928,8 @@ void Monitor::win_election(epoch_t epoch, set<int>& active, uint64_t features,
   pending_metadata = metadata;
   outside_quorum.clear();
 
-  clog->info() << "mon." << name << "@" << rank
-               << " won leader election with quorum " << quorum;
+  clog->info() << "mon." << name << " is new leader, mons " << get_quorum_names()
+      << " in quorum (ranks " << quorum << ")";
 
   set_leader_commands(get_local_commands(mon_features));
 
@@ -1971,7 +1971,25 @@ void Monitor::win_election(epoch_t epoch, set<int>& active, uint64_t features,
       monmap->get_epoch() > 0) {
     timecheck_start();
     health_tick_start();
-    do_health_to_clog_interval();
+
+    // Freshen the health status before doing health_to_clog in case
+    // our just-completed election changed the health
+    healthmon()->wait_for_active_ctx(new FunctionContext([this](int r){
+      dout(20) << "healthmon now active" << dendl;
+      healthmon()->tick();
+      if (healthmon()->is_proposing()) {
+        dout(20) << __func__ << " healthmon proposing, waiting" << dendl;
+        healthmon()->wait_for_finished_proposal(nullptr, new C_MonContext(this,
+              [this](int r){
+                assert(lock.is_locked_by_me());
+                do_health_to_clog_interval();
+              }));
+
+      } else {
+        do_health_to_clog_interval();
+      }
+    }));
+
     scrub_event_start();
   }
 }
@@ -2309,7 +2327,6 @@ void Monitor::health_tick_start()
     new C_MonContext(this, [this](int r) {
        if (r < 0)
          return;
-       do_health_to_clog();
        health_tick_start();
       }));
 }
@@ -4833,7 +4850,9 @@ void Monitor::handle_timecheck_leader(MonOpRequestRef op)
 
   ostringstream ss;
   health_status_t status = timecheck_status(ss, skew_bound, latency);
-  clog->health(status) << other << " " << ss.str();
+  if (status != HEALTH_OK) {
+    clog->health(status) << other << " " << ss.str();
+  }
 
   dout(10) << __func__ << " from " << other << " ts " << m->timestamp
           << " delta " << delta << " skew_bound " << skew_bound
index fc9772601cb9871f4eb3a39d024bab3616d02a56..4ff8706455163ff599d66ccfd139acc5f3c08dbf 100644 (file)
@@ -650,8 +650,8 @@ public:
     return (class MgrStatMonitor*) paxos_service[PAXOS_MGRSTAT];
   }
 
-  class MgrStatMonitor *healthmon() {
-    return (class MgrStatMonitor*) paxos_service[PAXOS_MGRSTAT];
+  class HealthMonitor *healthmon() {
+    return (class HealthMonitor*) paxos_service[PAXOS_HEALTH];
   }
 
   friend class Paxos;