]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: svc.mdlog: init oldest log period only if we're syncing
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 3 Jul 2019 17:56:43 +0000 (10:56 -0700)
committerCasey Bodley <cbodley@redhat.com>
Mon, 29 Jul 2019 19:20:50 +0000 (15:20 -0400)
Need to diffrerentiate between need to sync and actually syncing. Zone might need
to sync, but we're running in radosgw-admin and we don't actually sync.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_log.cc
src/rgw/rgw_service.cc
src/rgw/rgw_service.h
src/rgw/rgw_sync.cc
src/rgw/services/svc_mdlog.cc
src/rgw/services/svc_mdlog.h

index 280741c43734326a18c6f0b245711e9f3e52ec40..2efc833af5f2cc4063fea9c3daf49e6d67ab3a5a 100644 (file)
@@ -1314,7 +1314,7 @@ int RGWRados::init_svc(bool raw)
     return svc.init_raw(cct, use_cache);
   }
 
-  return svc.init(cct, use_cache);
+  return svc.init(cct, use_cache, run_sync_thread);
 }
 
 int RGWRados::init_ctl()
index 9f3567664ef0a2d39079b683e5941ad1adb875ba..0fcb3f1d36ec797ec2b9412c42d68c6d4ed44034 100644 (file)
@@ -397,7 +397,7 @@ void RGWOp_BILog_List::execute() {
   }
 
   if (!bucket_instance.empty()) {
-    rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name, bucket_instance));
+    rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
     http_ret = store->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield);
     if (http_ret < 0) {
       ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
@@ -490,7 +490,7 @@ void RGWOp_BILog_Info::execute() {
   }
 
   if (!bucket_instance.empty()) {
-    rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name, bucket_instance));
+    rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
     http_ret = store->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield);
     if (http_ret < 0) {
       ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
@@ -554,7 +554,7 @@ void RGWOp_BILog_Delete::execute() {
   }
 
   if (!bucket_instance.empty()) {
-    rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name, bucket_instance));
+    rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
     http_ret = store->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield);
     if (http_ret < 0) {
       ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
index 34a7271d024eb79af596912038173f2d4aef2c36..0f909a6b1a6b4a1ff60aec76d230422a89f88e5c 100644 (file)
@@ -44,7 +44,8 @@ RGWServices_Def::~RGWServices_Def()
 
 int RGWServices_Def::init(CephContext *cct,
                          bool have_cache,
-                          bool raw)
+                          bool raw,
+                         bool run_sync)
 {
   finisher = std::make_unique<RGWSI_Finisher>(cct);
   bucket_sobj = std::make_unique<RGWSI_Bucket_SObj>(cct);
@@ -52,7 +53,7 @@ int RGWServices_Def::init(CephContext *cct,
   bilog_rados = std::make_unique<RGWSI_BILog_RADOS>(cct);
   cls = std::make_unique<RGWSI_Cls>(cct);
   datalog_rados = std::make_unique<RGWSI_DataLog_RADOS>(cct);
-  mdlog = std::make_unique<RGWSI_MDLog>(cct);
+  mdlog = std::make_unique<RGWSI_MDLog>(cct, run_sync);
   meta = std::make_unique<RGWSI_Meta>(cct);
   meta_be_sobj = std::make_unique<RGWSI_MetaBackend_SObj>(cct);
   meta_be_otp = std::make_unique<RGWSI_MetaBackend_OTP>(cct);
@@ -253,11 +254,11 @@ void RGWServices_Def::shutdown()
 }
 
 
-int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw)
+int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw, bool run_sync)
 {
   cct = _cct;
 
-  int r = _svc.init(cct, have_cache, raw);
+  int r = _svc.init(cct, have_cache, raw, run_sync);
   if (r < 0) {
     return r;
   }
index e4269120223c6d5db2bb2e856c5ddd076349d7a2..1bbbb786a710ec35fb27fb0436337307c7665091 100644 (file)
@@ -100,7 +100,7 @@ struct RGWServices_Def
   RGWServices_Def();
   ~RGWServices_Def();
 
-  int init(CephContext *cct, bool have_cache, bool raw_storage);
+  int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync);
   void shutdown();
 };
 
@@ -135,14 +135,14 @@ struct RGWServices
   RGWSI_SysObj_Core *core{nullptr};
   RGWSI_User *user{nullptr};
 
-  int do_init(CephContext *cct, bool have_cache, bool raw_storage);
+  int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync);
 
-  int init(CephContext *cct, bool have_cache) {
-    return do_init(cct, have_cache, false);
+  int init(CephContext *cct, bool have_cache, bool run_sync) {
+    return do_init(cct, have_cache, false, run_sync);
   }
 
   int init_raw(CephContext *cct, bool have_cache) {
-    return do_init(cct, have_cache, true);
+    return do_init(cct, have_cache, true, false);
   }
   void shutdown() {
     _svc.shutdown();
index 0270a0aecef3ffee9a2c22b63cef8c57ba439245..ea7f61883d60ed9068ce027a4b0ff08a5d7cda3a 100644 (file)
@@ -1265,7 +1265,6 @@ int RGWMetaSyncSingleEntryCR::operate() {
 
     if (error_injection &&
         rand() % 10000 < cct->_conf->rgw_sync_meta_inject_err_probability * 10000.0) {
-      ldpp_dout(sync_env->dpp, 0) << __FILE__ << ":" << __LINE__ << ": injecting meta sync error on key=" << raw_key << dendl;
       return set_cr_error(-EIO);
     }
 
index a8f35fe837e5f93bede08ef038257d6c8da6704b..45868e8fc28784d2f04f0d02d5c8ef7ca9d66668 100644 (file)
@@ -18,7 +18,7 @@
 using Svc = RGWSI_MDLog::Svc;
 using Cursor = RGWPeriodHistory::Cursor;
 
-RGWSI_MDLog::RGWSI_MDLog(CephContext *cct) : RGWServiceInstance(cct) {
+RGWSI_MDLog::RGWSI_MDLog(CephContext *cct, bool _run_sync) : RGWServiceInstance(cct), run_sync(_run_sync) {
 }
 
 RGWSI_MDLog::~RGWSI_MDLog() {
@@ -45,7 +45,8 @@ int RGWSI_MDLog::do_start()
   period_history.reset(new RGWPeriodHistory(cct, period_puller.get(),
                                             current_period));
 
-  if (svc.zone->need_to_sync()) {
+  if (run_sync &&
+      svc.zone->need_to_sync()) {
     // initialize the log period history
     svc.mdlog->init_oldest_log_period();
   }
index 7649233e7a09127f83dadac3f24227e729702859..b2e7e4f38aa111f3513f394ef7646c20a8e13249 100644 (file)
@@ -47,13 +47,15 @@ class RGWSI_MDLog : public RGWServiceInstance
   // use the current period's log for mutating operations
   RGWMetadataLog* current_log{nullptr};
 
+  bool run_sync;
+
   // pulls missing periods for period_history
   std::unique_ptr<RGWPeriodPuller> period_puller;
   // maintains a connected history of periods
   std::unique_ptr<RGWPeriodHistory> period_history;
 
 public:
-  RGWSI_MDLog(CephContext *cct);
+  RGWSI_MDLog(CephContext *cct, bool run_sync);
   virtual ~RGWSI_MDLog();
 
   struct Svc {