]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: delay the RGW process exit until all actice requests have completed 57659/head
authorMark Kogan <mkogan@ibm.com>
Thu, 23 May 2024 12:17:22 +0000 (12:17 +0000)
committerMark Kogan <mkogan@ibm.com>
Mon, 24 Jun 2024 09:18:57 +0000 (09:18 +0000)
Wait for up to `rgw_exit_timeout_secs` for all outstanding requests
to complete before exiting unconditionally.
(new HTTP requests will not be accepted during this time.)

Fixes: https://tracker.ceph.com/issues/66205
Signed-off-by: Mark Kogan <mkogan@ibm.com>
src/common/options/rgw.yaml.in
src/rgw/rgw_asio_frontend.cc

index 5cb7aee81f1e4c6e7649ef8b10be44bf192a4a01..e9d651fad8abf90f21b42b801e1bc687af70386f 100644 (file)
@@ -1867,6 +1867,18 @@ options:
   services:
   - rgw
   with_legacy: true
+- name: rgw_graceful_stop
+  type: bool
+  level: advanced
+  desc: Delay the shutdown until all outstanding requests have completed
+  long_desc: Wait for up to `rgw_exit_timeout_secs` for all outstanding requests to complete
+    before exiting unconditionally. (new HTTP requests will not be accepted during this time.)
+  default: false
+  services:
+  - rgw
+  see_also:
+  - rgw_exit_timeout_secs
+  with_legacy: true
 - name: rgw_get_obj_window_size
   type: size
   level: advanced
index ace3b7aff49e9a4d3424952946ceeb8ff4b8aa0f..855b9650f0ca5fa87aa97139909a7eb1de1cf09e 100644 (file)
@@ -1086,6 +1086,20 @@ void AsioFrontend::stop()
   for (auto& listener : listeners) {
     listener.acceptor.close(ec);
   }
+
+  const bool graceful_stop{ g_ceph_context->_conf->rgw_graceful_stop };
+  if (graceful_stop) {
+    ldout(ctx(), 4) << "frontend pausing and waiting for outstanding requests to complete..." << dendl;
+    pause_mutex.lock(ec);
+    if (ec) {
+      ldout(ctx(), 1) << "frontend failed to pause: " << ec.message() << dendl;
+    } else {
+      ldout(ctx(), 4) << "frontend paused" << dendl;
+    }
+    ldout(ctx(), 4) << "frontend outstanding requests have completed" << dendl;
+    pause_mutex.unlock();
+  }
+
   // close all connections
   connections.close(ec);
   pause_mutex.cancel();