]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
objecter: request OSDMap after idle ticks
authorNitzan Mordechai <nmordech@redhat.com>
Thu, 22 May 2025 08:25:06 +0000 (08:25 +0000)
committerNitzan Mordechai <nmordech@redhat.com>
Mon, 7 Jul 2025 11:31:33 +0000 (11:31 +0000)
If the objecter goes two ticks without receiving an OSDMap, it may
fall behind on incremental updates.  Call `maybe_request_osdmap()` in
the tick handler whenever we detect that two consecutive ticks have
elapsed without a fresh map, so we minimize the time needed to catch
up on missed changes.

Fixes: https://tracker.ceph.com/issues/71261
Signed-off-by: Nitzan Mordechai <nmordec@redhat.com>
(cherry picked from commit 7fe1e426663567bf5a1f3e562722de78017050f9)

src/osdc/Objecter.cc
src/osdc/Objecter.h

index adc03ec4c71c39ee067f68845f887f1ec349ac55..78f7bbce5c6f067290ae0b957501f8446a92070e 100644 (file)
@@ -2052,6 +2052,7 @@ void Objecter::maybe_request_map()
 
 void Objecter::_maybe_request_map()
 {
+  last_osdmap_request_time = ceph::coarse_mono_clock::now();
   // rwlock is locked
   int flag = 0;
   if (_osdmap_full_flag()
@@ -2238,8 +2239,20 @@ void Objecter::tick()
     if (found)
       toping.insert(s);
   }
+
   if (num_homeless_ops || !toping.empty()) {
     _maybe_request_map();
+  } else if (last_osdmap_request_time != ceph::coarse_mono_clock::time_point()) {
+    auto now = ceph::coarse_mono_clock::now();
+    auto elapsed = now - last_osdmap_request_time;
+    auto stale_window = ceph::make_timespan(cct->_conf->objecter_tick_interval) * 2;
+    if (elapsed > stale_window) {
+      double elapsed_s = std::chrono::duration<double>(elapsed).count();
+      double thresh_s  = std::chrono::duration<double>(stale_window).count();
+      ldout(cct, 10) << __func__ << ": osdmap stale: " << elapsed_s 
+        << "s > " << thresh_s << "s, maybe requesting map" << dendl;
+      _maybe_request_map();
+    }
   }
 
   logger->set(l_osdc_op_laggy, laggy_ops);
index 4167660c5a8d9dd07519e5145bbbc8fe56ee204e..7ffdd9b5e28b800c46aaaaa6b828bd4fb8f2625c 100644 (file)
@@ -2519,6 +2519,9 @@ public:
   ceph::timespan mon_timeout;
   ceph::timespan osd_timeout;
 
+  // last time osdmap was requested
+  ceph::coarse_mono_time last_osdmap_request_time;
+
   MOSDOp *_prepare_osd_op(Op *op);
   void _send_op(Op *op);
   void _send_op_account(Op *op);