]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: move async rados processor insnace into svc.rados
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 5 Jun 2019 22:03:15 +0000 (15:03 -0700)
committerCasey Bodley <cbodley@redhat.com>
Mon, 29 Jul 2019 19:20:48 +0000 (15:20 -0400)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/services/svc_rados.cc
src/rgw/services/svc_rados.h

index 33936f7b1024d5e2e1e5837cdf2cd08c3db47573..b7b65acae9f98f38c1fe460f5472896781832a14 100644 (file)
@@ -66,7 +66,7 @@ void RGWAsyncRadosProcessor::RGWWQ::_dump_queue() {
 }
 
 RGWAsyncRadosProcessor::RGWAsyncRadosProcessor(RGWRados *_store, int num_threads)
-  : store(_store), m_tp(store->ctx(), "RGWAsyncRadosProcessor::m_tp", "rados_async", num_threads),
+  : cct(_cct), m_tp(cct, "RGWAsyncRadosProcessor::m_tp", "rados_async", num_threads),
     req_throttle(store->ctx(), "rgw_async_rados_ops", num_threads * 2),
     req_wq(this, g_conf()->rgw_op_thread_timeout,
     g_conf()->rgw_op_thread_suicide_timeout, &m_tp) {
index 7074ed8c8b011f0adf4824b9c49f1be04f006cad..8f065f3ed4fcc009460c71acff3231ad1769425e 100644 (file)
@@ -69,7 +69,7 @@ class RGWAsyncRadosProcessor {
   deque<RGWAsyncRadosRequest *> m_req_queue;
   std::atomic<bool> going_down = { false };
 protected:
-  RGWRados *store;
+  CephContext *cct;
   ThreadPool m_tp;
   Throttle req_throttle;
 
@@ -93,7 +93,7 @@ protected:
   } req_wq;
 
 public:
-  RGWAsyncRadosProcessor(RGWRados *_store, int num_threads);
+  RGWAsyncRadosProcessor(CephContext *_cct, int num_threads);
   ~RGWAsyncRadosProcessor() {}
   void start();
   void stop();
index 502adfa1d7f15f36d11c93a53a707cf363129766..bc6f0897604bd035afb2c8ac36f68c428483abed 100644 (file)
@@ -1024,9 +1024,6 @@ void RGWRados::finalize()
       sync_log_trimmer->stop();
     }
   }
-  if (async_rados) {
-    async_rados->stop();
-  }
   if (run_sync_thread) {
     delete meta_sync_processor_thread;
     meta_sync_processor_thread = NULL;
@@ -1050,9 +1047,6 @@ void RGWRados::finalize()
   }
   delete data_log;
   delete sync_tracer;
-  if (async_rados) {
-    delete async_rados;
-  }
   
   delete lc;
   lc = NULL; 
@@ -1208,9 +1202,6 @@ int RGWRados::init_complete()
     ctl.meta.mgr->init_oldest_log_period();
   }
 
-  async_rados = new RGWAsyncRadosProcessor(this, cct->_conf->rgw_num_async_rados_threads);
-  async_rados->start();
-
   ret = ctl.meta.mgr->init(current_period.get_id());
   if (ret < 0) {
     lderr(cct) << "ERROR: failed to initialize metadata log: "
@@ -1240,6 +1231,7 @@ int RGWRados::init_complete()
                       << pt.second.name << " present in zonegroup" << dendl;
       }
     }
+    auto async_processor = svc.rados->get_async_processor();
     Mutex::Locker l(meta_sync_thread_lock);
     meta_sync_processor_thread = new RGWMetaSyncProcessorThread(this, async_rados);
     ret = meta_sync_processor_thread->init();
index bc05720013ca89fd353e81647e0f9f218fac0c65..a334174603cde2b3be3c42242ddb4682e287c02c 100644 (file)
@@ -408,8 +408,6 @@ class RGWRados
   bool run_sync_thread;
   bool run_reshard_thread;
 
-  RGWAsyncRadosProcessor* async_rados;
-
   RGWMetaNotifier *meta_notifier;
   RGWDataNotifier *data_notifier;
   RGWMetaSyncProcessorThread *meta_sync_processor_thread;
index a18138aae36827fc2ab032adb9965a6575e045e3..123f9fa70dacfb0533df2b268228bce044d9310a 100644 (file)
@@ -7,9 +7,14 @@
 #include "common/errno.h"
 #include "osd/osd_types.h"
 #include "rgw/rgw_tools.h"
+#include "rgw/rgw_cr_rados.h"
 
 #define dout_subsys ceph_subsys_rgw
 
+RGWSI_RADOS::~RGWSI_RADOS()
+{
+}
+
 int RGWSI_RADOS::do_start()
 {
   int ret = rados.init_with_context(cct);
@@ -20,9 +25,20 @@ int RGWSI_RADOS::do_start()
   if (ret < 0) {
     return ret;
   }
+
+  async_processor.reset(new RGWAsyncRadosProcessor(cct, cct->_conf->rgw_num_async_rados_threads));
+  async_processor->start();
+
   return 0;
 }
 
+void RGWSI_RADOS::shutdown()
+{
+  if (async_processor) {
+    async_processor->stop();
+  }
+}
+
 librados::Rados* RGWSI_RADOS::get_rados_handle()
 {
   return &rados;
index ad27ac38ebc4a2f62c85881f0516ec820cf8ed1a..00c58ee713c2c01953f91c64f8d5f65b9807fa3c 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "common/optional_ref_default.h"
 
+class RGWAsyncRadosProcessor;
+
 class RGWAccessListFilter {
 public:
   virtual ~RGWAccessListFilter() {}
@@ -29,8 +31,10 @@ struct RGWAccessListFilterPrefix : public RGWAccessListFilter {
 class RGWSI_RADOS : public RGWServiceInstance
 {
   librados::Rados rados;
+  std::unique_ptr<RGWAsyncRadosProcessor> async_processor;
 
   int do_start() override;
+  void shutdown() override;
 
 public:
   struct OpenParams {
@@ -59,11 +63,16 @@ private:
 
 public:
   RGWSI_RADOS(CephContext *cct) : RGWServiceInstance(cct) {}
+  ~RGWSI_RADOS();
 
   void init() {}
 
   uint64_t instance_id();
 
+  RGWAsyncRadosProcessor *get_async_processor() {
+    return async_processor.get();
+  }
+
   class Handle;
 
   class Pool {