]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: disable the PGStatsAck timeout when we are reconnecting to a monitor 1314/head
authorGreg Farnum <greg@inktank.com>
Wed, 12 Feb 2014 19:30:15 +0000 (11:30 -0800)
committerGreg Farnum <greg@inktank.com>
Tue, 25 Feb 2014 19:40:32 +0000 (11:40 -0800)
Previously, the timeout counter started as soon as we issued the reopen,
but if the reconnect process itself took a while, we might time out and
issue another reopen just as we get to the point where it's possible to
get work done. Since the mon client has its own reconnect timeouts (that is,
the OSD doesn't need to trigger those), we instead disable our timeouts
while the reconnect is happening, and then turn them back on again starting
from when we get the reconnect callback.

Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 64cedf6fa3ee309cc96554286bfb805e4ca89439)

Conflicts:

src/osd/OSD.cc

src/osd/OSD.cc
src/osd/OSD.h

index 96b0b33906323ca96fbf691e5962e7cff51fb508..d354465aecab8cbd51be4dd6eeedcf43bdce2df2 100644 (file)
@@ -938,6 +938,7 @@ OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger,
   debug_drop_pg_create_duration(g_conf->osd_debug_drop_pg_create_duration),
   debug_drop_pg_create_left(-1),
   outstanding_pg_stats(false),
+  timeout_mon_on_pg_stats(true),
   up_thru_wanted(0), up_thru_pending(0),
   pg_stat_queue_lock("OSD::pg_stat_queue_lock"),
   osd_stat_updated(false),
@@ -3060,11 +3061,12 @@ void OSD::tick()
 
     // mon report?
     utime_t now = ceph_clock_now(g_ceph_context);
-    if (outstanding_pg_stats &&
+    if (outstanding_pg_stats && timeout_mon_on_pg_stats &&
        (now - g_conf->osd_mon_ack_timeout) > last_pg_stats_ack) {
       dout(1) << "mon hasn't acked PGStats in " << now - last_pg_stats_ack
              << " seconds, reconnecting elsewhere" << dendl;
-      monc->reopen_session();
+      monc->reopen_session(new C_MonStatsAckTimer(this));
+      timeout_mon_on_pg_stats = false;
       last_pg_stats_ack = ceph_clock_now(g_ceph_context);  // reset clock
       last_pg_stats_sent = utime_t();
     }
index c14636c5154cb3191977a767aa3846326833cca5..a6c270d83d492659db1188042f230d44488f2da0 100644 (file)
@@ -1188,6 +1188,22 @@ protected:
    */
   utime_t last_pg_stats_ack;
   bool outstanding_pg_stats; // some stat updates haven't been acked yet
+  bool timeout_mon_on_pg_stats;
+  void restart_stats_timer() {
+    Mutex::Locker l(osd_lock);
+    last_pg_stats_ack = ceph_clock_now(cct);
+    timeout_mon_on_pg_stats = true;
+  }
+
+  class C_MonStatsAckTimer : public Context {
+    OSD *osd;
+  public:
+    C_MonStatsAckTimer(OSD *o) : osd(o) {}
+    void finish(int r) {
+      osd->restart_stats_timer();
+    }
+  };
+  friend class C_MonStatsAckTimer;
 
   void do_mon_report();