]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: only trim data/bilogs if the local zone exports data
authorCasey Bodley <cbodley@redhat.com>
Tue, 11 Feb 2020 15:04:20 +0000 (10:04 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 13 Feb 2020 20:39:01 +0000 (15:39 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/services/svc_zone.cc
src/rgw/services/svc_zone.h

index 04e43ac6d6bb2d1854aee3fd2e4eb6ea04dda05e..88ca696e6c3d9ccc38593533dd60f41d5a28dd64 100644 (file)
@@ -589,15 +589,17 @@ public:
                                        trim_interval));
     stacks.push_back(meta);
 
-    auto data = new RGWCoroutinesStack(store->ctx(), &crs);
-    data->call(create_data_log_trim_cr(store, &http,
-                                       cct->_conf->rgw_data_log_num_shards,
-                                       trim_interval));
-    stacks.push_back(data);
+    if (store->svc()->zone->sync_module_exports_data()) {
+      auto data = new RGWCoroutinesStack(store->ctx(), &crs);
+      data->call(create_data_log_trim_cr(store, &http,
+                                         cct->_conf->rgw_data_log_num_shards,
+                                         trim_interval));
+      stacks.push_back(data);
 
-    auto bucket = new RGWCoroutinesStack(store->ctx(), &crs);
-    bucket->call(bucket_trim->create_bucket_trim_cr(&http));
-    stacks.push_back(bucket);
+      auto bucket = new RGWCoroutinesStack(store->ctx(), &crs);
+      bucket->call(bucket_trim->create_bucket_trim_cr(&http));
+      stacks.push_back(bucket);
+    }
 
     crs.run(stacks);
     return 0;
index db44bc192fdc0785906e55dcffe518883efc2225..df5386930512b693a59dbbe522aeef45bcb6d730 100644 (file)
@@ -202,6 +202,7 @@ int RGWSI_Zone::do_start()
   }
 
   writeable_zone = sm->supports_writes();
+  exports_data = sm->supports_data_export();
 
   /* first build all zones index */
   for (auto ziter : zonegroup->zones) {
@@ -883,11 +884,6 @@ bool RGWSI_Zone::zone_is_writeable()
   return writeable_zone && !get_zone().is_read_only();
 }
 
-bool RGWSI_Zone::sync_module_supports_writes() const
-{
-  return writeable_zone;
-}
-
 uint32_t RGWSI_Zone::get_zone_short_id() const
 {
   return zone_short_id;
index 5a51b6de2537aaf8022ab1f4b044c8ec8bf8843e..982ab8a8d27e384a80f422e692d872b3b951b6ef 100644 (file)
@@ -41,6 +41,7 @@ class RGWSI_Zone : public RGWServiceInstance
   rgw_zone_id cur_zone_id;
   uint32_t zone_short_id{0};
   bool writeable_zone{false};
+  bool exports_data{false};
 
   std::shared_ptr<RGWBucketSyncPolicyHandler> sync_policy_handler;
   std::map<rgw_zone_id, std::shared_ptr<RGWBucketSyncPolicyHandler> > sync_policy_handlers;
@@ -94,7 +95,8 @@ public:
   bool zone_is_writeable();
   bool zone_syncs_from(const RGWZone& target_zone, const RGWZone& source_zone) const;
   bool get_redirect_zone_endpoint(string *endpoint);
-  bool sync_module_supports_writes() const;
+  bool sync_module_supports_writes() const { return writeable_zone; }
+  bool sync_module_exports_data() const { return exports_data; }
 
   RGWRESTConn *get_master_conn() {
     return rest_master_conn;